biell / alti-server

Altitude game server wrapper
The Unlicense
13 stars 3 forks source link

Pick plane color in FFA #15

Closed kevATin closed 4 years ago

kevATin commented 5 years ago

Would it be possible/easy to add the ability to decide which player/bot spawns as which plane color?

This is mostly intended for FFA where players spawn with random colors, so forcing specific colors on them shouldn't break gameplay, right?

You might be wondering why I want to decide the color of planes in FFA, it's to give players the ability to customize. Altitude doesn't exactly offer a lot of character customization, and having a command with which players can decide their color would be great for that.

So ideally there'd be a command and options like: /planeColor green playername The color could be replaced by none, random, false, etc to get back to the default. The playername could be omitted to use it on yourself. Only admins can use it on others. Option to enable/disable usage of /planeColor for non-admin players.

My idea for this is to have paint shops for each color on my MMORPG map/server and let players buy a different color with in-game currency.

I assume plane color and team assignment and treated as one and the same in Altitude, so it wouldn't be possible to let players spawn as different colors while still being part of their team, right?

biell commented 5 years ago

So, you need Xal's server patches to do this, but it is actually very doable as long as his patches are loaded.

You should think about how you would want this to work more. You could allow players to specify their color as a perk. You could also use the colors for levels, and show each player what level another player was by their color (e.g. red is level 1, and brown is level 9).

The way this works now is, in ffa, you assign the players to a team. Each team number has a color associated with it. So, if you had a player stored in object $p, you would run plus::assign($p, 'green') to assign the player stored in the $p object to the green team, and therefore change their plane color to green.

So, the basis for the code is all there. You would just have to figure out if you needed to add your own command to allow players to set this themselves, or if you would prefer to hold onto it for yourself for some other purpose.

kevATin commented 5 years ago

levels

Nice idea, and that would definitely fix the problem with getting player level to be visible to everyone else in-game (without having to use commands), but I'm not sure if it's worth the tradeoff of letting go of customization options. Also players might not like the color that I assigned to their level (i prefer the ace 9 icon over the ace 10 one in alti~), I don't want players to have to fly around in colors they don't like.

So technically ffa has teams in it, it just doesn't care about them and even allows friendly fire~

I see, I think I'll be going with: assign random color at first join; and later on allow players to change it via in-game shops. the powerup will have to check for player permission (requires specific quest or something so it's unlocked), currency (takes x coins, not useable if player has less than x), and also a countdown so it doesnt buy it ten times while the player flies through (i guess that can be handled via powerup properties in the map editor), potentially also check if the player already has the color he wants to buy~

I don't think it's possible to set that a powerup at a specific location executes a command upon pickup, via the plus.txt, is it? Should be doable via script though just fine, right?

biell commented 4 years ago

Correct, you would want a hook for powerupPickup and you could check the coordinates. If you are going to do it a lot, I would recommend having one of the first lines be my($powerup)=join(',', @$e{'positionX','positionY'});, I have that line in the base code's powerupPickup hook. This will allow you to check pickups like: if($powerup eq '123,456') { Or, if you wan't to get fancy and have a lot of custom functions you could do something like:

MAP 'ffa_foomap';

my(%POWERUPS)={
    '123,456' => sub {
            my($p)=@_;
                  ...
         },
    '1000,500' => sub {
            my($p)=@_;
                  ...
        },
};

...

HOOKS {
    'powerupPickup' => sub {
        my($e, $p)=@_;
        my($powerup)=join(',', @$e{'positionX','positionY'});

        if(exists($POWERUPS{$powerup})) {
            $POWERUPS{$powerup}->($p);
       }
    },
}