Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can a Constant "Get" Script Run?
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#8
RE: Can a Constant "Get" Script Run?

(11-09-2011, 07:22 PM)palistov Wrote:
(11-09-2011, 02:54 AM)Your Computer Wrote: ...your only chance for a "global" timer may be through global.hps...
I've actually tried writing out void functions in the global.hps script but they're not responsive, at least when I tried called them using local scripts. I haven't dug deep into that though, so I may be wrong. But the best way I can think of creating a "global" timer would be using global vars.

global.hps
PHP Code: (Select All)
void OnGameStart()
{    
// how much time is left on the timer?    
    
SetGlobalVarInt("TIMERTIME"100);    
    
// the duration of the global timer -- this value doesn't change
    
SetGlobalVarInt("GLOBALTIMERdur"100);


map1.hps & map2.hps & map3.hps etc...
PHP Code: (Select All)
// may have to add a looping timer to constantly save the time left, just in case the player saves and exits the game, which does NOT count as OnLeave

void OnEnter()
{
    
AddTimer("GLOBALTIMER"GetGlobalVarInt("TIMERTIME"), "CATASTROPHE");
}
void OnSaveLoad() // not sure if this even works, but it exists according to Apjjm! :D
{
    
AddTimer("GLOBALTIMER"GetGlobalVarInt("TIMERTIME"), "CATASTROPHE");
}
void OnLeave()
{
    
SetGlobalVarInt("TIMERTIME"GetTimerTimeLeft("GLOBALTIMER"));
    
RemoveTimer("GLOBALTIMER");

I'm sorry to have put you through all that, but are you saying a GLOBAL function is set for ALL maps? I only need it in one, and I thought LOCAL functions were only at the player. (like, if the player had a variable, say health or sanity). I just need it in one map.


11-09-2011, 09:52 PM
Find


Messages In This Thread
Can a Constant "Get" Script Run? - by Statyk - 11-09-2011, 12:37 AM
RE: Can a Constant "Get" Script Run? - by Statyk - 11-09-2011, 02:00 AM
RE: Can a Constant "Get" Script Run? - by Statyk - 11-09-2011, 09:52 PM
RE: Can a Constant "Get" Script Run? - by Apjjm - 11-10-2011, 01:57 AM
RE: Can a Constant "Get" Script Run? - by Statyk - 11-10-2011, 08:01 PM



Users browsing this thread: 1 Guest(s)