Oh I see what's wrong with the poison code. Maybe.
Either your missing parentheses around the first if global.poison = true,
OR
I'm assuming that the whole thing is in the step event?
If so, then it's doing this:
Oh, I'm poisoned. Well let's see, I got poisoned now, so the time I got poisoned is now.
Since the time I got poisoned is now, I guess it's not time for me to get hurt yet.
Next frame:
Oh, I'm poisoned. Well let's see, I got poisoned now, so the time I got poisoned is now.
Since the time I got poisoned is (always and forever will be) now, I guess it's not time for me to get hurt yet.
And this happens EVERY frame.
Instead, use:
if (global.poison and global.time%30000=0)
{global.plife -= 1}
That's every 30 seconds, but not every 30 seconds from the point you get poisoned, it's every 30 seconds from 0 seconds.
So instead:
if (global.poison and not global.checkPoison)
{global.poisontime = global.time; global.checkPoison = true;}
if (global.poison and (global.time-global.poisontime)%30000=0)
{global.plife -= 1}
Make sure to set global.checkPoison to false wherever it is your creating it (and that wherever is definitely NOT in any step events).
thanks... got me on the right track ^^
if anyone needs to make a global timer, here's a pretty nice way (step event for oPoison):
y = oPlayer1.y;
x = oPlayer1.x;
if (global.poison and not global.checkPoison)
{global.poisontime = global.time; global.checkPoison = true;}
if (global.poison and (global.time-(global.poisontime+3000)>0))
{global.poisoncounter += 1;
global.checkPoison = false;
}
if global.poisoncounter = 10
{obj = instance_create(oPlayer1.x, oPlayer1.y, oBlackHeart);
global.plife -= 1;
global.poisonend += 1}
if global.poisoncounter >= 10
{global.poisoncounter = 0}
if global.poisonend = 4
{global.poison = false
instance_destroy()}
For some reason the timer will only work at intervals divided by 3.
if you are using an object make sure it follows the spelunker, otherwise it wouldn't work when in the frozen zone