Turn based combat system, damn

SnowCrow

New Member
Reaction score
7
I'm creating a turn based combat system, like one in Final Fantasy and all other japanese RPGs.
I'll post my triggers here.
Code:
Starting
    Events
        Unit - A unit comes within 256.00 of Knight 0002 <gen>
    Conditions
        (Region 004 <gen> contains (Triggering unit)) Equal to True
    Actions
        Trigger - Turn off Third Person Camera <gen>
        Unit - Move Knight 0002 <gen> instantly to (Center of ForestCreepLoc <gen>)
        Unit - Move Paladin 0004 <gen> instantly to (Center of ForestHeroLoc <gen>)
        Set CreepUnit = (Random unit from (Units in ForestCreepLoc <gen>))
        Set HeroUnit = (Random unit from (Units in ForestHeroLoc <gen>))
        Unit Group - Pick every unit in (Units in ForestCreepLoc <gen>) and do (Unit - Make (Picked unit) face (Center of ForestHeroLoc <gen>) over 0.00 seconds)
        Unit Group - Pick every unit in (Units in ForestHeroLoc <gen>) and do (Unit - Make (Picked unit) face (Center of ForestCreepLoc <gen>) over 0.00 seconds)
        Unit Group - Pick every unit in (Units in ForestBattle <gen>) and do (Unit - Pause (Picked unit))
        Trigger - Turn on Battle Camera <gen>
        Wait 1.00 seconds
        Set BattleOn = 1.00
Code:
Battle
    Events
        Game - BattleOn becomes Equal to 1.00
    Conditions
    Actions
        If (HeroSpeed Greater than KnightSpeed) then do (Set HeroTurn = 1.00) else do (Do nothing)
        If (KnightSpeed Greater than HeroSpeed) then do (Set CreepTurn = 1.00) else do (Do nothing)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HeroSpeed Equal to KnightSpeed
            Then - Actions
                Set Random = (Random integer number between 1 and 10)
                If (Random Greater than or equal to 6) then do (Set CreepTurn = 1.00) else do (Set HeroTurn = 1.00)
            Else - Actions
                Do nothing
Code:
CreepTurn
    Events
        Game - CreepTurn becomes Equal to 1.00
    Conditions
    Actions
        Wait 3.00 seconds
        Unit - Unpause CreepUnit
        Unit - Order CreepUnit to Attack HeroUnit
        Trigger - Turn off Battle Camera <gen>
        Trigger - Turn on Creep Attack Camera <gen>
Code:
CreepTurnEnd
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacked unit) Equal to HeroUnit
    Actions
        Game - Display to (All players) the text: Lol
        Unit - Order (Attacking unit) to Move To (Center of ForestCreepLoc <gen>)
        Wait 2.00 seconds
        Trigger - Turn off Creep Attack Camera <gen>
        Trigger - Turn on Battle Camera <gen>
        Wait 2.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (ForestHeroLoc <gen> contains HeroUnit) Equal to True
            Then - Actions
                Unit - Pause CreepUnit
                Set CreepTurn = 0.00
                Set HeroTurn = 1.00
            Else - Actions
                Do nothing
Code:
HeroTurn
    Events
        Game - HeroTurn becomes Equal to 1.00
    Conditions
    Actions
        Wait 2.00 seconds
        Dialog - Clear BattleDialog
        Dialog - Change the title of BattleDialog to Combat
        Dialog - Create a dialog button for BattleDialog labelled Attack
        Set BattleDialogButtons[1] = (Last created dialog Button)
        Dialog - Create a dialog button for BattleDialog labelled Flee
        Set BattleDialogButtons[2] = (Last created dialog Button)
        Dialog - Show BattleDialog for Player 1 (Red)
Code:
DialogAttack
    Events
        Dialog - A dialog button is clicked for BattleDialog
    Conditions
        (Clicked dialog button) Equal to BattleDialogButtons[1]
    Actions
        Wait 1.00 seconds
        Unit - Unpause HeroUnit
        Unit - Order HeroUnit to Attack CreepUnit
        Trigger - Turn off Battle Camera <gen>
        Trigger - Turn on Hero Attack Camera <gen>
Code:
HeroTurnEnd
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacked unit) Equal to CreepUnit
    Actions
        Game - Display to (All players) the text: Lol
        Unit - Order (Attacking unit) to Move To (Center of ForestCreepLoc <gen>)
        Wait 2.00 seconds
        Trigger - Turn off Hero Attack Camera <gen>
        Trigger - Turn on Battle Camera <gen>
        Wait 2.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (ForestCreepLoc <gen> contains CreepUnit) Equal to True
            Then - Actions
                Unit - Pause HeroUnit
                Set CreepTurn = 1.00
                Set HeroTurn = 0.00
            Else - Actions
                Trigger - Turn off Battle Camera <gen>
                Game - Display to (All players) the text: You win!
                Trigger - Turn on Third Person Camera <gen>
Its working fine except that when the Knight (starting) approaches the Hero, it just stops in front of him and doesn't attack or even return back. Some help would be nice. :)
And I started doing this trigger this morning, so it might be little sucky at places. But it will improve.
 
D

dadads

Guest
If you're interested in turn-based systems, you should see the "Hero RPG" campaign in WC3 campaigns. It uses a turn-based system too, and could serve as an inspiration source.
 

SnowCrow

New Member
Reaction score
7
Check your frist tigger agian. Near the movement i think thats wrong.

Code:
Unit Group - Pick every unit in (Units in ForestBattle <gen>) and do (Unit - Pause (Picked unit))
Why would that be wrong? I said the problem is that when the Knight (creep) approaches the Paladin (hero), it just stops in front of him and does nothing.

I'm quite sure all the variables are right. If anyone can come up with a solution, that would be lovely. :)

And thanks for the information, dadads, I'll check that map, but that system I saw in the screenshot is totally beyond my skills. :] I may still find something from the map.
 

SnowCrow

New Member
Reaction score
7
Ok, I think the problem is in the event [Unit becomes attacked].
Could there be another way to do it?
 
D

dadads

Guest
Don't use [Event - Unit is attacked].
Use [Event - Unit is damaged] instead.

Or if you want to move the hero using triggers instead of issuing the move command, you can actually time it.
 

SnowCrow

New Member
Reaction score
7
Don't use [Event - Unit is attacked].
Use [Event - Unit is damaged] instead.

Or if you want to move the hero using triggers instead of issuing the move command, you can actually time it.
Yes, thanks dadads, now the Knight actually attacks. I had to change the generic unit event to specific unit, because "takes damage" isn't in generic unit event.

I didn't quite understand what you meant with moving the hero with triggers, could you define it a bit more?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top