Pikmin Posted March 28, 2008 Share Posted March 28, 2008 What function can be used to check a global within a OnEnter script, and how can I make it so that if it returns that the global is 1 it applies the effect only the first time you enter the module not over and over? Link to comment Share on other sites More sharing options...
Robespierre Posted March 29, 2008 Share Posted March 29, 2008 Okay. Let's say your original global is called "Global_Check". This is the code you would use to return that global: void main() { if (GetGlobalBoolean("Global_Check") && (GetEnteringObject() == GetFirstPC())) } This means that it will check the global if the PC is entering the module. Place this in the On_enter script for the module you want. Then you can add the script for whatever should happen if the global is 1. Now, if you don't want this to happen again, you can either set the global to 0 like so void main() { if (GetGlobalBoolean("Global_Check") && (GetEnteringObject() == GetFirstPC())) { SetGlobalBoolean("Global_Check", 0); } } Or (if you want to use the "Global_Check" boolean for something else) you can set a new global (let's call it "Check_Visited") to 1 and add that to the On_Enter script like so: void main() { if (GetGlobalBoolean("Global_Check") && (GetEnteringObject() == GetFirstPC())) && (!GetGlobalBoolean("Check_Visited") { SetGlobalBoolean("Check_Visited", 1); } } And that should do it. That way the script won't fire if you're already visited an area. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.