Jump to content

Home

Spawning inconvenient...


GeorgNihilus

Recommended Posts

Hi again people :) , this time I have a problem when spawning a couple of war droids in a Manaan area, I never had problems before spawning creatures but this time they spawn in hostile state! :mad: firing at everyone in the place ... I used this to spawn them:

 

// spawns 2 war droids in a Manaan's East Central
// spot pretty near the 3 sith soldiers of this area

void main () {

float x=29.71f;
float y=8.99f;
float z=57.50f;
float r=0.0f;
float xx=30.65f;
float yy=11.82f;
float zz=57.50;
vector vecROB=Vector(x,y,z);
vector vecRO2=Vector(xx,yy,zz);
location locNPC=Location(vecROB, r);
location locNP2=Location(vecRO2, r);
object oNPC=CreateObject(OBJECT_TYPE_CREATURE,"ff_droidmk4_1",locNPC);
object oNP2=CreateObject(OBJECT_TYPE_CREATURE,"ff_droidmk4_2",locNP2);
}

 

of course I already put the .utc's in Override also ... so what should I do to turn them neutral or better friendly? it has something to do with the k_def_spawn01.nss OnSpawn script or can I solve the problem in this same script?

 

thanks on advance :thmbup1:

Link to comment
Share on other sites

No, I didn't modify anything in the droids .utc files, and of course I didn't edit the OnSpawn script ... it's pretty much for my still limited knowledge hmm... ;)

 

If the droids have Hostile set as standard faction then they'll automatically attack anyone in the player-friendly factions on sight. The easiest way of changing that is to modify the faction they belong to in the UTC templates and set it to Neutral (5).

 

If you for some reason want to handle it via script instead you don't need to give them any custom OnSpawn scripts. You can set their faction when you spawn them instead, like:

[color=PaleGreen]// spawns 2 war droids in a Manaan's East Central
// spot pretty near the 3 sith soldiers of this area[/color]

object ST_Spawn(string sResRef, float x, float y, float Angle = 0.0) {
   return CreateObject(OBJECT_TYPE_CREATURE, sResRef, Location(Vector(x, y, 0.0), Angle));
}

void main () {  
   [color=PaleGreen]// ST: Spawn the droids...[/color]
   object oNPC1 = ST_Spawn("ff_droidmk4_1", 29.71, 8.99);
   object oNPC2 = ST_Spawn("ff_droidmk4_2", 30.65, 11.82);

   [color=PaleGreen]// ST: Change their factions to Neutral[/color]
   ChangeToStandardFaction(oNPC1, STANDARD_FACTION_NEUTRAL);
   ChangeToStandardFaction(oNPC2, STANDARD_FACTION_NEUTRAL);
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...