PDA

View Full Version : Help with scripting a three way dialogue check


Darth_sidek
04-08-2007, 12:17 PM
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.

stoffe
04-08-2007, 02:49 PM
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("MY_GLOBAL");

if (iReply == 1) {
CreateObject(OBJECT_TYPE_CREATURE, "RUN_NPC", Location(Vector(0.0, 0.0, 0.0), 0.0));
SetGlobalNumber("MY_GLOBAL", 4);
}
else if (iReply == 2) {
CreateObject(OBJECT_TYPE_CREATURE, "BATTLE_NPC", Location(Vector(0.0, 0.0, 0.0), 0.0));
SetGlobalNumber("MY_GLOBAL", 4);
}
else if (iReply == 3) {
CreateObject(OBJECT_TYPE_CREATURE, "JOIN_NPC", Location(Vector(0.0, 0.0, 0.0), 0.0));
SetGlobalNumber("MY_GLOBAL", 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.

Darth_sidek
04-08-2007, 04:34 PM
Thanks, works great :clap2: