Jump to content
Rosso777

Player handicaps possible?

Recommended Posts

Small private dedi server. Three players. One player very new and becoming frustrated with the difficult AI that lend a challenge to the other two but are a bit -too- difficult for the newbie. 
 

is there a way, using Steam ID/UID/playername, to provide a handicap to the new player? Perhaps decreased damage or something like that?

Share this post


Link to post
Share on other sites

There are several things you can do to make it easier/harder for a given player yes.  Changing the incoming damage on a player and changing the damage a player does (both with the hit eventhandler) come to mind. 

Share this post


Link to post
Share on other sites

Thoughts on this? Do I even need to add the standard players to this if their damage is "normal" (set to damage * 1)?

 

nul = [] spawn {
    sleep 1;
    switch (getPlayerUID player) do {
        
        case "3168468746512": {                                        // noob player
            player addEventhandler ["HandleDamage",{
                params ["_unit","_selection","_damage"];
                _damage * 0.5;
            }];
        
        case "5413546843212": {                                        // veteran player 1
            player addEventhandler ["HandleDamage",{
                params ["_unit","_selection","_damage"];
                _damage * 1;
            }];        
        
        case "6544164161261":                                         // veteran player 2
            player addEventhandler ["HandleDamage",{
                params ["_unit","_selection","_damage"];
                _damage * 1;
            }];        
        
        default {};
            };
        };
    };
};

Share this post


Link to post
Share on other sites
56 minutes ago, Rosso777 said:

Do I even need to add the standard players to this if their damage is "normal" (set to damage * 1)?

 

No. In initPlayerLocal.sqf:

if (getPlayerUID player == "3168468746512") then {
	player addEventHandler ["HandleDamage",{
		params ["","","_damage"];
		_damage * 0.5;
	}];
};

If it's just for the one player then you don't really need a switch, and an if...then should run faster anyway if you're just handling one player. If you wanted to specify differences for more than one player though, then I'd suggest a switch.

 

On difficulty, there's things in https://community.bistudio.com/wiki/setUnitTrait that you could use, like the audible and camouflage coefs, and maybe load too.

Edit: setUnitTrait might need to be run in onPlayerRespawn.sqf, not 100% sure so it'd be worth testing using one of the easier traits to test (medic/uavhacker/etc).

  • Like 3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×