Jump to content

Home

Spawning via Global question


Ferc Kast

Recommended Posts

I had a question for spawning an object through global. But, I had question.

 

If the object was declared in the .git, would the script for spawning the object (via a Global) require the x, y and z coordinates and the rotations? Or could I just tell it to spawn the object, with the game knowing where the object belongs in the module? :raise:

Link to comment
Share on other sites

If it's in the .git file, it doesn't need a spawn script.

 

Also, I can't make out what on Spiridon you mean about spawning via a global.

 

What I mean about spawning an object via a global: Clicky

 

I believe it would need a spawn script if it's not supposed to show until a global was set true. I wanted to know if it was possible to put the object in the .git and then just have the script spawn the object.

Link to comment
Share on other sites

Never mind; I just made a script that compiled that does what I had wanted. :) Though, it's not exactly what I had in mind, but it's close enough for me.

 

void main() {

string sGlobal = "Global_Name";
object oCreature = GetObjectByTag("Creature_Tag");
object oWaypoint = GetObjectByTag("Waypoint_Tag");
string sScript = "Script_Name";

if ((GetGlobalBoolean(sGlobal)==TRUE))
   {
CreateObject(OBJECT_TYPE_CREATURE, oCreature, GetLocation(oWaypoint));
SetGlobalBoolean(sGlobal,FALSE);
ExecuteScript(sScript, OBJECT_SELF, 1002);    
   }
else {
if ((GetGlobalBoolean(sGlobal)==FALSE))
ExecuteScript(sScript, OBJECT_SELF, 1002);    
}
}

Link to comment
Share on other sites

I believe it would need a spawn script if it's not supposed to show until a global was set true. I wanted to know if it was possible to put the object in the .git and then just have the script spawn the object.

 

Objects added via the GIT file are pre-placed in the area and will be spawned when the area is first instantiated. If, for some reason you want a pre-placed creature in an area not to be visible from the start, and it's for TSL, you can hide a creature by turning off it rendering and disabling its AI. Then when you want it to show you can just re-enable rendering and release the AI block.

 

In most cases simply spawning the creature via scripting when it needs to appear would be easier though.

 

(Your script contains syntax errors and isn't going to compile, by the way. You're trying to use an object reference variable where it expects a string parameter in the CreateObject() function call.)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...