Jump to content

Home

Hostility and Spawning Problems


TimBob12

Recommended Posts

Hi there,

I am quite new here and to the modding scene and am working on my first proper mod. I have a script that spawns a rodian in the Tatooine Cantina. I have set up a dialog and an option to make him hostile. When I kill him he dies. But when I leave the cantina and re-enter his remains are still there and there is a new rodian. Is there a way to fix this?

 

Here is my on_enter script

 


void main()
{
 object oEntering = GetEnteringObject();
 object oPC=GetFirstPC();
 if (GetIsPC(oEntering))
     {
     //check if the object is already there to avoid multiple objects
     if  (!GetIsObjectValid(GetObjectByTag("rodian")))
           {
         //Note that the script uses OBJECT_TYPE_CREATURE instead of OBJECT_TYPE_PLACEABLE - that's the only difference with the container:
         CreateObject(OBJECT_TYPE_CREATURE, "rodian", Location(Vector(6.32,-6.96,-0.18), 180.0));

           }
     }

    ExecuteScript("k_ptat17af_enter_old", OBJECT_SELF); 	

}

 

Here is my hostile script

 


void main() 
{ 
object oNPC=GetObjectByTag("rodian"); 
ChangeToStandardFaction(oNPC, 1);  
}

 

Thanks in advance.

 

TimBob12

Link to comment
Share on other sites

Hello, and welcome to the forums! :waive1: Now, about your problem, I don't think it's a problem with the scripts. Open up the rodian's utc file in kotor tool. Is it checked as 'Permanent Death' (In 'Advanced' part of the utc file)? If so, then he'll keep respawning no matter how many times he is killed. Just uncheck it. Hope this helps!

Link to comment
Share on other sites

The problem is that you have it on the OnEnter so everytime you enter it will spawn the npc, etc...you need to establish a local so it fires only once...try this

 

void main()
{
// ST: Check if it's the player entering the trigger, and that it hasn't already fired 
if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { 

// ST: Make sure the trigger only fires once. 
SetLocalBoolean(OBJECT_SELF, 40, TRUE); 


         CreateObject(OBJECT_TYPE_CREATURE, "rodian", Location(Vector(6.32,-6.96,-0.18), 180.0));

           }
     }

    ExecuteScript("k_ptat17af_enter_old", OBJECT_SELF); 	

}

 

 

see how this works.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...