The Daily Click ::. Forums ::. Klik Coding Help ::. Is this a good idea for a damage system?
 

Post Reply  Post Oekaki 
 

Posted By Message

LilSpriteX



Registered
  08/05/2003
Points
  28
21st March, 2005 at 18:56:36 -

Ok, there are three attributes in my game, and they're organized into a rock paper scissors deal (A beats B, is weak against C). My character has four forms, one neutral and one for each element. So, I'm going to use qualifiers and Alterable Values to decide this. Here's how I'm going to organise it:

When enemy of element A(qualifier) is hit by Bullet(qualifier), subtract [bullet's attack (alterable value) x Bullet's A multiplier (alterable value)] from enemy's life.

Similar deal for the main character, just switch enemy with form and Bullet with enemy bullet.

Does this sound good? Seems like it would save a lot of code that I would need otherwise.

 
n/a

SculptureOfSoul



Registered
  14/03/2005
Points
  52
23rd March, 2005 at 02:47:07 -

That seems like a fairly effective approach, but you still need one event for each type of qualifier.

I'm pretty sure you can handle it all in one event though. What I would do is set the main characters Alterable Value A from 1-4, depending on the element form he is in. 1=neutral, 2=fire...whatever. Whenever the enemy gets hit it will look up this value, and then refer to it's matching Alterable Value.

Each enemy should have 4 alterable values, each one of these is it's multiplier for that element. Then all you have to do is use an expression to determine which Alt. Value you should use as your modifier whenever the enemy is hit.

Enemy is hit by bullet: subtract [Bullet Attack Value * EnemyAltValue(getvalue Player "Alt Value A")]

If player is in form 1, it will look up the enemies alt val 1. Player is in form 2, it'll look up enemies alt val 2, etc.





 
Current Project: Undertaking the design of my mammoth RPG. Utilizing all of the knowledge gained while coding the now defunct "Shadow Reign".

SculptureOfSoul



Registered
  14/03/2005
Points
  52
23rd March, 2005 at 03:09:06 -

Nevermind, I just went to go see if this would work and to my surprise found that it's impossible to select what alterable variable to look up. It's possible to determine which alterable variable to modify, using an expression, but not possible to use an expression to determine which one to look up. Bummer.

There is still a way that it could be done in one event, but it'd be more CPU intensive than having separate events. Just for the hell of it i'll mention the method I see for keeping it to one event.

Player has 4 flags. Flag 1 represents elemental form 1, Flag 2 form 2, etc. Whenever one flag is set on all the rest are set off.

Enemy still has 4 alt values. Each one represents the multiplier vs the corresponding element. The damage equation would go as follows...

Subtract From Enemy Health:
( (Enemy Alt Val A * (player flag 1)) +
(Enemy Alt Val B * (player flag 2)) +
(Enemy Alt Val C * (player flag 3)) +
(Enemy Alt Val D * (player flag 4)) )
* BulletBaseDamage.

All of the flags except one would be zero, so only the "Active flag" and the corresponding Enemy Alt value would get passed on to multiply the base damage of the bullet.

Actually, I don't think it would be much more CPU intensive this way. If you had four events each with a separate qualifier, depending on what qualifier applied and the order of the events it still might have to evaluate the three events with the unused qualifiers. I personally prefer using the fewest # of events as possible, so I would probably do it this way. It's up to your preference, though.

If only you could just use an expression to determine what alt val to lookup. Oh well.





 
Current Project: Undertaking the design of my mammoth RPG. Utilizing all of the knowledge gained while coding the now defunct "Shadow Reign".

LilSpriteX



Registered
  08/05/2003
Points
  28
23rd March, 2005 at 10:57:29 -

I'll try that, thanks for the tip! The game is already has too many events, so anything I can use to reduce them would be great.

Yeah, that does suck about the Alterable Values, maybe they'll put it into MMF 2.0

Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click