Author Topic: function not working?  (Read 612 times)

Code: [Select]
function CancelRed(%this, %client, %obj)
{
%client.obj.gravymagica = 1;
serverPlay3D(GravyDownSound,%client.obj.getPosition());
%obj.client.applyBodyParts();
%obj.client.applyBodyColors();
}

console:

Code: [Select]
Add-Ons/Item_Gravy/server.cs (181): Unable to find object: '' attempting to call function 'getPosition'
BackTrace: ->CancelRed


Add-Ons/Item_Gravy/server.cs (182): Unable to find object: '' attempting to call function 'applyBodyParts'
BackTrace: ->CancelRed


Add-Ons/Item_Gravy/server.cs (183): Unable to find object: '' attempting to call function 'applyBodyColors'
BackTrace: ->CancelRed

Heres what calls the function
Code: [Select]
function magicGravyImage::disappear( %this, %obj, %slot )
{
%currSlot = %obj.currTool;

%obj.tool[%currSlot] = 0;
%obj.weaponCount--;
messageClient(%obj.client,'MsgItemPickup','',%currSlot,0);

commandToClient(%obj.client, 'centerprint', "\c5Gravy Time!", 2);

serverCmdUnUseTool(%obj.client);

%obj.unMountImage(%slot);

%obj.gravy =  "1 0.5 0";

%obj.playThread( 2, shiftAway );

%obj.addhealth(25);

%obj.emote(GravyParticleImage);

    schedule(10500,0,CancelRed);

%obj.setnodecolor("headskin", %obj.gravy SPC "1");
}

It isn't working! help!

Code: [Select]
function CancelRed(%this, %client, %obj)
Code: [Select]
schedule(10500,0,CancelRed);
Make sure to pass the other parameters in your schedule like so:

Code: [Select]
schedule(10500,0,CancelRed,%this,%obj.client,%obj);
There are still some redundancies in your CancelRed function, but this is your main issue.

There are still some redundancies in your CancelRed function, but this is your main issue.
Like what?

You can reference an object from a client and vice versa.

%client.player
%player.client