Ok this might be a stupid question, but:

I have spells work in field and real time battle. Field because I want the player to be able to attack an enemy when he sees it, not only once the enemy initiates battle or he is close enough for the battle to start automatically.

How do I start battle once the enemy is hit? Or at least once the player starts his ability.
  • I don't know much about real time combat, so my advice my be misguided, but have you thought about adding combat start event in your ability event? Check if player is in combat and if not then start combat start event. You possibly may need to use selected data to have ability event target your original enemy after initiating start event.
  • That sounds good, but I can't seem to find a "start combat" event node. What's it called?
  • It's called call event, the node allows you to access other events inside a running event, but I checked and battle start events can't be accessed through call event. So this won't solve your problem, sorry :(
  • In your attacks battle event, first use a Check Status node to check if the target is In Battle. If that's not the case (i.e. Failed), you can start a battle via the Start Battle node - at least in theory, but the node isn't available in battle events, so you'll have to do a small workaround via global events.

    So, in your battle event, after the Check Status node, use a Call Global Event node to start a global event (that you'll set up next) and use the Set Starting Object settings to have the target actor available in the global event.

    For the global event, set up a game event that has a Starting Object actor (i.e. where the target will be available at) and use the Start Battle node to start the battle (with the starting object actor).
    Set up a global event in World > Global Events and use the game event you've set up :)
    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 April 2020
    Ah ok, doing it via a global event makes sense. thanks!!

    So I don't have to create a new thread for two other battle questions I will just ask here GIL:
    @gamingislove

    1.) In my real time combat I want melee attacks (which only work in melee range anyway) to ALWAYS hit the target, but with the trigger method (damage dealer component on melee weapon and damage zone on enemy) it can happen that some attack animations does not hit the enemy exactly and then nothing happens of course. Making the box collider trigger on the sword longer and wider, which then SHOULD trigger it, strangely does not work - it seems the sword model itself needs to hit for it to work, which is strange.

    What solution would you suggest so that melee attacks don't fall short of hitting?

    2.) Range attacks, like let's say a fireball or an arrow should always go towards the target, even if it moves. If the target is closer it works, but from further away it always just flies by. It does damage while flying by, but it does not hit the target. I have the damage dealer and collider on the fireball prefab (just like in the 'throwing a fireball' tutorial) but instead of letting it just move in a direction, like in the tutorial, I use "change position" and use the target as target position. I use "move by speed" and "follow position". I also have "ignore height distance" deactivated, so a height difference does not cause troubles but still it flies right over the target if the player is slightly higher, even though the target is about 10 units away and the ball should have plenty of time to fly to the target. instead it just goes straight ahead.
    What am I doing wrong here?
    Post edited by Corvyn on
  • 1) Make sure the damage dealer and trigger are on the same game object (and are set up correctly). Also, the battle event that activates the damage dealer needs to give it enough time to actually do damage.
    E.g. if you activate it before the animation and deactivate it afterwards, make sure the animation has an actual wait time. If you're using Mecanim, keep in mind that you'll have to do some additional setup to have a wait time in the animation node. Alternatively, you can just add a Wait node before disabling the damage dealer.

    Also, since the attack should always hit, you could just change it to use the Calculate node instead of damage dealers :)

    2) Hm, working fine here - try not using Controller Move and enable Face Direction.
    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 April 2020
    1.) yeah calculate is perfect here :)
    2.) it was a problem with the setup of the prefab (it had a movement script in it).

    @gamingislove
    But about the earlier question about starting battle and calling a global event to start the battle:
    I call the global event in the battle event just like you described. And that itself works BUT I noticed that everything in the battle event AFTER I call the global event is ignored. It's like the global event is being called - it's being executed but from the moment the battle event calls the global one the battle event is over, no matter what I add after calling the global event. Is that intended to work that way?


    And one more combat question:
    what's the best way to stop the targets movement for a certain amount of time? If I stop movement and block move AI and add a 6 second wait (that's how long the target should be unable to move with a freeze spell) then the player can't move either for 6 seconds because the event is still running. If I add "unblock player control" then the player CAN move during that time, but he can't use another spell until the enemy can move again (= until that freeze event is over). which kinda defeats the purpose of the whole spell. The player should be able to stop the enemy and then run away and use spells while the enemy is "frozen".
    Post edited by Corvyn on
  • Hm, that's strange - usually the event continues after the global event finished. It might be that due to starting the battle, all battle actions are stopped/cleared to not interfere with the new battle.
    Try starting the battle at the end of your battle event instead of somewhere in the middle.

    Use a status effect to stop the combatant's movement. The Stop Movement option in the effect's settings will also block the move AI :)
    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!
  • @gamingislove

    I was so focused on getting the real time combat like I want it that I just now encountered two very basic (essential) issues. I hope you can help:

    1.) The enemy follows the player up to a certain point, just like I set it to. But the player does not get out of combat once the enemy walks back. How can I make it so once the enemy stops following the player is out of combat?

    2.) If I encounter a second enemy while figthing another the one I am not attacking is also not attacking me. It's always only one. What did I forget to do?
  • 1) Hm, are you using the Leave Arena Settings in your real time battle settings?

    2) If a battle is already ongoing, you can have other combatants join in via the Auto Join Settings in Battle System > Battle Settings > Base Settings.


    An alternative setup that might solve both of your issues would be having Real Time Battle Areas attached to your (enemy) combatant prefabs, using a collider/trigger to mark the area around them in which to do battle.
    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!
  • Great thank you!

    One more battle question, then I should be ok :)

    While melee works perfectly now for some reason my fireball (I use CALCULATE) always shows damage in my flying damage text over the enemy but on the target HUD (health bar) it only sometimes actually subtracts that amount.

    Again, in my melee combat it shows as flying text and it always also gets subtracted from the health bar, but the fireball 3 out of 4 times only the flying text.

    Since I use calculate I don't understand how this can happen.

    Do you have any idea?
  • Hm, if there are flying texts, it's doing damage to something - it might just be a different combatant?
    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 May 2020
    I found the problem. Was my fault. All ok, it works.
    Post edited by Corvyn on
  • @gamingislove For some reason EXIT GAME works in the main menu (start of the game) but not when I have it in a menu screen. I get the exit question, however nothing happens.
  • Do you have a Main Menu Scene defined in Menus > Main Menu? I think that's required to have a scene to return to when exiting the game.
    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!
Sign In or Register to comment.