For the last week I've been creating a twine rpg game and one of the features I really want to include are skills each skill having a cooldown for it, its not like you press the skill and then it gets a cooldown not it has to start with a cooldown say 30 secs for e.g I want it to let the users wait 30 secs before they can use it and once they do the process repeats but I don't even have the slightest idea how to do so
Comments
Will the Reader be able to navigate between Passages during this time or will they be stuck within the same Passage until the cool-down period is over?
I will give it a shot but I want to also show the time so players can see how much time is remaining till they can use it again basically I'm basing my game to a game I enjoyed alot (swords and souls) and I don't want to do that, that the link will appear every certain amount of time and if they players don't click it they missed their chance and will have to wait again
A couple of thoughts about your example:
1. You have a space character between the 20 and the time unit (s = seconds) in two of your (live:) macros, which is invalid.
2. Unless something dies you are using a delayed (go-to:) macro to traverse to the fight passage (the current passage?), this means that the 20 second (live:) macros will never fire because they are destroyed during the traversal.
3. 100 x 20 seconds is 33 and a bit minutes, which is a long time to wait for a link to use a Dragon Punch.
4. Reloading a passage over and over in a Twine based game is a very expensive activity in both time and memory, because each time a passage is traversed a copy of all known variables is made and that new copy is made available to the passage about to be shown/processed.
1. Checking the different conditions that stop the execution loop / fight.
eg. death, returning to main passage, fight taking to long (Run Away), etc...
2. Updating the interface (status and options).
3. Combat between player and ghoul.
4. Cool-down of Dragon Punch
The following consists of at least two passages:
1. The Main passage: 2. The Fight passage: ... you will notice that everything happens within this passage and that this passage is never reloaded using a (go-to:) macro.
Edit: yep its working now I just have to edit a bit with it and I'll able t add more abilities and potions thanks alot dude
1. Use variables named and hook names that describe their purpose, don't uses names like punch2 or AM because you may forget what they represent latter.
2. Use indentation and extra line-breaks to format your code (especially when debugging it) as it can help you see syntax errors like leaving out square brackets.
3. If your code is complex (like this will be) add comments to the code to help remember what each part is doing.
Your new potion related code is replacing the potion link for every loop.
Try something like the following, it uses three new variables ($showFireballAt, $showPunchAt, and $showPotionAt) to track at which second in the future options or cool-downs should changed, the value of each of the three variables is recalculated each time the related option is used. I also changed the user interface a little.
note: when replying to/quoting a comment that contains a large block of code in it, it is a good idea to delete that large block of code from your reply if it is not needed.
noted, I will try to make it look more tidy and hopefully when I use this code in addition to the inventory macros it will work just as well, if it does I'm officially done with the features in the game and I can finally focus on the story, and thanks alot for your help seriously thanks alot
Try changing the order/placement of the checks like so note: I am using tab characters to indent the code, not space characters.
I will give it a shot hopefully it will be fixed and the last bug will die and finally the game will be done in a day or so
Edit:its finally over now I can focus on story mode and hopefully everything will go smoothly thanks alot dude