Game Development Community

dev|Pro Game Development Curriculum

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.

#1
08/24/2005 (11:38 am)
"Add these functions at the bottom of the page:"
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?
#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
08/29/2005 (9:15 am)
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8463

Solved.