Author Topic: Change Datablock function? [SOLVED]  (Read 893 times)

What is the function used to change a players datablock/playertype datablocks and what are the parameters to it?
« Last Edit: March 02, 2014, 11:07:30 PM by Gordo12699 »

Player::changeDataBlock(datablock)

Well for some reason, this doesn't work when it's called:
Code: [Select]
%client.player.changeDataBlock(RP_Critical_Player);
^Obviously client is already defined in scripts that are not copied/pasted.

RP_Critical_Player datablock:
Code: [Select]
datablock PlayerData(RP_Critical_Player : PlayerStandardArmor)
{
isCritical = 1;
minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;
canCrouch = 0;
canJump = 0;
canSit = 0;
firstPersonOnly = 1;

maxHealth = 0;
rechargeRate = 0.0;

maxTools = 0;
maxWeapons = 0;

uiName = "RP Critical Condition Player";

showEnergyBar = true;

jumpforce = 0;

maxForwardSpeed = 0;
maxBackwardSpeed = 0;
maxSideSpeed = 0;
maxForwardCrouchSpeed = 0; //Crouch is super slow, but you can make these 0 if you don't want the player to move while crouching
maxBackwardCrouchSpeed = 0;
maxSideCrouchSpeed = 0;
maxUnderwaterForwardSpeed = 0;
maxUnderwaterBackwardSpeed = 0;
maxUnderwaterSideSpeed = 0;
};

Are you sure the datablock is executed?

Is there an error in the console?

No errors in console, it works when I change my datablock manually through console, I'll see if it works on a server though. That's where it was not working before.

Also, does anyone know what the function mCeil does?
mCeil:
Quote from: TorqueScript Console Functions
mCeil( val )
Purpose
Use the mCeil function to calculate the next higest integer value from val.

Syntax
val – A floating-point value.

Returns
Returns an integer representing the next highest integer from val.

See Also
mFloor
« Last Edit: March 01, 2014, 04:23:05 PM by Gordo12699 »

Try Player::SetDatablock(%data)

Try Player::SetDatablock(%data)

Okay, I'll get back to you guys on if it works or not.

.changeDatablock requires a client value as the last arg, because it's an event function.
So %client.player.changeDatablock(RP_Critical_Player,%client); should probably work.
If not, %client.player.setDatablock(RP_Critical_Player); will work, but might cause some problems.