Jump to content

Home

Help with scripting a three way dialogue check


Darth_sidek

Recommended Posts

In a mod I am making, there is a dialogue where you can choose to run from a Jedi Master/Battle him/ Join him. Now, after this in a entirely different module, I need to script it to check which of the three options where chosen in that dialogue, then decide which Npc should spawn in the other module. I know how to set where the NPC(S) should spawn, but I cannot find out how to check out that specific dialogue and spawn the specific enemy on entry. Thanks in advance.

Link to comment
Share on other sites

In a mod I am making, there is a dialogue where you can choose to run from a Jedi Master/Battle him/ Join him. Now, after this in a entirely different module, I need to script it to check which of the three options where chosen in that dialogue, then decide which Npc should spawn in the other module. I know how to set where the NPC(S) should spawn, but I cannot find out how to check out that specific dialogue and spawn the specific enemy on entry. Thanks in advance.

 

Add a new global number variable to the globalcat.2da file. Then on the dialog reply node for each choice set the Script #1 field to a_global_set, set the P1 field for this script to a unique number for each of the three responses (i.e. 1, 2, 3) , and set the String Param to the name of your new global number as set in globalcat.2da.

 

This will make your global number keep track of which dialog response has been chosen. Then in the other area, add something like this to the OnEnter script of the area (set in the ARE file):

 

void main() {
   if ((GetEnteringObject() == GetFirstPC()) && !GetLoadFromSaveGame()) {
       int iReply = GetGlobalNumber("[color=PaleGreen]MY_GLOBAL[/color]");

       if (iReply == 1) {
           CreateObject(OBJECT_TYPE_CREATURE, "[color=Pink]RUN_NPC[/color]", Location(Vector([color=Yellow]0.0, 0.0, 0.0[/color]), 0.0));
           SetGlobalNumber("[color=PaleGreen]MY_GLOBAL[/color]", 4);
       }
       else if (iReply == 2) {
           CreateObject(OBJECT_TYPE_CREATURE, "[color=Pink]BATTLE_NPC[/color]", Location(Vector([color=Yellow]0.0, 0.0, 0.0[/color]), 0.0)); 
           SetGlobalNumber("[color=PaleGreen]MY_GLOBAL[/color]", 4);
       }
       else if (iReply == 3) {
           CreateObject(OBJECT_TYPE_CREATURE, "[color=Pink]JOIN_NPC[/color]", Location(Vector([color=Yellow]0.0, 0.0, 0.0[/color]), 0.0));
           SetGlobalNumber("[color=PaleGreen]MY_GLOBAL[/color]", 4);
       }
   }
}

 

Replace MY_GLOBAL with the name of the Global Number you added to globalcat.2da. Replace RUN_NPC / BATTLE_NPC / JOIN_NPC with the UTC names for the various NPCs you need to spawn. And replace 0.0, 0.0, 0.0 with the X, Y, Z coordinates for where in the area you want them to spawn.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...