• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Turn Based Battle System

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I posted this question on the "request" forums, but I suppose it's better suited here so:

I am currently working on a Turn Based Battle System based on Breath of Fire 2 (Old Nintendo and GameBoy Advanced Game).

Reference: http://www.youtube.com/watch?v=IuxEjweCfnI (Only need to watch 20 seconds of fight to understand mechanics)

The Battle system is having trouble. Sometimes the Fight freezes and the unit who attacks last seems to attack a "null" unit. I don't understand why.

I think the problematic triggers are "Battle Orders" and "Battle Fight"

  • Battle Enemy Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set EnemyGroups = (Last created hashtable)
      • Set MonsterFormation = 0
      • -------- -------------------------- --------
      • Set MonsterFormation = (MonsterFormation + 1)
      • Set MonsterCounter = 1
      • Set MonsterUnitType = Gonghead
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • Set MonsterCounter = (MonsterCounter + 1)
      • Set MonsterUnitType = Gonghead
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • -------- -------------------------- --------
      • Set MonsterFormation = (MonsterFormation + 1)
      • Set MonsterCounter = 1
      • Set MonsterUnitType = Gonghead
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • Set MonsterCounter = (MonsterCounter + 1)
      • Set MonsterUnitType = A. Sludge
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • Set MonsterCounter = (MonsterCounter + 1)
      • Set MonsterUnitType = A. Sludge
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • -------- -------------------------- --------
      • Set MonsterFormation = (MonsterFormation + 1)
      • Set MonsterCounter = 1
      • Set MonsterUnitType = Gonghead
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • -------- -------------------------- --------
      • Set MonsterFormation = (MonsterFormation + 1)
      • Set MonsterCounter = 1
      • Set MonsterUnitType = A. Sludge
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • Set MonsterCounter = (MonsterCounter + 1)
      • Set MonsterUnitType = A. Sludge
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • -------- -------------------------- --------
      • Set MonsterFormation = (MonsterFormation + 1)
      • Set MonsterCounter = 1
      • Set MonsterUnitType = A. Sludge
      • Custom script: set udg_MonsterInteger = udg_MonsterUnitType
      • Hashtable - Save MonsterInteger as MonsterCounter of MonsterFormation in EnemyGroups
      • -------- -------------------------- --------
      • -------- -------------------------- --------
      • -------- -------------------------- --------
      • Set MonsterNumberFormations = MonsterFormation

  • Battle Preload Region
    • Events
      • Unit - A unit enters World 1 Area <gen>
      • Unit - A unit enters World 2 Area <gen>
    • Conditions
      • (Triggering unit) Equal to Party_Order[1]
    • Actions
      • -------- ------------------ --------
      • -------- Camera Unit --------
      • -------- ------------------ --------
      • Unit - Remove Fight_Camera_Unit from the game
      • Unit - Create 1 Battle Camera Lock for Player 9 (Gray) at (Target of BattleScene1 <gen>) facing Default building facing degrees
      • Set Fight_Camera_Unit = (Last created unit)
      • Unit - Pause Fight_Camera_Unit
      • -------- ------------------ --------
      • -------- Unit Positions --------
      • -------- ------------------ --------
      • Custom script: call RemoveLocation (udg_Fight_Alliance_Points[1])
      • Custom script: call RemoveLocation (udg_Fight_Alliance_Points[2])
      • Custom script: call RemoveLocation (udg_Fight_Alliance_Points[3])
      • Custom script: call RemoveLocation (udg_Fight_Alliance_Points[4])
      • Custom script: call RemoveLocation (udg_Fight_Enemy_Points[1])
      • Custom script: call RemoveLocation (udg_Fight_Enemy_Points[2])
      • Custom script: call RemoveLocation (udg_Fight_Enemy_Points[3])
      • Custom script: call RemoveLocation (udg_Fight_Enemy_Points[4])
      • Custom script: call RemoveLocation (udg_Fight_Enemy_Points[5])
      • -------- World Area 1 and 2 both use the same Battlefield. --------
      • -------- A battlefield is simply for display, not for allocating enemies. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (World 1 Area <gen> contains (Triggering unit)) Equal to True
              • (World 2 Area <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Set Fight_Alliance_Points[1] = ((Center of Battle 1 Alliance <gen>) offset by (-100.00, 100.00))
          • Set Fight_Alliance_Points[2] = ((Center of Battle 1 Alliance <gen>) offset by (-100.00, -100.00))
          • Set Fight_Alliance_Points[3] = ((Center of Battle 1 Alliance <gen>) offset by (100.00, 100.00))
          • Set Fight_Alliance_Points[4] = ((Center of Battle 1 Alliance <gen>) offset by (100.00, -100.00))
          • Set Fight_Enemy_Points[1] = ((Center of Battle 1 Enemies <gen>) offset by (0.00, -150.00))
          • Set Fight_Enemy_Points[2] = ((Center of Battle 1 Enemies <gen>) offset by (150.00, 0.00))
          • Set Fight_Enemy_Points[3] = (Center of Battle 1 Enemies <gen>)
          • Set Fight_Enemy_Points[4] = ((Center of Battle 1 Enemies <gen>) offset by (0.00, 150.00))
          • Set Fight_Enemy_Points[5] = ((Center of Battle 1 Enemies <gen>) offset by (150.00, 0.00))
          • Skip remaining actions
        • Else - Actions
  • Count Distance
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set WalkPoint1 = WalkPoint2
      • Set WalkPoint2 = (Position of Party_Order[1])
      • Set WalkAmount = (WalkAmount + (Distance between WalkPoint1 and WalkPoint2))
      • Custom script: call RemoveLocation (udg_WalkPoint1)
      • Custom script: set udg_WalkPoint1=null

  • Battle Encounter
    • Events
      • Game - WalkAmount becomes Greater than or equal to 900.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WalkAmount Greater than or equal to WalkAmountRandomReal
        • Then - Actions
          • Game - Display to (All players) for 3.00 seconds the text: (String(WalkAmount))
          • Set WalkAmount = 0.00
          • Set WalkAmountRandomReal = (Random real number between 900.00 and 2000.00)
          • Set Fight_Return_Point = (Position of Party_Order[1])
          • Unit Group - Pick every unit in Party_Group and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Stop
              • Unit - Set (Picked unit) movement speed to 0.00
          • Cinematic - Fade out and back in over 2.10 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
          • Sound - Play Enemy_Encountered <gen>
          • Trigger - Run Battle Setup <gen> (checking conditions)
          • Trigger - Turn off Count Distance <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Battle Create Enemy
    • Events
    • Conditions
    • Actions
      • Camera - Apply BattleScene1 <gen> for Player 1 (Red) over 0.00 seconds
      • Camera - Lock camera target for Player 1 (Red) to Fight_Camera_Unit, offset by (0.00, 0.00) using Default rotation
      • Set MonsterFormation = (Random integer number between 1 and MonsterNumberFormations)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set MonsterInteger = (Load (Integer A) of MonsterFormation from EnemyGroups)
          • Custom script: set udg_MonsterUnitType = udg_MonsterInteger
          • Unit - Create 1 MonsterUnitType for Player 12 (Brown) at Fight_Enemy_Points[(Integer A)] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to (Random integer number between 40 and 80)
          • Unit - Set (Last created unit) movement speed to 0.00
          • Unit Group - Add (Last created unit) to Fight_Enemy_Group
      • Unit Group - Add all units of Party_Group to Fight_Ally_Group
      • Unit Group - Add all units of Fight_Ally_Group to Figh_All_Units_Group
      • Unit Group - Add all units of Fight_Enemy_Group to Figh_All_Units_Group
      • Game - Display to (All players) for 10.00 seconds the text: (AllyGroup: + (String((Number of units in Fight_Ally_Group))))
      • Game - Display to (All players) for 10.00 seconds the text: (EnemyGroup: + (String((Number of units in Fight_Enemy_Group))))
      • Game - Display to (All players) for 10.00 seconds the text: (AllUnits: + (String((Number of units in Figh_All_Units_Group))))
      • Trigger - Run Battle Register Speed <gen> (checking conditions)
  • Battle Register Speed
    • Events
    • Conditions
    • Actions
      • Set h2LCounter = 1
      • Unit Group - Pick every unit in Fight_Ally_Group and do (Actions)
        • Loop - Actions
          • Set h2LSorterUnitArray[h2LCounter] = (Picked unit)
          • Set h2LCounter = (h2LCounter + 1)
      • Unit Group - Pick every unit in Fight_Enemy_Group and do (Actions)
        • Loop - Actions
          • Set h2LSorterUnitArray[h2LCounter] = (Picked unit)
          • Set h2LCounter = (h2LCounter + 1)
      • -------- The minimum value is the lowest key value that you use in the array. Example: I used tempInt from 1 to 10. The minimum value is 1. --------
      • Set h2LMinValue = 1
      • -------- The maximum value is the highest key value that you use in the array. Example: I used tempInt from 1 to 10. The maximum value is 1. --------
      • Set h2LMaxValue = (Number of units in Figh_All_Units_Group)
      • -------- Then you call the sorter function --------
      • Custom script: call H2LCustomValueSorter()
      • For each (Integer A) from 1 to h2LMaxValue, do (Actions)
        • Loop - Actions
          • -------- You can display which unit is in first second and so on using this. --------
          • Game - Display to (All players) the text: ((Name of h2LSorterUnitArray[(Integer A)]) + (String(h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[(Integer A)])])))
  • Battle Setup
    • Events
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Unit - Change ownership of Party_Order[1] to Player 9 (Gray) and Change color
      • Selection - Clear selection for Player 1 (Red)
      • Trigger - Run Battle Create Enemy <gen> (ignoring conditions)
      • Unit - Move Party_Order[1] instantly to Fight_Alliance_Points[1], facing Fight_Enemy_Points[3]
      • Unit - Move Party_Order[2] instantly to Fight_Alliance_Points[2], facing Fight_Enemy_Points[3]
      • Unit - Move Party_Order[3] instantly to Fight_Alliance_Points[3], facing Fight_Enemy_Points[3]
      • Unit - Move Party_Order[4] instantly to Fight_Alliance_Points[4], facing Fight_Enemy_Points[3]
      • Sound - Stop CurrentlyPlayingMusic[1] Immediately
      • Sound - Stop CurrentlyPlayingMusic[2] Immediately
      • Sound - Set volume of CurrentlyPlayingMusic[2] to 100.00%
      • Sound - Play CurrentlyPlayingMusic[2]
      • Wait 1.00 seconds
      • Set FightCounter = 0
      • Trigger - Turn on Battle Orders <gen>
      • Trigger - Run Battle Orders <gen> (ignoring conditions)
  • Battle Orders
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Unit - Change ownership of (Triggering unit) to Player 9 (Gray) and Change color
      • Set FightCounter = (FightCounter + 1)
      • Game - Display to (All players) for 5.00 seconds the text: (FightCounter: + (String(FightCounter)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FightCounter Greater than or equal to ((Number of units in Figh_All_Units_Group) + 0)
        • Then - Actions
          • Set FightCounter = 1
          • Game - Display to (All players) for 5.00 seconds the text: -------------------...
          • Wait 1.00 seconds
          • Trigger - Run Battle Fight <gen> (checking conditions)
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions
      • Set Fight_Unit_Pending = h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]
      • Set Fight_Next_Unit = h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[(FightCounter + 1)])]]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Fight_Unit_Pending is in Fight_Enemy_Group) Equal to True
        • Then - Actions
          • Set Fight_Targeted_Enemy[FightCounter] = (Random unit from Fight_Ally_Group)
          • Set Fight_Basic_Attack[FightCounter] = True
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (SavedFightTargetUnit: + (Name of Fight_Targeted_Enemy[FightCounter]))
          • Game - Display to (All players) for 5.00 seconds the text: (NextUnit: + (Name of Fight_Next_Unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Fight_Next_Unit is in Fight_Ally_Group) Equal to True
            • Then - Actions
              • Unit - Change ownership of Fight_Next_Unit to Player 1 (Red) and Change color
              • Selection - Select Fight_Next_Unit for Player 1 (Red)
              • Skip remaining actions
            • Else - Actions
              • Trigger - Run (This trigger) (ignoring conditions)
              • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Fight_Ally_Group) Equal to True
        • Then - Actions
          • Set Fight_Targeted_Enemy[FightCounter] = (Target unit of issued order)
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (SavedFightTargetUnit: + (Name of Fight_Targeted_Enemy[FightCounter]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(attack))
            • Then - Actions
              • Set Fight_Basic_Attack[FightCounter] = True
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FightCounter Greater than or equal to ((Number of units in Figh_All_Units_Group) + 0)
            • Then - Actions
              • Set FightCounter = 1
              • Game - Display to (All players) for 5.00 seconds the text: -------------------...
              • Wait 1.00 seconds
              • Trigger - Run Battle Fight <gen> (checking conditions)
              • Trigger - Turn off (This trigger)
              • Skip remaining actions
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Fight_Next_Unit is in Fight_Ally_Group) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (NextUnit: + (Name of Fight_Next_Unit))
          • Unit - Change ownership of Fight_Next_Unit to Player 1 (Red) and Change color
          • Selection - Select Fight_Next_Unit for Player 1 (Red)
        • Else - Actions

  • Battle Fight
    • Events
    • Conditions
      • (Number of units in Fight_Enemy_Group) Greater than 0
      • (Number of units in Fight_Ally_Group) Greater than 0
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: (FightCounter: + (String(FightCounter)))
      • Game - Display to (All players) for 5.00 seconds the text: (h2LUnit: + (Name of h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]))
      • Game - Display to (All players) for 5.00 seconds the text: (FightTargetedEnemy: + (Name of Fight_Targeted_Enemy[FightCounter]))
      • -------- Checks unit next in line to attack (Speed Base System) --------
      • Animation - Play h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]'s attack animation
      • Animation - Queue h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]'s stand animation
      • Sound - Play SwingAttack <gen>
      • Wait 0.55 seconds
      • Unit - Cause h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]] to damage Fight_Targeted_Enemy[FightCounter], dealing 10.00 damage of attack type Normal and damage type Normal
      • Set FightCounter = (FightCounter + 1)
      • Wait 2.00 seconds
      • -------- Next Line will check if all units in battle (including enemy Demons) have had thier turn --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Fight_Enemy_Group) Equal to 0
        • Then - Actions
          • Trigger - Run Battle Victory <gen> (checking conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in Fight_Ally_Group) Equal to 0
            • Then - Actions
              • Trigger - Run Battle Defeat <gen> (checking conditions)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FightCounter Greater than or equal to ((Number of units in Figh_All_Units_Group) + 1)
                • Then - Actions
                  • -------- All Units have had their turn. Another round will begin. --------
                  • Set FightCounter = 0
                  • Trigger - Turn on Battle Orders <gen>
                  • Trigger - Run Battle Orders <gen> (ignoring conditions)
                • Else - Actions
                  • -------- All units haven't had their turn yet. Another unit remains to have their turn. --------
                  • Trigger - Run Battle Fight <gen> (checking conditions)
  • Battle Unit Dies
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventAmount Greater than or equal to (Life of DamageEventTarget)
    • Actions
      • Set Point = (Position of DamageEventTarget)
      • Floating Text - Create floating text that reads (String(DamageEventAmount)) at Point with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Custom script: call RemoveLocation(udg_Point)
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 4.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 100.00 towards 90.00 degrees
      • Unit Group - Remove DamageEventTarget from Figh_All_Units_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is in Fight_Ally_Group) Equal to True
        • Then - Actions
          • Unit Group - Remove DamageEventTarget from Fight_Ally_Group
          • Trigger - Run Battle Register Speed <gen> (checking conditions)
          • Sound - Play Flinch1 <gen>
          • Animation - Play DamageEventTarget's death animation
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DamageEventTarget is in Fight_Enemy_Group) Equal to True
            • Then - Actions
              • Unit Group - Remove DamageEventTarget from Fight_Enemy_Group
              • Trigger - Run Battle Register Speed <gen> (checking conditions)
              • Sound - Play Flinch1 <gen>
              • Sound - Play Unit_Die <gen>
              • Animation - Change DamageEventTarget's animation speed to 0.00% of its original speed
              • Animation - Change DamageEventTarget's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
              • Wait 0.75 seconds
              • Unit - Remove DamageEventTarget from the game
            • Else - Actions

  • Battle Unit Damaged
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventAmount Less than (Life of DamageEventTarget)
    • Actions
      • Set Point = (Position of DamageEventTarget)
      • Floating Text - Create floating text that reads (String(DamageEventAmount)) at Point with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Custom script: call RemoveLocation(udg_Point)
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 4.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 100.00 towards 90.00 degrees
      • Sound - Play Flinch1 <gen>
      • Animation - Play DamageEventTarget's death animation
      • Wait 0.18 seconds
      • Animation - Play DamageEventTarget's stand animation
  • Battle Victory
    • Events
    • Conditions
    • Actions
      • Set FightCounter = 1
      • Game - Display to (All players) for 30.00 seconds the text: Victory! (Type "...
      • Set CurrentlyPlayingMusic[3] = 26_Treasure <gen>
      • Sound - Stop CurrentlyPlayingMusic[1] Immediately
      • Sound - Stop CurrentlyPlayingMusic[2] Immediately
      • Sound - Set volume of CurrentlyPlayingMusic[3] to 100.00%
      • Sound - Play CurrentlyPlayingMusic[3]
      • Trigger - Turn on Battle Resolve <gen>
  • Battle Defeat
    • Events
    • Conditions
    • Actions
      • Set FightCounter = 1
      • Game - Display to (All players) for 30.00 seconds the text: The Party has Falle...
      • Set CurrentlyPlayingMusic[3] = 28_Give_me_a_Chance <gen>
      • Sound - Stop CurrentlyPlayingMusic[1] Immediately
      • Sound - Stop CurrentlyPlayingMusic[2] Immediately
      • Sound - Set volume of CurrentlyPlayingMusic[3] to 100.00%
      • Sound - Play CurrentlyPlayingMusic[3]
      • Trigger - Turn on Battle Resolve <gen>
  • Battle Resolve
    • Events
      • Player - Player 1 (Red) types a chat message containing -end as An exact match
    • Conditions
    • Actions
      • Sound - Play Select <gen>
      • Unit Group - Remove all units from Fight_Ally_Group
      • Unit Group - Remove all units from Fight_Enemy_Group
      • Unit Group - Remove all units from Figh_All_Units_Group
      • Cinematic - Fade out over 0.75 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.75 seconds
      • Unit Group - Pick every unit in Party_Group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to Fight_Return_Point
          • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
      • Set WalkPoint2 = (Position of Party_Order[1])
      • Set WalkPoint1 = WalkPoint2
      • Camera - Reset camera for Player 1 (Red) to standard game-view over 0.00 seconds
      • Camera - Pan camera for Player 1 (Red) to Fight_Return_Point over 0.00 seconds
      • Unit - Change ownership of Party_Order[1] to Player 1 (Red) and Change color
      • Custom script: call RemoveLocation (udg_Fight_Return_Point)
      • Trigger - Run Sound Fade out <gen> (checking conditions)
      • Trigger - Run Follow The Leader <gen> (checking conditions)
      • Cinematic - Fade in over 0.75 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.75 seconds
      • Trigger - Turn on Count Distance <gen>
      • Trigger - Turn on Battle Encounter <gen>
      • Sound - Stop CurrentlyPlayingMusic[1] Immediately
      • Sound - Stop CurrentlyPlayingMusic[2] Immediately
      • Sound - Stop CurrentlyPlayingMusic[3] Immediately
      • Sound - Set volume of CurrentlyPlayingMusic[1] to 100.00%
      • Sound - Play CurrentlyPlayingMusic[1]
      • Trigger - Turn off (This trigger)
Systems Used:

Bribe's Damage Engine: http://www.hiveworkshop.com/forums/...=bribes%20damage%20engine&d=list&r=20&u=bribe
High to Low Sorter: http://www.hiveworkshop.com/forums/...-2-5-a-240626/?prev=search=sorter&d=list&r=20

The coding at this stage is leaky and inefficient. I'm just trying to get the system operational at this stage.

To Test Battle System In Game:

1.) Type -world to begin wandering.
2.) Walk to encounter an enemy
3.) Type -heal party to heal your units to prevent them dying.


Open the "Breath of Fire 2" map within the campaign editor. You can only properly test campaigns from inside Warcraft 3 (you cannot use the test map button. Copy the campaign into your Warcraft 3 folder and open it from inside Warcraft 3).

Its a big system so I don't know if any1 can be bothered helping me, but if you do I'd really appreciate it. Thanks.
 

Attachments

  • Breath of Fire 2.w3n
    15.5 MB · Views: 109
Level 10
Joined
May 8, 2009
Messages
253
I tried the campaign and started a combat but I cannot do a thing. Is this what you mean by "the Fight freezes"? If I understand well the system is not working at all for the moment? If it's the case, you might be interested by a requested system I made a while ago.
http://www.hiveworkshop.com/forums/requests-341/combat-system-225346/index2.html
If it's not the case I'll check your system again.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
I tried the campaign and started a combat but I cannot do a thing. Is this what you mean by "the Fight freezes"? If I understand well the system is not working at all for the moment?

The system only freezes sometimes. It seems to be freezing when there is 1 enemy unit. It works rather well (expect for the last unit attacking a null unit) when there are 2 monsters. When there are 3 monsters it appears to semi work.

Try using -end battle if you are receiving a nonworking battle and test the battle system a couple of times.

If it's the case, you might be interested by a requested system I made a while ago.

This is an impressive system but its unfortunately very different from the system I'm trying to achieve. You can watch the video I posted to see the desired end result.

The party first needs que their orders. Their orders are not executed until all party members have made their order. At this stage my system only stores a basic attack (just watch the video if your curious what my desired end result will be like).

Then the orders are executed, one at a time. The unit (whether enemy or ally) with the highest speed stat will go first, and so on. I'm not sure if the problem is simple or if I need to start from scratch.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
These all leak a location.
  • Set Fight_Alliance_Points[1] = ((Center of Battle 1 Alliance <gen>) offset by (-100.00, 100.00))
  • Set Fight_Alliance_Points[2] = ((Center of Battle 1 Alliance <gen>) offset by (-100.00, -100.00))
  • Set Fight_Alliance_Points[3] = ((Center of Battle 1 Alliance <gen>) offset by (100.00, 100.00))
  • Set Fight_Alliance_Points[4] = ((Center of Battle 1 Alliance <gen>) offset by (100.00, -100.00))
  • Set Fight_Enemy_Points[1] = ((Center of Battle 1 Enemies <gen>) offset by (0.00, -150.00))
  • Set Fight_Enemy_Points[2] = ((Center of Battle 1 Enemies <gen>) offset by (150.00, 0.00))
  • Set Fight_Enemy_Points[3] = (Center of Battle 1 Enemies <gen>)
  • Set Fight_Enemy_Points[4] = ((Center of Battle 1 Enemies <gen>) offset by (0.00, 150.00))
  • Set Fight_Enemy_Points[5] = ((Center of Battle 1 Enemies <gen>) offset by (150.00, 0.00))
Never use integer A / B. Use your own custom integer it is more efficient and faster.

The error could be when you use the waits.

Can you explain more on what is happening. I can't test the map.
Also make sure your unit groups have more than 0 units in it.
It may be freezing because those conditions are never met.
 
Level 10
Joined
May 8, 2009
Messages
253
The system only freezes sometimes. It seems to be freezing when there is 1 enemy unit. It works rather well (expect for the last unit attacking a null unit) when there are 2 monsters. When there are 3 monsters it appears to semi work.
I think I understand why the last unit is attacking a null unit:
It seems to happen when its a player's unit. In your "Battle Order" trigger, when it fires for the last time (FightCounter is greater or equal to the number of units in Fight_All_Units_Group), the triggering unit will stop as intended but since the condition below is checked:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • FightCounter Greater than or equal to ((Number of units in Figh_All_Units_Group) + 0)
It will skip all remaining actions without setting :
  • Set Fight_Targeted_Enemy[FightCounter] = (Target unit of issued order)
since it's only way after you set this variable.

Now I really don't have a clue why the system freezes with only one enemy..
In my opinion there's only the "Battle Orders", "Battle Fight" and "Battle Units Dies" that may be laggy, the others work well.

I've also come to an issue where the rifleman actually attacks the target rather than stop his issued order, I wasn't able to figure why either sorry :-(
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Can you explain more on what is happening. I can't test the map.

Whenever there is 1 Monster on the Battle field, the system seems to sh*t itself. Lol. It freezes. Somewhere in the coding (probably in the Battle Orders trigger), the monster's attacks aren't being set and the player doesn't get a chance to set his unit's attacks.

Also make sure your unit groups have more than 0 units in it.

One%20Unit%20Freeze.jpg


Yes there are units in the groups.

I think I understand why the last unit is attacking a null unit:
It seems to happen when its a player's unit. In your "Battle Order" trigger, when it fires for the last time

Thanks man, I rearranged when this check is performed and now the last unit attacks an actual unit. Thanks. Here's the new trigger:

  • Battle Orders
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Unit - Change ownership of (Triggering unit) to Player 9 (Gray) and Change color
      • Set FightCounter = (FightCounter + 1)
      • Game - Display to (All players) for 5.00 seconds the text: (FightCounter: + (String(FightCounter)))
      • Set Fight_Unit_Pending = h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]
      • Set Fight_Next_Unit = h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[(FightCounter + 1)])]]
      • Game - Display to (All players) for 5.00 seconds the text: (PendingUnit: + (Name of Fight_Unit_Pending))
      • Game - Display to (All players) for 5.00 seconds the text: (NextUnit: + (Name of Fight_Next_Unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Fight_Unit_Pending is in Fight_Enemy_Group) Equal to True
        • Then - Actions
          • Set Fight_Targeted_Enemy[FightCounter] = (Random unit from Fight_Ally_Group)
          • Set Fight_Basic_Attack[FightCounter] = True
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (SavedFightTargetUnit: + (Name of Fight_Targeted_Enemy[FightCounter]))
          • Game - Display to (All players) for 5.00 seconds the text: (NextUnit: + (Name of Fight_Next_Unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Fight_Next_Unit is in Fight_Ally_Group) Equal to True
            • Then - Actions
              • Unit - Change ownership of Fight_Next_Unit to Player 1 (Red) and Change color
              • Selection - Select Fight_Next_Unit for Player 1 (Red)
              • Skip remaining actions
            • Else - Actions
              • Trigger - Run (This trigger) (ignoring conditions)
              • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Fight_Ally_Group) Equal to True
        • Then - Actions
          • Set Fight_Targeted_Enemy[FightCounter] = (Target unit of issued order)
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (SavedFightTargetUnit: + (Name of Fight_Targeted_Enemy[FightCounter]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(attack))
            • Then - Actions
              • Set Fight_Basic_Attack[FightCounter] = True
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Fight_Next_Unit is in Fight_Ally_Group) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: (PlacementNumber: + (String(FightCounter)))
          • Game - Display to (All players) for 5.00 seconds the text: (NextUnit: + (Name of Fight_Next_Unit))
          • Unit - Change ownership of Fight_Next_Unit to Player 1 (Red) and Change color
          • Selection - Select Fight_Next_Unit for Player 1 (Red)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FightCounter Greater than or equal to ((Number of units in Figh_All_Units_Group) + 0)
        • Then - Actions
          • Set FightCounter = 1
          • Game - Display to (All players) for 5.00 seconds the text: -------------------...
          • Wait 1.00 seconds
          • Trigger - Run Battle Fight <gen> (checking conditions)
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions
I've also come to an issue where the rifleman actually attacks the target rather than stop his issued order, I wasn't able to figure why either sorry :-(

I haven't experienced this bug before. When did you get it?

Now I really don't have a clue why the system freezes with only one enemy..

I've done some testing. Deathismyfriend may be able to figure this one out. So I check the placement order of the units within the "Battle Register Speed" trigger. The units are placed properly according to who has the highest custom value.

However, when these triggers run (at start of Battle Orders), it is reporting otherwise. I know the placement is correct, but when the Fight_Unit_Pending is set, it picks Bow when he should be last on the list. The "FightOrder" variable equals 1 here.

  • Set Fight_Unit_Pending = h2LSorterUnitArray[h2LReturnedPlacementH2L[(Custom value of h2LSorterUnitArray[FightCounter])]]
  • Game - Display to (All players) for 5.00 seconds the text: (PendingUnit: + (Name of Fight_Unit_Pending))
I don't fully understand why it freezes, but I know the Fight_Unit_Pending should be the Sludge, not Bow. Any ideas?
 
Status
Not open for further replies.
Top