Jump to content

Home

Two scripting questions


Fallen Guardian

Recommended Posts

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_TYPE_INSTANT, EffectDeath(), GetObjectByTag("n_merc01")));

object oNPC=GetObjectByTag("n_merc01");

AssignCommand(oNPC2,ApplyEffectToObject(DURATION_TYPE_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?

Link to comment
Share on other sites

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_TYPE_INSTANT, EffectDeath(), oNPC));

AssignCommand(oNPC2,ApplyEffectToObject(DURATION_TYPE_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.

Link to comment
Share on other sites

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_TYPE_INSTANT, EffectDeath(), oNPC));

AssignCommand(oNPC2,ApplyEffectToObject(DURATION_TYPE_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.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...