PDA

View Full Version : Hostility and Spawning Problems


TimBob12
06-20-2010, 07:45 AM
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

LDR
06-20-2010, 11:08 AM
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!

TimBob12
06-20-2010, 02:00 PM
I tried that but he still respawns. I also unchecked the box saying No Interrupt but I can't click through the conversation. Dunno why it's happening. Thanks anyway.

LDR
06-20-2010, 02:53 PM
If it isn't checked as 'Permanent Death' , then I think it might have something to do with the on enter script, but I might be wrong.

newbiemodder
06-20-2010, 03:44 PM
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.

TimBob12
06-21-2010, 12:07 PM
Hey thanks a lot, it worked.

Thanks again.

TimBob12