• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to logically design(in code) passive skills

streng

Member
Hi,

I would like to ask about for advice. I have now in excel designed 60 passive skills, meaning that I have a skill name and skill effect. Almost all these skills, I know how to implement and how to make it working.

But some of these effects are very different, meaning that, it will be implemented in different object and in different part of a game.

Let’s example:

Destructor – passively increases melee weapon damage by 3%

Negotiation – Passively decreases a shop price by 10 %

Destabilization – Paralyze enemies for 5sec

And so, on


The question is, which is the way, how should be implemented, in case of readability, and editability.

Currently I think only about plenty of scripts, which I call at the certain objects. Is there any better way?

I want to achieve logic of the all skills at the one place

Thanks
 

NightFrost

Member
Well, those are passive skills that only affect specific events in your game, so you'd have to check for them in those specific events. You'd set a separate section in their handlers for checking and adjusting for the effects of passive skills. For example, the destructor skill. Whenever you display or inflict damage, the code checks if you have Destructor. This also means you need to typecast your damage, and whenever you pass around damage values you also need to pass damage type along. Assuming you've decided to handle these through enumerators, the check would be like
Code:
// Check for effects of passive skills.

// Destructor passive.
if(scr_has_skill(Attacking_Character, Passive_Skills.Destructor) && Damage_Type = Damage_Types.Melee){
    // Increase damage by reading Destructor's effect data and multiply based damage with it.
}
Same goes for Negotiator. Whenever you call a script to fetch a price, for display or payment or whatever purpose, you check inside for the Negotiator skill and adjust price. Paralysis effect would be checked and applied after damage has been handed out and target is still alive. Handling debuffs would be a topic by itself.
 
Top