jemapa Posted October 22, 2016 Share Posted October 22, 2016 So, I am writing up an interjection in which my NPC attacks the party in a certain situation (if the player chooses to attack Valygar when meeting him). I'm using a simple DO ~LeaveParty() Enemy()~ to make this work. The problem: the NPC turns hostile and starts attacking, but after a round or so, she stops attacking, and instead walks up to initiate dialogue with the PC. I've made sure there's no actual dialogue that triggers in this situation, but that doesn't stop her from walking up and trying. How can I prevent this from happening? Link to comment
Jarno Mikkola Posted October 22, 2016 Share Posted October 22, 2016 You might want to assign hostile scripts in all the characters slots. Or just one and leave the rest to none ... Link to comment
jemapa Posted October 22, 2016 Author Share Posted October 22, 2016 Ah, that did it! Thank you. I'm a bit confused, though... there's nothing in her original script that would cause her to initiate dialogue. Why does this fix this problem? My guess is: "initiate dialogue after leaving party" is hard-coded into the game, but lower in priority than commands from the character's script. Her default script contained no commands for this situation, but the hostile script is constantly sending commands, preventing the dialogue from ever starting. Is that what's going on here? Link to comment
Jarno Mikkola Posted October 22, 2016 Share Posted October 22, 2016 It could be the baldur.bcs that's commanding the char to try to start the dialog. .. I don't really have enough xp to say for sure. Link to comment
Ardanis Posted October 22, 2016 Share Posted October 22, 2016 JoinParty() and LeaveParty() actions forcibly sets some slots to specific scripts. // joining the party: // // OVERRIDE -> no change // CLASS -> DEFAULT // RACE -> NONE // GENERAL -> NONE // DEFAULT -> DPLAYER2 // removal from party: // // OVERRIDE -> no change // CLASS -> NONE // RACE -> NONE // GENERAL -> WTASIGHT // DEFAULT -> no change So, you probably wanna use DO ~ChangeAIScript("",DEFAULT) LeaveParty() Enemy()~. Link to comment
jemapa Posted October 22, 2016 Author Share Posted October 22, 2016 Ah, I see, so it's DPLAYER2 that was initiating the dialogue. Awesome, everything makes sense now Link to comment
temnix Posted October 23, 2016 Share Posted October 23, 2016 Or use DO ~ChangeAIScript("whatever you write",AREA). I keep advertising my discovery that creatures have area-tier scripts under override, but no one's listening. Link to comment
Ardanis Posted October 23, 2016 Share Posted October 23, 2016 I'm not sure how that's going to clear DPLAYER2? Link to comment
Roxanne Posted October 23, 2016 Share Posted October 23, 2016 The behaviour is caused by dplayer2.bcs IF !InParty(Myself) HPGT(Myself,0)THEN RESPONSE #100 SetLeavePartyDialogFile() Dialogue(Player1) ChangeAIScript("",DEFAULT) //!!The script is only de-assigned after the NPC has (tried to) talked to the Player!!!END So you can either use the code in post #5 above ChangeAIScript("",DEFAULT) where you can also define any other script as DEFAULT (in the example *none* script is assigned). Or you can modify dplayer2 IF !InParty(Myself) HPGT(Myself,0) !CharName("MYNPC",Myself) //whatever MYNPC is in your caseTHEN Link to comment
temnix Posted October 24, 2016 Share Posted October 24, 2016 Area-level scripts of creatures are just one tier below Override. The AI is obviously enabled for NPC when they leave the party, or they wouldn't run any of the scripts, and Override, as we see above, doesn't change. By assigning a custom script to Area you can step in before lower-tier scripts like Default and directly write the actions you need - attack etc. Just put True() as the trigger of the script, and preferably set a Global in the end, too, if you ever want to get out of the loop. Or don't set a Global but just use another opcode 82/ChangeAIScript("",AREA) with a different, empty, Area file. Empty files are skipped, so the NPC will descend to the regular lower-tier scripts. You can add a 1-second Feeblemind if you need to force a creature to stop its current script-running and reconsider the hierarchy of scripts from the top. You may think this is a bit messy, but it's potentially vastly more powerful and flexible than any scripted solution. With Area you can just write whole behaviors for NPC, then phase the scripts in or out. The only thing with higher priority than Area is Override, and that one should be left alone. Link to comment
Avenger Posted November 3, 2016 Share Posted November 3, 2016 I recommend this only if you will need to restore the other scripts later. Otherwise, nuking dplayer2 is preferable. Messy, in this case means unwanted script bits that might be given a chance to act and cause hard to find problems. On the other hand, restoring some scripts is not trivial, especially in pre-EE games. Link to comment
temnix Posted November 7, 2016 Share Posted November 7, 2016 Avenger, you are pontificating out of your ass. I suggested using AREA-level scripts for creatures. It was my discovery that this can be done, no one had done it before. The Area-level scripts are below Override in the hierarchy, so all of the individual behavior of a creature and plot-important content is preserved. But Area scripts are above all other levels like Class and Default, so you can put your desired actions there without affecting regular AI. There is no need to restore any scripts for the Area tier either, because creatures have nothing there normally. The only thing a modder needs to do is falsify the script when it has done its job, e.g. put a Global in the end of the actions list or use 82 again to put another script in Area, one that always checks false. Then lower-tier scripts can come in. All of this is completely safe and works perfectly. Link to comment
Avenger Posted November 7, 2016 Share Posted November 7, 2016 Really... Man. I've been working with the IE for more than a decade. I've given my advice out of goodwill with that decade of modding experience and literally knowing the engine inside out. I also worked on all recent EE titles as a programmer and scripter. Obviously, you know better, so i won't give any advice to you in the future. Link to comment
Fiann of the Silver Hand Posted November 8, 2016 Share Posted November 8, 2016 There's a tiny handful of CREs that have that Area script used; a couple of Copper Coronet guards are the ones I remember. Unfortunately, I don't think there's an easy way to search for this with NI, and I don't have a reason to try something with weidu to do so. Be careful that you're not breaking anything. Link to comment
Ardanis Posted November 8, 2016 Share Posted November 8, 2016 There is no need to restore any scripts for the Area tier either, because creatures have nothing there normally. The rule of thumb with IE scripting is that simpler solutions are vastly preferable and more stable. Same reason I never consider using invisible summons to script something, even if they do offer more flexibility. If you can safely accomplish your goals by nuking dplayer2 before it fires, then you should. It's a "system" script with very specific purpose, so nobody is expected to mod it significantly (if they do, it'll be their responsibility something stopped working, not yours). Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.