Page 1 of 1
"weight of the player"
Posted: Fri May 31, 2013 11:49 am
by Lollipop
Hey, I'm looking for a way to make the player slower, if he cary more items and weapons.
lets say that the normal playerspeed is 100.
a shotgun have 15 points of weight.
this will be the outcome of the player having this weapon:
playerspeed 100 - shotgun weight 15 = new playerspeed 85
I would do this myself if I could, but I got no idea how to make the player slower in this manner.
NOTE: the player should get faster again if item is used/dropped.
RE: "weight of the player"
Posted: Fri May 31, 2013 3:24 pm
by Hypnotoad
Lollipop wrote:
Hey, I'm looking for a way to make the player slower, if he cary more items and weapons.
lets say that the normal playerspeed is 100.
a shotgun have 15 points of weight.
this will be the outcome of the player having this weapon:
playerspeed 100 - shotgun weight 15 = new playerspeed 85
I would do this myself if I could, but I got no idea how to make the player slower in this manner.
NOTE: the player should get faster again if item is used/dropped.
Do an inventory check (if (CheckInventory("Shotgun") == 1)), and then adjust the player's APROP_Speed using SetActorProperty accordingly (SetActorProperty(0, APROP_Speed, 0.85);
RE: "weight of the player"
Posted: Fri May 31, 2013 4:22 pm
by Watermelon
To expand upon the above, you can manipulate how much each thing holds with respect to weight:
Code: Select all
script 123 (void)
{
int totalWeight;
while (true)
{
totalWeight = 0;
totalWeight += (CheckInventory("Shell") * 0.001);
totalWeight += (CheckInventory("Clip") * 0.0005);
totalWeight += (CheckInventory("Rocket") * 0.002);
// etc...
if (totalWeight > 1.0)
totalWeight = 1.0;
SetActorProperty(0, APROP_Speed, 1.0 - totalWeight);
delay(1);
}
}
RE: "weight of the player"
Posted: Fri May 31, 2013 5:20 pm
by Lollipop
I will do this tomorrow, then I got some time at hand do work with it, but I wish to thank you now :)
RE: "weight of the player"
Posted: Sat Jun 01, 2013 12:12 pm
by Lollipop
This works out very well for me, I had to do a little of this and a little of that, but overall I am very pleased with this watermelonand hypnotoad, u will be on credits list :)