Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Spawning via Global question

Page: 1 of 1
 Ferc Kast
11-14-2008, 10:54 PM
#1
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:
 Darth InSidious
11-14-2008, 11:01 PM
#2
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.
 Ferc Kast
11-14-2008, 11:33 PM
#3
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 (http://lucasforums.com/showthread.php?t=187464)

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.
 Darth InSidious
11-14-2008, 11:35 PM
#4
What I mean about spawning an object via a global: Clicky (http://lucasforums.com/showthread.php?t=187464)

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.

No, not possible. Sorry.
 Ferc Kast
11-15-2008, 12:08 AM
#5
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);
}
}
 stoffe
11-15-2008, 9:14 AM
#6
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.)
Page: 1 of 1