Jump to content

Home

Help with Spawn Duncan script


Seamhainn

Recommended Posts

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);

}

}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...