PDA

View Full Version : conditional spawning of multiple Npcs


Hunters Run
06-23-2009, 01:05 PM
This is for tsl

I am trying to spawn three npcs (let us call them twilek_thug1,2,and3 respectively ) and have them initiate a conversation with the pc after the Global Boolean 203Tel_Slusk_Dead has been activated. I have already tried several scripts yet these thugs refuse to appear.
Any help help/advice will be greatly appreciated.

zbyl2
06-23-2009, 02:45 PM
If you'd post scripts you made, maybe someone would be able to find out what's wrong with them.
Anyway, I don't know where you want to fire your script, but here is code that should spawn your NPCs:

if(GetGlobalBoolean("203Tel_Slusk_Dead")) {
CreateObject(OBJECT_TYPE_CREATURE, "twilek_thug1", Location(Vector(0.0, 0.0, 0.0), 0.0f));
CreateObject(OBJECT_TYPE_CREATURE, "twilek_thug2", Location(Vector(0.0, 0.0, 0.0), 0.0f));
CreateObject(OBJECT_TYPE_CREATURE, "twilek_thug3", Location(Vector(0.0, 0.0, 0.0), 0.0f));
}

Of course, you will also need to change all those "0.0" to X, Y and Z coordinates where you want your NPC spawned.

Hunters Run
06-23-2009, 06:22 PM
Thanks for the quick reply.
Well, it works and they're spawned. However I am unable at the moment to initiate a conversation with them. No worries, I'll "mess around" so to speak and and see what I can do about that.

edit: I have managed to have them spawn on a trigger and initiate a conversation. However they keep spawning. Is there a way I can have them spawn only once.

zbyl2
06-24-2009, 06:08 AM
To spawn them just once, you may add this to your trigger OnEnter script:


if(GetLocalBoolean(OBJECT_SELF, 20)) {
return;
}


SetLocalBoolean(OBJECT_SELF, 20, 1);

It will set local boolean for trigger when you enter this, but it won't do anything if local is already set (when you enter trigger for second time).

Hunters Run
06-24-2009, 05:18 PM
well I tried that script but they kept spawning then I tried

DestroyObject(OBJECT_SELF);
and it worked.

on another note, how do I give a npc a twilek voice over and lipsyncing?

edit: it occurs to me in hindsight that I should be more clear. What I want to do is give the twileks twilek voices yet even though I put the correct number in the alienrace node of the dlgeditor all I get is silence.