• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] WTF Problem

Status
Not open for further replies.
Level 19
Joined
Aug 16, 2007
Messages
881
Well, I don't know whats wrong... I've been trying to create a Final Fantasy like battle system. Everything works good, but only one thing is fucked up! The Enemy Battle loading trigger. The Load Engine ALWAYS loads the same enemies even if I have random integers. I'll post the main triggers here, please take a look at them and try find the problem that always generates the same enemies.


(It may be alot of unneccesary actions and conditions, but don't notice that, I'll optimise the code later).

Edit, fixed the code, but the randomizing of the enemies still don't work :(

ACTIVATE TRIGGER
  • CheckEnemieAttack
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • InBattle Equal to False
      • CinematicMode Equal to False
    • Actions
      • Unit Group - Pick every unit in (Units of type (Unit-type of Hero[1])) and do (Actions)
        • Loop - Actions
          • Set temp_point[1] = (Position of (Picked unit))
          • Set temp_point[2] = HeroPoint
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between temp_point[1] and temp_point[2]) Greater than or equal to 15.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Zone[1] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 5
                    • Then - Actions
                      • Cinematic - Turn cinematic mode On for (All players)
                      • Sound - Stop music After fading
                      • Sound - Play 09_normal_battle <gen>
                      • Set PositionBeforeFight = (Position of Hero[1])
                      • Set EnemieSpawnRegion[1] = BattleZone1 EnemiePos 1 <gen>
                      • Set EnemieSpawnRegion[2] = BattleZone1 EnemiePos 2 <gen>
                      • Set EnemieSpawnRegion[3] = BattleZone1 EnemiePos 3 <gen>
                      • Set AllySpawnRegion[1] = BattleZone1 AllyPos 1 <gen>
                      • Set AllySpawnRegion[2] = BattleZone1 AllyPos 2 <gen>
                      • Set AllySpawnRegion[3] = BattleZone1 AllyPos 3 <gen>
                      • Set InBattle = True
                      • Set AbleToUseBattle = True
                      • -------- RANDOMIZE ENEMIES --------
                      • Set HowManyEnemies = 0
                      • Set WhatEnemieType = 0
                      • Set HowManyEnemies = (Random integer number between 1 and 3)
                      • For each (Integer A) from 1 to HowManyEnemies, do (Actions)
                        • Loop - Actions
                          • Set WhatEnemieType = (Random integer number between 1 and 4)
                          • Set temp_point[2] = (Center of EnemieSpawnRegion[(Integer A)])
                          • Unit - Create 1 EnemieUnitTypeZone1[WhatEnemieType] for Neutral Passive at temp_point[2] facing Default building facing degrees
                          • Set InBattleEnemieUnit[(Integer A)] = (Last created unit)
                          • Custom script: call RemoveLocation(udg_temp_point[2])
                          • Set BattleEnemieDead[(Integer A)] = False
                      • -------- LOAD CHARACTERS --------
                      • For each (Integer A) from 2 to 3, do (Actions)
                        • Loop - Actions
                          • Unit - Unhide Hero[(Integer A)]
                      • For each (Integer A) from 1 to 3, do (Actions)
                        • Loop - Actions
                          • Set temp_point[2] = (Center of AllySpawnRegion[(Integer A)])
                          • Unit - Move Hero[(Integer A)] instantly to temp_point[2]
                          • Custom script: call RemoveLocation(udg_temp_point[2])
                      • -------- LOAD BATTLEBOARD & MISC --------
                      • Cinematic - Enable user control for (All players)
                      • Multiboard - Show BattleSystemMultiboard
                      • Multiboard - Maximize BattleSystemMultiboard
                      • Set temp_point[3] = (Position of Hero[2])
                      • Camera - Pan camera for Player 1 (Red) to temp_point[3] over 0.00 seconds
                      • Custom script: call RemoveLocation(udg_temp_point[3])
                      • Set CurrentAttackingHero = Hero[1]
                      • Camera - Lock camera target for Player 1 (Red) to CurrentAttackingHero, offset by (0.00, 0.00) using Default rotation
                      • Set EnemiesAlive = HowManyEnemies
                      • For each (Integer A) from 1 to 3, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • HeroHPMin[(Integer A)] Less than or equal to 0
                            • Then - Actions
                              • Set HeroDead[(Integer A)] = True
                              • Animation - Play Hero[(Integer A)]'s death animation
                            • Else - Actions
                      • Game - Display to (All players) for 3.00 seconds the text: (String((Random integer number between 1 and 1000)))
                      • Selection - Select Hero[1] for Player 1 (Red)
                      • Cinematic - Send transmission to (All players) from No unit named <Empty String>: Play No sound and display > |cffff0000Attack.... Modify duration: Set to 1000.00 seconds and Wait
                    • Else - Actions
                • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation(udg_temp_point[1])
          • Custom script: call RemoveLocation(udg_temp_point[2])
 
Last edited:
Status
Not open for further replies.
Top