Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED] How to trigger an event after a certain # of...

Caine

Member

I am trying to figure out how to trigger an event after the player has used a skill a certain number of times. Is there a somewhat easy way to do this? I'm guessing if you could just add +1 to a variable each time the skill is used that would be the easiest way, but I don't know how to do it.

EDIT: or...I guess I would still need some kind of global script/event that checks the value of the variable constantly? Hmm...yes, I really need some help to figure this out. xD
 
The only way that I know of to do this is, in fact, pretty simple.

Create a variable.

Now create a common event, no trigger, that adds one to that variable.

Now go to the skill in question. Have use of the skill call that common event.

The only thing that's left, of course, is having a (probably) parallel-process event checking that variable, and doing something when the variable is high enough. (This version will not activate during a fight, BTW.)

Clear enough?
 

Caine

Member

Unka Josh":2oapin2m said:
The only way that I know of to do this is, in fact, pretty simple.

Create a variable.

Now create a common event, no trigger, that adds one to that variable.

Now go to the skill in question. Have use of the skill call that common event.

The only thing that's left, of course, is having a (probably) parallel-process event checking that variable, and doing something when the variable is high enough. (This version will not activate during a fight, BTW.)

Clear enough?
Yeah, but this is the problem - it has to be able to work during a fight. The event should be triggered after the fight, but I need the use of the skill during a fight to add to the variable.
 

Zeriab

Sponsor

The way described is one way to do it.
Personally I would prefer letting the skill call a common event just like previously described.
That common event should then add to a variable AND if the variable is greater than say 10 then it should turn on a switch.
This switch is then the conditional switch for another common event on either autorun or parallel process depending on what you want to happen.

This way you won't have a parallel process running all the time checking another variable.

Either way it works just as you want. I.e. skill use being counted during fight (and also outside of fight if you have a skill that can be used from the menu) and the event happening after the fight is finished.

*hugs*
- Zeriab
 

Caine

Member

Zeriab":2g0xh2ii said:
The way described is one way to do it.
Personally I would prefer letting the skill call a common event just like previously described.
That common event should then add to a variable AND if the variable is greater than say 10 then it should turn on a switch.
This switch is then the conditional switch for another common event on either autorun or parallel process depending on what you want to happen.

This way you won't have a parallel process running all the time checking another variable.

Either way it works just as you want. I.e. skill use being counted during fight (and also outside of fight if you have a skill that can be used from the menu) and the event happening after the fight is finished.

*hugs*
- Zeriab
Oh, great, I haven't actually looked into actually making skills, so I didn't know they could call an event. That's great, and it will do exactly what I need. Perfect! Thank you both very much.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top