PDA

View Full Version : Help with Spawn Duncan script


Seamhainn
01-21-2008, 01:26 PM
What is wrong with the following script? Unfortunately it does not work...


void main()
{

if (!GetGlobalNumber("Tar_Duel") > 0 ) {

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;

oTarget = GetWaypointByTag("POST_dan26_duncan");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "dan26_duncan", lTarget);

}

}

Stream
01-21-2008, 01:54 PM
Try this

void main()
{

if (!GetGlobalNumber("Tar_Duel") > 0 ) {

object oTarget = GetObjectByTag("POST_dan26_duncan");


lTarget = GetLocation(oTarget);

CreateObject(OBJECT_TYPE_CREATURE, "dan26_duncan", lTarget);

}

}


Hope this helps

--Stream

Seamhainn
01-21-2008, 02:24 PM
Try this

void main()
{

if (!GetGlobalNumber("Tar_Duel") > 0 ) {

object oTarget = GetObjectByTag("POST_dan26_duncan");


lTarget = GetLocation(oTarget);

CreateObject(OBJECT_TYPE_CREATURE, "dan26_duncan", lTarget);

}

}


Hope this helps

--Stream

Stream: The spawn script works perfect. Its the If part that does not work.

Stream
01-21-2008, 02:35 PM
Try this one out


void main()
{

if (GetGlobalNumber("Tar_Duel") == # ) {

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;

oTarget = GetWaypointByTag("POST_dan26_duncan");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "dan26_duncan", lTarget);

}

}
I just noticed the '!' in there, I don't know for sure but I don't think he wants to be there, I haven't come across anything with him placed there before and replace '#' with the number that corresponds to beating Duncan in the duel.

Take care

--Stream

Seamhainn
01-21-2008, 03:52 PM
It has something to do with Boolean if I remember correctly. I took it from a script my goddess stoffe wrote for me some time ago...

Nevertheless it works perfectly now. Duncan is now spawned as lang as the PC defeated at least one more opponent in the arena after Duncan.

I'll make a .rar file in the next few days for the public.

stoffe
01-21-2008, 08:40 PM
It has something to do with Boolean if I remember correctly. I took it from a script my goddess stoffe wrote for me some time ago...


The ! character is a boolean operator that negates the value of the expression preceeding it. If the value would be TRUE it would get turned to FALSE, and vice versa. I'd guess the other script used it when checking if a boolean variable was set.

If such a statement reads...
if (GetLocalBoolean(OBJECT_SELF, 1)
...then the following code would get executed if local boolean variable 1 has been set. If you write...
if (!GetLocalBoolean(OBJECT_SELF, 1)
...then it would get executed if local boolean variable 1 has not been set.

Since the above script checks if a numeric variable has a value higher than 0 however using it like that would most likely get undesirable results. :)