How-to have varying agilities for players completely with script
by Joobot · 08/22/2005 (12:19 am) · 3 comments
Here's How:
Open up your starter.fps/server/scripts/player.cs
add "agility = 10;" somewhere in the PlayerData(PlayerBody) datablock.
Add these functions at the bottom of the page:
function Player::incAgility(%this, %value)
{
%this.getDataBlock().agility += %value;
%agility = %this.getDataBlock().agility;
%this.getDataBlock().runForce = 48 * 90 * (%agility / 10);
%this.getDataBlock().maxForwardSpeed = 14 * (%agility / 10);
%this.getDataBlock().maxBackwardSpeed = 13 * (%agility / 10);
%this.getDataBlock().maxSideSpeed = 13 * (%agility / 10);
%this.getDataBlock().maxUnderwaterForwardSpeed = 8.4 * (%agility / 10);
%this.getDataBlock().maxUnderwaterBackwardSpeed = 7.8 * (%agility / 10);
%this.getDataBlock().maxUnderwaterSideSpeed = 7.8 * (%agility / 10);
%this.getDataBlock().jumpForce = 8.3 * 90 * (%agility / 10);
}
and there you go. to change your agility mid-game, simply run this function with your player's ID number.
Open up your starter.fps/server/scripts/player.cs
add "agility = 10;" somewhere in the PlayerData(PlayerBody) datablock.
Add these functions at the bottom of the page:
function Player::incAgility(%this, %value)
{
%this.getDataBlock().agility += %value;
%agility = %this.getDataBlock().agility;
%this.getDataBlock().runForce = 48 * 90 * (%agility / 10);
%this.getDataBlock().maxForwardSpeed = 14 * (%agility / 10);
%this.getDataBlock().maxBackwardSpeed = 13 * (%agility / 10);
%this.getDataBlock().maxSideSpeed = 13 * (%agility / 10);
%this.getDataBlock().maxUnderwaterForwardSpeed = 8.4 * (%agility / 10);
%this.getDataBlock().maxUnderwaterBackwardSpeed = 7.8 * (%agility / 10);
%this.getDataBlock().maxUnderwaterSideSpeed = 7.8 * (%agility / 10);
%this.getDataBlock().jumpForce = 8.3 * 90 * (%agility / 10);
}
and there you go. to change your agility mid-game, simply run this function with your player's ID number.
#2
08/29/2005 (7:21 am)
That's really nasty... You care changing values on the datablock... this should never be done as you are changing the agilty for all instances of that datablock (ie all players).
#3
Solved.
08/29/2005 (9:15 am)
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8463Solved.

Christian Bayha
In the player.cs script?
"...and there you go. to change your agility mid-game, simply run this function with your player's ID number."
Sorry, how exactly?