Author Topic: scaled playertype  (Read 660 times)

I need this playertype to set its scale when you set your players datablock to it, but I'm having a bit of trouble

datablock PlayerData(PlayerMineDig : PlayerStandardArmor)
{
   minJetEnergy = 0;
   jetEnergyDrain = 0;
   canJet = 0;

   uiName = "MineDig Player";
   showEnergyBar = false;
};


package MineDigScale
{
function GameConnection::spawnPlayer(%this)
{
Parent::spawnPlayer(%this);
if(isObject(%this.player))
{
if(%this.player.dataBlock $= "PlayerMineDigArmor")
{
%this.player.setscale("0.75 0.75 0.70");
}
}
}
};
activatepackage(MineDigScale);

Reserved till I get a fix for it
« Last Edit: July 31, 2011, 06:45:57 AM by soba »

Try %this.player.getDataBlock().getName()


Isn't it

%this.player.getDatablock();

?

Isn't it

%this.player.getDatablock();

?
still get a syntax error

Code: [Select]
%name=%this.player.dataBlock.getName(); //for a normal playertype this would be "PlayerStandardArmor"
if(%name $= "whatever")
{
   // stuff
}

Code: [Select]
package PlayerScale
{
function Player::changeDatablock(%player,%datablock,%client)
{
Parent::changeDatablock(%player,%datablock,%client);
if(%datablock == PlayerMineDig.getID())
%player.setScale("0.75 0.75 0.70");
}
};
activatePackage(PlayerScale);

Isn't it setPlayerScale("X Y Z"); ?
Or does setScale work too?

setPlayerScale accepts one integer.

If you are still looking for that fix, here you go. Just replace everything appropriately and it'll work.
Code: [Select]
package PACKAGENAME
{
function gameConnection::spawnPlayer(%client)
{
Parent::spawnPlayer(%client);
%datablock = %client.player.dataBlock;
if(%datablock $= "DATABLOCKNAME")
%client.player.setScale("X Y Z");
}

function Player::changeDataBlock(%player,%datablock,%client)
{
%lastDatablock = %player.dataBlock;
if(%lastDatablock $= "DATABLOCKNAME")
%player.setScale("1.0 1.0 1.0");

Parent::changeDatablock(%player,%datablock,%client);
if(%datablock == DATABLOCKNAME.getID())
%player.setScale("X Y Z");
}
};
activatePackage(PACKAGENAME);

Isn't it setPlayerScale("X Y Z"); ?
Or does setScale work too?
setScale accepts three numbers ("X Y Z").
setPlayerScale accepts one number, that number is used for all three axises ("XYZ").