Blockland Forums > Modification Help

function gameconnection::createPlayer(%cl) Gets Stuck at Loading Objects

Pages: << < (2/2)

jes00:


--- Code: ---package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);

--- End code ---
That should work.

You have to parent functions that already exist that you want to change.

Warning - while you were typing a new reply has been posted. You may wish to review your post.
-_-

Munkey:


--- Quote from: Headcrab Zombie on June 14, 2012, 04:53:30 PM ---Package it and call the parent

--- End quote ---

This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.

--- Code: ---package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);

--- End code ---



jes00:


--- Quote from: Munkey on June 14, 2012, 04:56:04 PM ---This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.

--- Code: ---package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);

--- End code ---

--- End quote ---
I changed the %this to %cl (although I forgot to change one).

brickybob:


--- Quote from: Munkey on June 14, 2012, 04:56:04 PM ---This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.




--- End quote ---
Thanks.

Port:

I recommend that you define gameConnection::getHungry and schedule that on the client object instead of having a detached function with a isObject check.

Pages: << < (2/2)

Go to full version