I'm working out some kinks in the first in-door module of Mustafar (no where near done, just adding some stuff before I move on). I have a couple of guards at the entrance, near me. What I want is a script to activate the dialog of those guards, and, on the first dialog node, I want both of my guards to flourish. What would that script be?
You can use to this script with "CreatureFlourishWeapon" function.
void main() {
CreatureFlourishWeapon(GetObjectByTag("tag of NPC"));
}
Thank you. While I was making some dialog, I had an idea. One of the guards will have a short temper, and if you refuse to tell him who you are, he'll fight you. Now, I need a script that'll change his faction from friendly to hostile, and, a script that'll check if jediguard01 is dead. If he is dead, jediguard02 will start some dialog, and then attack you. Then, once he is dead, I want everyone in the first module to turn hostile, but those in the other modules aren't affected.
Basically:
A script that changes from Friendly to Hostile
A script that checks if the first guard who attacks you is dead.
A script that changes from Friendly to Hostile
Just ChangeToStandardFaction() function.
void main() {
ChangeToStandardFaction(GetObjectByTag("tag of NPC"), STANDARD_FACTION_HOSTILE_1);
}
A script that checks if the first guard who attacks you is dead.
Open your "jediguard01" file in Kotor Tool, go to 'script' tab and put script that starting conversation to OnDeath field (I hope you know how to make script to start conversation ;))
Open your "jediguard01" file in Kotor Tool, go to 'script' tab and put script that starting conversation to OnDeath field (I hope you know how to make script to start conversation ;))
Fortunately, I do (hopefully :p)
Anyways, I asked the Stoffe my scripting questions, and she recommended the SetIsDestroyable() function. Now, here is my current script:
int StartingConditional() {
object oNPC = GetObjectByTag("jediguard01");
return GetIsObjectValid(oNPC) && GetIsDead(oNPC);
SetIsDestroyable(bDestroyable=FALSE, bRaiseable=FALSE, bSelectableWhenDead=FALSE);
}
Now, it says there is an eror on line 4, which happens to be the SetIsDestroyable function. I just can't figure out whats wrong with it. I'm guessing that the function should be placed after the last bracket... but I wouldn't know how to do that.
Fortunately, I do (hopefully :p)
Anyways, I asked the Stoffe my scripting questions, and she recommended the SetIsDestroyable() function. Now, here is my current script:
Now, it says there is an error on line 4, which happens to be the SetIsDestroyable function. I just can't figure out whats wrong with it. I'm guessing that the function should be placed after the last bracket... but I wouldn't know how to do that.
It was the b's that were making the errors for it to not compile. ;) (Not that I've made similar script errors in the past. :p) This should work perfectly:
int StartingConditional() {
object oNPC = GetObjectByTag("jediguard01");
return GetIsObjectValid(oNPC) && GetIsDead(oNPC);
SetIsDestroyable(FALSE, FALSE, FALSE);
}
All right, thanks. Now, I have a new problem.
void main()
{
ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DEATH);
/*
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))
{
SpeakString("GEN_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("GEN_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_DEATH))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
*/
ExecuteScript("dead_dlg", oNPC "jediguard02");
}
I'm trying to use the ExecuteScript function to activate my dead_dlg script, but, I'm trying to get the executed script to fire on the utc, which in this case is "jediguard02"
Basically:
I make jediguard01 fight me, and, when he dies, I have to have dead_dlg script fire on jediguard02.
(Note - The above script is the OnDeath, in case you didn't know, but, I doubt you didn't.)
I think that this script should do it:
void main()
{
object oNPC=GetObjectByTag("jediguard02");
ExecuteScript("dead_dlg", oNPC);
}
I think that this script should do it:
void main()
{
object oNPC=GetObjectByTag("jediguard02");
ExecuteScript("dead_dlg", oNPC);
}
So, just a question. Do I place the script at the end of the OnDeath script, so that it looks like this:
void main()
{
ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DEATH);
/*
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))
{
SpeakString("GEN_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("GEN_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_DEATH))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
*/
object oNPC=GetObjectByTag("jediguard02");
ExecuteScript("dead_dlg", oNPC);
}
I'm trying to get my dead_dlg script to activate when the death of jediguard01 happens.
It was the b's that were making the errors for it to not compile. ;) (Not that I've made similar script errors in the past. :p) This should work perfectly:
int StartingConditional() {
object oNPC = GetObjectByTag("jediguard01");
return GetIsObjectValid(oNPC) && GetIsDead(oNPC);
SetIsDestroyable(FALSE, FALSE, FALSE);
}
The SetIsDestroyable() statement would never get executed in that script. A script terminates at the return statement, nothing coming after it will be run.
Also, the above script is a dialog conditional script. In those you usually just want to check if some condition is met for a dialog node to be shown, not perform any actions like that. Further, the script above would turn off corpse fade for the dialog owner, not the NPC you are checking for.
If you want to make an NPC stick around permanently after they've died you usually want to use SetIsDestroyable() in their OnSpawn event script.
I'm trying to get my dead_dlg script to activate when the death of jediguard01 happens.
The OnDeath script only runs when the creature is dead. So you don't need those things but it doesn't hurt to have them there either.