Started by ponderitus, February 11, 2019, 09:10:11 AM

Previous topic - Next topic
I've been thinking about combo's again like many other before and i was wondering whether its possible to have one item call another within a timer to kind of...pretend its a combo

eg... 'item A' on use
       create timer, if 'item A' used again within timer then
        use 'item B'

would this be possible?
is this a stupid way to do it?
is there a better way?

Yes, this is very possible.

It's difficult to provide help without knowing more details about what you are trying to accomplish, though.

I was thinking about making a punch then kick just so that punch isnt constantly being spammed, i was trying to make Dbz characters and even though it looks pretty cool them spamming punching, it just got me thinking, this is where i got to with them...

I'd probably create an "attack queue" on the hero.

It's a history of recent attacks, stored as a Lua table.

When you press "attack":
1. The game reviews the current attack queue,
2. determines what the attack action will be based on that queue,
3. then performs the attack action
4. and pushes it on the queue.

You could add a cooldown timer to the hero, like `hero.cooldown = sol.timer.start(hero, 1000, function() hero:reset_attack_queue() end)`

Then whenever you handle an attack, call `hero.cooldown:set_remaining_time(1000)` to reset the cooldown.

You will probably have to tweak this concept to make it really work, but this is the way I'd approach it.
RIP Aaron Swartz

ok cool that sounds like a good way to go about it, waaaaaaaaay to advanced for what i can do at the moment though so ill look into it later when I'm hopefully more adept