Author Topic: Schedule Isn't Doing Damage  (Read 1026 times)

Seriously this time, last thread for a while.  This is my third thread.

Code: [Select]
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);
}
}

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();

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

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
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.)
« Last Edit: April 25, 2012, 10:52:59 PM by brickybob »

I haven't scripted for years, but I could've sworn that you're suppose to do schedule(time, object, functionname, functionargs).

I haven't scripted for years, but I could've sworn that you're suppose to do schedule(time, object, functionname, functionargs).
there are two ways to do schedules, i believe

there are two ways to do schedules, i believe
Pretty sure your way is wrong
Should be schedule(1000,0,"radiationdamage",%player);

there are two ways to do schedules, i believe

Which one works?

The following three methods of scheduling are valid:
  • schedule( 1000, 0, "echo", "hello" );
  • schedule( 1000, %obj, "delete" );
  • %obj.schedule( 1000, "delete" );

Pretty sure your way is wrong
Should be schedule(1000,0,"radiationdamage",%player);
This fixed it, thanks.