Jump to content

Make party member hostile without initiating dialogue


jemapa

Recommended Posts

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

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

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

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 case
THEN

Link to comment

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

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

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

:)

 

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
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...