TimBob12 Posted November 16, 2010 Share Posted November 16, 2010 Hi there, I am currently working on a mod (http://www.lucasforums.com/showthread.php?t=205833) and am having a problem. I am trying to spawn a placeable and an NPC but I only want to spawn them if a global bool is set to true. Currently I have this script set in the OnOpen event of a corpse that sets the variable: void main() { SetGlobalBoolean("STOLE_CORPSE_FOUND", TRUE); } And using my limited C++ knowledge i have had a go at creating a conditional spawn script 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); int iResult; iResult = (GetGlobalBoolean("STOLE_CORPSE_FOUND") ); if (iResult == TRUE) { object oNPC1 = CreateObject(OBJECT_TYPE_CREATURE, "twilek", Location(Vector(194.69,64.87,3.75), 180.0)); object oP1 = CreateObject(OBJECT_TYPE_PLACEABLE, "safe_box", Location(Vector(221.11,93.16,3.75), 180.0)); } } ExecuteScript("k_ptat17_enter_old", OBJECT_SELF); } Even after opening the corpse the container and NPC don't appear. Also I extracted the enter script for "tat_m17aa" but when I extracted it, it was called this: "k_ptat17_enter" I take it this is the same as tat_m17aa as i was aiming for anchorhead. Yeah so any help with this would be massively appreciated. Thanks Tim Link to comment Share on other sites More sharing options...
harIII Posted November 16, 2010 Share Posted November 16, 2010 Try this, I replaced the properties of my script with those of yours so it should work as is. Just make sure that you turn the condition to false after it has been triggered because that means, in this case, that every time you enter the module it will spawn the twilek and the box. void main() { if (GetGlobalBoolean("STOLE_CORPSE_FOUND") == TRUE) { object oNPC1 = CreateObject(OBJECT_TYPE_CREATURE, "twilek", Location(Vector(194.69,64.87,3.75), 180.0)); object oP1 = CreateObject(OBJECT_TYPE_PLACEABLE, "safe_box", Location(Vector(221.11,93.16,3.75), 180.0)); SetGlobalBoolean("STOLE_CORPSE_FOUND", FALSE); } } Link to comment Share on other sites More sharing options...
TimBob12 Posted November 17, 2010 Author Share Posted November 17, 2010 They still didn't show up. I am gonna check to see whether the global is working or not. Link to comment Share on other sites More sharing options...
harIII Posted November 17, 2010 Share Posted November 17, 2010 Make sure that the global is set to true, that's what the script is set up to do so far. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.