edited June 2017 in ORK Support
in my latest project i want to get away from turn based combat, and instead implement a more action-oriented gameplay style, where the player runs around swinging his big weapon (oo-er), cutting down anything in his path

well, that was the plan, but, as with most of my plans, it seems to have hit a bit of a wall

i've got the player running around swinging his weapon no problem. it's the cutting down anything in his path bit that i'm struggling with. so:

i've got a new ability called MouseAttack, which is executed from a mouseclick and which fires a Battle Event that plays the attack animation. that bit works fine

all the relevant "Perform In"s that i can find have been set to "Field" and "Real Time"

the NPCs (who are spawned into the scene with a Battle Type of "Real Time", and as "Allies") all have a Damage Zone Component and a Rigidbody

the weapon has a Damage Dealer Component and a Rigidbody. now, if i have the Damage Dealer set as "Always On" then the player can run up to one of the NPCs, and he does damage when the weapon comes in contact with them, as expected

but of course, that's not what i want to happen. i only want him to do damage when he swings the weapon - so it seems logical that what i want is for the Damage Dealer Component to be activated when he swings the weapon and deactivated afterwards

i've tried what seem like all the obvious routes to get that to happen (setting Damage Dealer on the Ability, setting it in the Battle Event as "Auto Damage Dealers" or as a specific Activate Damage Dealer step, using a Damage Dealer Tag, etc etc), but i'm obviously missing something, because all i ever get is the console message "Player uses MouseAttack on .", implying that it's expecting a specific Target which it hasn't been given

the Target Setting on the MouseAttack Ability is currently Target Type All, and Target Range None, plus "Not on Self". if i change the Target Type to "Single", then it prompts the player for a Target, but, like i said, i don't want this to be specifically targetted, i want it to be an attack that simply hits any NPC, whether ally or enemy, physically in range

as always, any advice or suggestions, gratefully received
Post edited by HarryOminous on
  • edited June 2017
    ok. kinda solved. kinda

    first off i was able to get the Throw Fireball tut to work without too much trouble, so instead of perservering with the probably doomed attempt to get the thing working in the way that i'd originally envisaged, i ended up by getting the battle event to simply spawn a temporary damage dealer (similar to the fireball object, but invisible) every time the player mashes the fire button

    that object interacts with any nearby NPCs and has the expected effect, i.e. it drains their health. it's probably good enough for my use-case, which isn't going to require pixel perfect hit detection, but i'd still be interested to know why i couldn't get the original way to work
    Post edited by HarryOminous on
  • If your battle event doesn't have any wait times, the damage dealer would be activated and deactivated at the same time, i.e. no time to do damage.

    E.g. if you're using Mecanim animations, there's no way for ORK to know the duration - you'd either have to define the Duration in the animation's setup in ORK or use a Wait node :)
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • edited June 2017
    thanks gil

    i did have wait times set in the battle event, but i didn't have any duration set for the animation itself (all animations are mecanim)

    so, i specified a duration for the animation, and also set "Auto Activate" on for "Field" on the weapon prefab (can't remember now whether i'd tried it with that on before or not), and...

    ...everything now works as expected. dude swings his big weapon, and much mayhem ensues

    as ever, thanks for your time and patience
    Post edited by HarryOminous on
  • edited June 2017
    one small thing i'll add:

    after i'd got it all working, i closed Unity, went off and had something to eat, came back, tried it to make sure it was still working, and...

    ...it had stopped working again!

    so. i checked the weapon prefab, and found that it had reverted to its previous state. i.e. "AutoActivate" was no longer set to "Field". i've noticed this in other situations with prefabs. not sure when it started happening, and whether or not it's Ork-specific or a Unity wide thing, but the solution seems to be to physically load the prefab into the scene, select "Break Prefab Instance", make the required change, and save it again

    so, once i'd done that it all worked again...

    (until the NEXT time)

    Post edited by HarryOminous on
  • That should be an Unity issue, as ORK has nothing to do with whatever settings you change and save on game objects in your scene or prefabs :)
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.