edited February 2017 in ORK Support
Hey again,

Trying to do a hold button ability and was wandering if its possible.

What I'd like to do is having an assigned button, when pressed-holding down to cast an ability and when release to stop casting (destroying prefabs and stop doing damage or what ever it does). I saw in controls the hold button etc. What I can't find is how to spawn a prefab when holding the button and destroy it only when releasing the button, as well as the damage done while holding it and sound etc.

best regards.
Post edited by dlevel on
  • edited January 2017
    Hm, you could either do this by using control maps to use an ability (which would be used repeatedly if you use a holding key and keep holding it), or using global events.

    Going the global events route, you could do this in one event using a Key event type (e.g. using your holding key). In the event you'd need to have a loop as long as the input key is still pressed (and add a wait node in the loop). Before the loop, do your setup stuff (e.g. prefab spawns), in the loop you'd do the damage (e.g. using a Use Ability Calculation node), after the loop you'd do the cleanup (destroying prefabs, etc.).
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • After a solid 4 hours i havent had too much progress/

    Trying with the control maps, I want the prefab that i spawn to stay on me (lets say is a fire shield and not a beam, that i have spawned on my left hand)... what i was able to do is to just spawn prefabs again and again, i can't find how to spawn that prefab once, keep it spawned until i let the pressed key.

    As for the global events, I didn't understood how to do this loop, and again how the prefab will stay spawned until i let the key.

    Any more tips?
  • I think i achieved something like that in one of my many prototypes... Maybe i can suggest you one way:
    - with the ability spawn the prefab of the beam/shield mounted to the player (so even if you move it stays in the same position)
    - place an autostart event on the spawned prefab, that repeats every time (0.5 / 1 sec i think could be fine)
    - in the prefab event, check if the key is hold, if is no more pressed self-destroy the event object
    I had a death ray ability set up like that if i well remember (more than 1 year ago...)
    I hope it helps. ^_^
  • Yepp, what Kaemalux said also works great. But just in case you still can't get it to work, I did a quick test doing an ability like you want and it works flawlessly. I'm doing the global event route like what GiL said, but I did it a bit differently.
    First, I created an input key L with the input handling of HOLD.
    Here's my event.

    image

    The spawn prefab node is to spawn the shield, and the mount option is enabled, to mount the shield to the player. The wait for input fork node is to see if the input L is being hold, if it is, then just loop it back to itself. If it failed, then it will lead to the destroy prefab node.

    The event is attached to a global event using the Key Type input L.

    Then in the shield prefab, add a trigger interaction to it. Inside the trigger interaction event, just add the Use Ability Calculation node. The user is the player and the target is the all the objects with tag Enemy, or whatever you want it to be.
  • edited January 2017
    Wow guys thank you both! will try those solutions out and get back to you :) Just a clarification, with the global events root, you are not able to have it as an ability that you need to learn first to use right?
    Post edited by dlevel on
  • Sure, you can still have it as a learned ability :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2017
    how ? :D i mean i play the event from the global events, not an ability
    Post edited by dlevel on
  • edited January 2017
    Yeah, but you can still just learn the ability to have it on the combatant, e.g. to show it in menus. Doesn't matter if the actual use is somewhat simulated through the global event :D

    Edit: You can also do the loop in the battle events of the ability, going the control maps route instead.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • AWESOME! It works exactly as i wanted to work, i used the loop but with control maps.

    Need to get into global events more i guess, If I understand correctly their use, they are a game changer :)
  • so now it works fine, holding right mouse button and having my on/off ability.

    Is there any way to have other abilities too while holding the right mouse button? Like tapping the left mouse so i can attack while having my shield up.
  • Maybe using another global event? I don't think ORK allows two ability simultaneously from the same combatant, but you could try setting up a global event with limitation (battle scene, combat etc..) to cast an attack.
    If you specifically need an attack in real time setting, i managed to do it using only damage dealers: you just spawn the prefab / or even the collider only if you have the weapon always shown / and activate its damage dealer, when it trigger the damage zone on the enemy the damage should be calculated without considering the other ability..
    I hope it helps ^^
  • I dont use global event for the beam ability, but yes my question is if i can have 2 abilities simultaneusly :)
  • I once asked a similar question and Gil said a combatant can only perform one ability at a time.
  • Yeah, ORK only allows one action per combatant at a time. Your best option would be to have holding the shield as a global event and doing the attacks the regular way (control maps).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • ah that is what i was hoping for, so it can handle 1 ability and 1 global event at the same time? that's nice
Sign In or Register to comment.