Blockland Forums > Modification Help
Schedule Isn't Doing Damage
(1/2) > >>
brickybob:
Seriously this time, last thread for a while.  This is my third thread.


--- Code: ---function radiationtimer(%player)
{
%newobjectid = findclientbyname(%cl.name);
schedule(1000, 0, "radiationdamage(%player)", %newobjectid);
}

function radiationdamage(%player)
{
%newobjectid.player.addHealth(-25);
}

function STATFUNCTION(%cl)
{
%radiation = 33;
stat1.setValue(%radiation);
if(%radiation > 25) {
radiationtimer(%player);
}
}
--- End code ---

I'm a n00b at schedules (and scripting in general, thank Allah for this category in the forums) so I probably messed up.

The script loads fine but it just doesn't to damage to people when they type statfunction();
Treynolds416:
That's because your arguments are forgeted up lol
In the first function you define %player but not %cl. Also you never use %newobjectid even though you defined it.
In the second you try to use it but it's undefined because it isn't a global variable.
In the third you define %cl but try to use %player
brickybob:

--- Quote from: Treynolds416 on April 25, 2012, 10:38:00 PM ---That's because your arguments are forgeted up lol
In the first function you define %player but not %cl. Also you never use %newobjectid even though you defined it.
In the second you try to use it but it's undefined because it isn't a global variable.
In the third you define %cl but try to use %player

--- End quote ---
well i just slammed my face into my desk

thank you

Edit; Can you fix it and repost it?  I just want to be sure I'm doing it right (it's still not working, so I'm probably doing something wrong.)
xXBeibsFan119Xx:
I haven't scripted for years, but I could've sworn that you're suppose to do schedule(time, object, functionname, functionargs).
brickybob:

--- Quote from: xXBeibsFan119Xx on April 25, 2012, 11:10:03 PM ---I haven't scripted for years, but I could've sworn that you're suppose to do schedule(time, object, functionname, functionargs).

--- End quote ---
there are two ways to do schedules, i believe
Navigation
Message Index
Next page

Go to full version