Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Two scripting questions

Page: 1 of 1
 Fallen Guardian
01-09-2011, 12:39 PM
#1
So my first script I need is for two NPCs to die on the death of another NPC. I found a script and it works fine except it only kills off one of the NPCs. Here is the script.

void main()
{
object oNPC=GetObjectByTag("n_merc01");
object oNPC2=GetObjectByTag("n_merc02");
AssignCommand(oNPC,ApplyEffectToObject(DURATION_TY PE_INSTANT, EffectDeath(), GetObjectByTag("n_merc01")));
object oNPC=GetObjectByTag("n_merc01");
AssignCommand(oNPC2,ApplyEffectToObject(DURATION_T YPE_INSTANT, EffectDeath(), GetObjectByTag("n_merc02")));
ActionStartConversation(GetFirstPC(),"n_ethan");
}

Second question. I want an NPC to fire on another NPC. I gpt tje script and put it in the right spot in the dialogue file but it just skips the script. Here is the script.

void main() {


object oTrask=GetObjectByTag("n_ethan");
object oDroid=GetObjectByTag("n_merc02");


SetMinOneHP(oDroid,FALSE);

AssignCommand(oTrask,ClearAllActions());
CancelCombat(oTrask);

ChangeToStandardFaction(GetObjectByTag ("n_merc02"), 12);
ChangeToStandardFaction(GetObjectByTag ("n_ethan"), 11);

AssignCommand(oTrask, GN_DetermineCombatRound());
AssignCommand(oDroid, GN_DetermineCombatRound());

ActionResumeConversation();
}

Can anyone help?
 TimBob12
01-09-2011, 12:53 PM
#2
first question is it for K1 or K2 cos I am on a different computer but I can access files on my otherone so I know which copy of nwnscript.nss to pull off.

EDIT:
Why are you using GetObjectByTag each time?

This would be clearer


void main()
{
//NPCs
object oNPC=GetObjectByTag("n_merc01");
object oNPC2=GetObjectByTag("n_merc02");

//Actions
AssignCommand(oNPC,ApplyEffectToObject(DURATION_TY PE_INSTANT, EffectDeath(), oNPC));

AssignCommand(oNPC2,ApplyEffectToObject(DURATION_T YPE_INSTANT, EffectDeath(), oNPC2));

ActionStartConversation(GetFirstPC(),"n_ethan");
}


Also you had spaces in between the T and the Y of TYPE

See if that works. I just cleared it up a little.
 Qui-Gon Glenn
01-09-2011, 1:41 PM
#3
Why are you using GetObjectByTag each time? beat me to it!

This would be clearer


void main()
{
//NPCs
object oNPC=GetObjectByTag("n_merc01");
object oNPC2=GetObjectByTag("n_merc02");

//Actions
AssignCommand(oNPC,ApplyEffectToObject(DURATION_TY PE_INSTANT, EffectDeath(), oNPC));

AssignCommand(oNPC2,ApplyEffectToObject(DURATION_T YPE_INSTANT, EffectDeath(), oNPC2));

ActionStartConversation(GetFirstPC(),"n_ethan");
}
I like this.

The other issue I saw in your code, Fallen Guardian, was that you set the value for oNPC twice... once is enough :) ( I am sure this was just a copy/paste error ;) )

As for your second question, my only thought is the factions you changed those NPC's to... are those Gizka factions? The code looks fine, but you could accomplish this by having Trask "pretend" to shoot the droid, by ActionPlayAnimation(xxxx), whatever animation shooting is... You would need to apply an animation to the target of the shot, oDroid I guess, but this could work.
 Fallen Guardian
01-09-2011, 3:53 PM
#4
Thanks both of you. I actually got this out of the Brother hood of shadow source scripts. It's for kotor 1. For some reason the Conversation still won't start though.
 TimBob12
01-09-2011, 4:48 PM
#5
Do they both die now though. Make sure the conversation has the right filename
 TimBob12
01-09-2011, 5:17 PM
#6
Do they both die now though. Make sure the conversation has the right filename

Edit sorry for the duble post my phone went onto sleep mode while posting. When i turned it on it posted aggain. If a mod could delete pleaase
 Fallen Guardian
01-09-2011, 5:28 PM
#7
Yeah they both die. And it is the right file name.
Page: 1 of 1