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.

Skill duration...?

I'm working on an island survival, in which when you are damaged physically there is a chance that you can get crippled. I want the doctor occupation to be able to temporarily (1 minute) disable and then re-enable the crippled state (on the first few levels, you can only do it once a day.)

However, "Wait" disables my movement, and there's only one timer.
What exactly are my options? I have confirmed that the timer works, but there are multiple skills that the doctor can use that are similar to this one.
 

MarkR

Member

You could use the wain command in a Parallel Process triggered event, but that isn't the best solution.
When I want to check if something happened X seconds ago, I would use the following event commands:

Code:
Control Variables: [0001: Timer goal] = Play Time

Control Variables: [0001: Timer goal] += X
Where X is the amount of seconds you want to wait.
You can then check if the player has waited for X seconds or longer with the follwoing commands:
Code:
Control Variables: [0002: Timer] = Play Time

Conditional Branch: Variable[0001: Timer Goal] <= Variable[0002: Timer]

  # Heal the player

Branch End 

Here is a screenshot as an example:
waitcount.png
 
Argh. I'm not exactly sure how to set this up.
It's a common event activated by the use of a skill.

When activated, it's supposed to remove the effects of the cripple state, and then 1 minute later (3600 frames) add the effects back. Temporarily treating cripple.

My problem is "waiting the 1 minute later and then adding cripple".
 

MarkR

Member

Then you would use these lines at the point where you remove the effect.:
Code:
Control Variables: [0001: Timer goal] = Play Time

Control Variables: [0001: Timer goal] += 60

You should then activate a new Common Event which trigger is Parallel Process and do something like this:
addeffect.png


The common event will now check every frame if it has been 60 seconds or more since the effect was removed. If it has been 60 seconds or more, the effect will be added again and the switch which activates this common event will be set to false.

Your other common event could look something like this:
removeeffect.png
 
Interesting method, MarkR. I hadn't thought of using the in-game timer. My approach would have been to add 1 to a variable every frame and check the variable, but this method works nicely too!
 

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