JohnnyJohstneft's Forum Posts

  • 2 posts
  • Thanks!

    I ended up doing what Ramones suggested in his post and it's working great.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm making a turn based rpg game with white damage, where characters attack a random enemy every so often.

    I'm trying to write a set of events which makes any character attack its target whenever it is time to do so.

    AttackProgress - How many second has elapsed since this character last attacked.

    AttackTime - How many seconds must elapse between attacks (before the next attack, starting from the last time it attacked)

    AttackDamage - How much damage is dealt to the target with each attack.

    CurrentLocation - The spawn point that the character is occupying in the current combat (this is a number, each character has a unique CurrentLocation).

    CurrentTarget - The spawn point (or CurrentLocation, if you prefer) of the enemy that this character will attack.

    So, logically, whenever a character's AttackProgress > its AttackTime, it should deal it's AttackDamage to an enemy whose CurrentLocation = the attacker's CurrentTarget.

    Here's how I'm currently trying to do this with events:

    My first event says that for each Character whose AttackProgress > Self.AttackTime, add information to an array called "TheStack" (yes, I play Magic the Gathering). Set value at Characters.UID,1 to Characters.CurrentTarget, and Set value at Characters.UID,2 to Characters.WhiteDamage.

    This gives us an array where for each Character that has AttackProgress > Self.AttackTime there are two values stored at X,1 and X,2, where X = the character's UID. Thus, we've stored the incoming damage amount and targets for each outgoing attack.

    However, I can't seem to find a way to compare each character's CurrentLocation to this array for all values of X where Y = 1, then reduce their CurrentHP (another instance variable) by the value at Y = 2 for the same value of X, if there's a match.

    Hopefully that all makes sense. If you have any questions, I'll do my best to clear up any confusion. I'm open to doing this other ways too. I'm trying to support a game with multiple party members and multiple enemies, which seems to be my problem.

  • 2 posts