"weight of the player"

Discuss all aspects related to modding Zandronum here.
Post Reply
Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

"weight of the player"

#1

Post by Lollipop » Fri May 31, 2013 11:49 am

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.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

User avatar
Hypnotoad
Retired Staff / Community Team Member
Posts: 528
Joined: Tue May 29, 2012 8:50 pm
Location: Britland

RE: "weight of the player"

#2

Post by Hypnotoad » Fri May 31, 2013 3:24 pm

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);
Last edited by Hypnotoad on Fri May 31, 2013 3:25 pm, edited 1 time in total.

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: "weight of the player"

#3

Post by Watermelon » Fri May 31, 2013 4:22 pm

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);
    }
}

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: "weight of the player"

#4

Post by Lollipop » Fri May 31, 2013 5:20 pm

I will do this tomorrow, then I got some time at hand do work with it, but I wish to thank you now :)
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: "weight of the player"

#5

Post by Lollipop » Sat Jun 01, 2013 12:12 pm

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 :)
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Post Reply