[SCRIPT] Using Global.hps to use a script in every level - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Using Global.hps to use a script in every level (/thread-21486.html) Pages:
1
2
|
Using Global.hps to use a script in every level - Cyfiawn - 05-14-2013 Hi all, I'm looking to make a script run in every level. The script is to change an item in your inventory based on your sanity. I've tried a couple of methods but none seem to work. Here's my code as it stands: global.hps Code: void OnGameStart() I've tried calling "StartLocketLoop" from a map file as well, but it still doesn't want to trigger. I've tried putting the same script into Inventory.hps, but to no avail. Also, does the global.hps keep running between loading maps and relaunching the game etc? Thanks, Cyfiawn RE: Using Global.hps to use a script in every level - PutraenusAlivius - 05-14-2013 Code: void OnGameStart() [if(GetPlayerSanity() >= 70 && !HasItem("HighSanityLocket"))] Look at the code above. Do you see a bolded text? [!] in AngelScripting and C++ meant not. The code above is equivalent to... [if(GetPlayerSanity() LARGER/EQUALS TO 70 AND NOT HasItem("HighSanityLocket"))] RE: Using Global.hps to use a script in every level - Cyfiawn - 05-14-2013 (05-14-2013, 12:39 PM)JustAnotherPlayer Wrote: Removed the extra ;. I derped on that one. However, even the debug message of "Locket Looping" isn't appearing (not sure it should from global.hps). And the if statement is what I want (Over 70 Sanity and doesn't have the item -> Give item). RE: Using Global.hps to use a script in every level - PutraenusAlivius - 05-14-2013 Oh and at the last part. It calls a timer that loops the give item thing. But the one called at the first time (the StartLocketLoop()) doesn't have a timer syntax. RE: Using Global.hps to use a script in every level - Cyfiawn - 05-14-2013 Hmm, I'm not sure the issue is with the loop (although I fixed that), I feel that I can't call scripts like this in the Global file. None of my Debug messages are appearing, even in OnGameStart(), yet my debug messages in each map file are working. RE: Using Global.hps to use a script in every level - Tomato Cat - 05-14-2013 I'm not sure that you can. The global.hps file looks like it keeps track of global variables only. RE: Using Global.hps to use a script in every level - PutraenusAlivius - 05-14-2013 Um no. I've seen some scripts where the global.hps is used for scripting. RE: Using Global.hps to use a script in every level - Tomato Cat - 05-14-2013 (05-14-2013, 03:08 PM)JustAnotherPlayer Wrote: Um no. I've seen some scripts where the global.hps is used for scripting. nvm statyk says so *edit* I just tried to do some class type thing and it doesn't seem to work in the global sense. Which is what you were going for, I suppose. Now, you could just copy&paste the class to each script file, but that might be arduous/sloppy/beyond the scope of practicality. PHP Code: class TestClass Like I said, beyond the scope of practicality. RE: Using Global.hps to use a script in every level - Statyk - 05-14-2013 No you can not do regular scripting in the global.hps. Like Tomato Cat said, it is only used to store global variables that can be used to do scripts in local .hps. RE: Using Global.hps to use a script in every level - PutraenusAlivius - 05-15-2013 Ok, so it can't do so. Can it do the include command by Apjjm? |