Jump to content

Home

I need a script to spawn a NPC...


Miles Edgeworth

Recommended Posts

The only problem is a couple of conditions have to be met. I can't find the script I attempted to use for this purpose (:headbump), anyways the conditions are:

 

1. Mira has to be in the current Party.

 

2. The NPC is going to be spawned in Jekk'Jekk Tarr, and this can't be the time Mira comes in there, wearing a Space Suit and is the Party leader.

 

3. He can't be dead, but he has to look dead.

 

4. He can't spawn again.

 

So if anyone could help me, that would be great! This is for a recruitment mod and you will be credited.

Link to comment
Share on other sites

The only problem is a couple of conditions have to be met. I can't find the script I attempted to use for this purpose (:headbump), anyways the conditions are:

 

1. Mira has to be in the current Party.

2. this can't be the time Mira comes in there, wearing a Space Suit and is the Party leader.

3. He can't be dead, but he has to look dead.

4. He can't spawn again.

 

The spawn script might look something like this (change the coordinates and name of the UTC file to whatever you need):


void main() {    
   if (IsNPCPartyMember(NPC_MIRA)
       &&  GetIsPlayerMadeCharacter(GetFirstPC())
       && !GetLocalBoolean(OBJECT_SELF, 113))
   {
       location lLoc = Location(Vector(1.0, 2.0, 3.0), 0.0);
       CreateObject(OBJECT_TYPE_CREATURE, "UTCFileName", lLoc);    
       SetLocalBoolean(OBJECT_SELF, 113, TRUE);
   }
}

 

As for the "look dead" part that's probably best handled by giving the NPC a custom OnSpawn event script (set in the UTC file of the NPC) that makes it play the "dead" animation if spawning and not a party member. Something like:

#include "k_inc_generic"

void main() {
   // ST: Standard SpawnIn setup...
   SetIsDestroyable(TRUE,TRUE,TRUE);
   GN_SetListeningPatterns();
   GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT);
   GN_SetListeningPatterns();
   SetLocalNumber(OBJECT_SELF, 11, 6);

   // ST: Play dead!
   if ((GetModuleName() == "304NAR") && !IsObjectPartyMember(OBJECT_SELF)) {
       DelayCommand(0.5, PlayAnimation(ANIMATION_LOOPING_DEAD, 1.0, -1.0));
   }
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...