Blockland Forums > Modification Help

Mounting To Back Crashing Blockland

Pages: << < (2/3) > >>

otto-san:

you don't need to unMount whenever they unmount it

jes00:

So since all of my attempts crash Blockland can someone tell me how to do it?

Brian Smithers:

it's the model

jes00:


--- Quote from: Brian Smithers on April 01, 2012, 02:49:48 PM ---it's the model

--- End quote ---
No it's not, I tried it with the gun model and it still crashed.

--- Code: --- function FLUDDImage::onMount(%this, %obj, %slot)
{
parent::onMount(%this, %obj, %slot);

if(%obj.getMountedImage(1).getName() $= "FLUDDImage")
{
%obj.unMountImage(1);
%obj.mountImage(FLUDDImage, 1);
//Mount it to their back

%obj.hideNode(cape);
%obj.hideNode(pack);
%obj.hideNode(quiver);
%obj.hideNode(tank);
%obj.hideNode(armor);
%obj.hideNode(bucket);
//Hide anything already on their back
}
}

function FLUDDImage::onUnMount(%this, %obj, %slot)
{
parent::onUnMount(%this, %obj, %slot);

if(%obj.getMountedImage(1).getName() !$= "FLUDDImage")
{
%obj.client.applyBodyParts();
%obj.client.applyBodyColors();

%obj.unMountImage(1);
%obj.mountImage(FLUDDImage, 1);
//Mount it to their back

%obj.hideNode(cape);
%obj.hideNode(pack);
%obj.hideNode(quiver);
%obj.hideNode(tank);
%obj.hideNode(armor);
%obj.hideNode(bucket);
//Hide anything already on their back
}
}

function FLUDDItem::onPickup(%this, %obj, %col, %a)
{
for(%i = 0; %i < %col.getDatablock().maxTools; %i++)
{
%item = %col.tool[%i];

if(%item == 0 || (%item $= ""))
{
%freeSlot = 1;

break;
}
}

if(%obj.canPickup && (!isObject(%col.getMountedImage(1)) && %freeSlot))
{
%col.mountImage(FLUDDImage, 1);
}

parent::onPickup(%this, %obj, %col, %a);
}

function serverCmdDropTool(%this, %slot)
{
if(isObject(%this.player.tool[%slot]) && %this.player.tool[%slot].getName() $= "FLUDDItem")
{
parent::serverCmdDropTool(%this, %slot);

if(isObject(%this.player.getMountedImage(1)) && %this.player.getMountedImage(1).getName() $= "FLUDDImage")
{
%this.player.schedule(5, 0, unMountImage, 1);
}

return;
}

parent::serverCmdDropTool(%this, %slot);
}

--- End code ---


Plornt:

You are telling it to mount within onMount. that would cause an infinite loop.

Pages: << < (2/3) > >>

Go to full version