- Joined
- Apr 19, 2011
- Messages
- 447
Hi.
I have some problems with the triggers of my main proyect. For now, I stopped creating new systems, and started fixing the various bugs on the already created ones. And right now, everything works fine, but I found that some triggers seem to lag.
I'm absolute sure that this lag is not caused by leaks or by rendering too much units/doodads. This lag only happens when certain triggers run, and I want you to check them and tell me how could I improve their efficience.
In my proyect, when the character has an encounter with an enemy group, they are taken to a battle arena, and a some variables and triggers have to be configurated to work with the battle system I created. This is the trigger that starts when one of those encounters begins (I chosed a random encounter. Everything is explained in the comments).
The game seems to lag when this runs:
The second moment where the game seems to lag is when a battle ends. When the battle ends, some configurations have to be done to leave the battle system. This is divided in three different triggers:
In this case, the ARRAY_End trigger would be this one:
I suppose that's it. When the game runs those triggers, it seems to lag, I don't clearly know why. What do you think I could do to improve their efficience?
Actually, the lag is the only thing that's pissing me off...
Regards
I have some problems with the triggers of my main proyect. For now, I stopped creating new systems, and started fixing the various bugs on the already created ones. And right now, everything works fine, but I found that some triggers seem to lag.
I'm absolute sure that this lag is not caused by leaks or by rendering too much units/doodads. This lag only happens when certain triggers run, and I want you to check them and tell me how could I improve their efficience.
In my proyect, when the character has an encounter with an enemy group, they are taken to a battle arena, and a some variables and triggers have to be configurated to work with the battle system I created. This is the trigger that starts when one of those encounters begins (I chosed a random encounter. Everything is explained in the comments).
The game seems to lag when this runs:
-
Start Battle
-
Events
- Unit - A unit comes within 200.00 of Aelan 0000 <gen>
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Triggering unit) Equal to Encounter_02_Treant
- (Triggering unit) Equal to Encounter_02_Mantis_01
- (Triggering unit) Equal to Encounter_02_Mantis_02
-
Conditions
-
Or - Any (Conditions) are true
-
Actions
- Trigger - Turn off (This trigger)
- -------- Preventing the player to access the Main Menu during battle --------
- Trigger - Turn off Main Menu Access <gen>
- -------- Disabling the enemy detection system for this enemy group --------
- Trigger - Turn off Sight Encounter 02 <gen>
- Trigger - Turn off Chase Encounter 02 <gen>
- Trigger - Turn off Restore Encounter 02 <gen>
- Trigger - Turn off Guard Encounter 02 AELAN <gen>
- Trigger - Turn off Guard Encounter 02 ENEMY <gen>
- -------- Preventing the player from moving the characters after the encounter --------
- Unit - Change ownership of Aelan 0000 <gen> to Player 2 (blue) and Preserve color
- Unit - Change ownership of Ruy_Out_Battle to Player 2 (blue) and Preserve color
- -------- Sounds and visuals --------
- Unit - Order Encounter_02_Treant to Stop
- Unit - Order Encounter_02_Mantis_01 to Stop
- Unit - Order Encounter_02_Mantis_02 to Stop
- Unit - Order Aelan 0000 <gen> to Stop
- Unit - Order Ruy_Out_Battle to Stop
- Animation - Play Aelan 0000 <gen>'s stand ready animation
- Animation - Play Ruy_Out_Battle's stand ready animation
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Si: Conditions
- (Unit-type of (Triggering unit)) Equal to Treant
-
Then - Actions
- Animation - Play (Triggering unit)'s Stand - 4 animation
- Sound - Play Damaging_Treant <gen>
- Other - Actions
-
Si: Conditions
- -------- Disabling the camera control --------
- Set CAMERA_CONTROL = False
- -------- Disabling this encounter so it won't start again --------
- Trigger - Turn off Encounter 02 Treant <gen>
- Trigger - Turn off Encounter 02 Mantis 01 <gen>
- Trigger - Turn off Encounter 02 Mantis 02 <gen>
- -------- Locking the camera on the enemy --------
- Camera - Lock camera target for Player 1 (red) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
- -------- Stopping the current music --------
- Countdown Timer - Pause ARRAY_Timers_Music[1]
- Sound - Stop music After fade-out
- -------- Playing the battle music --------
- Trigger - Run Storm Through Them <gen> (checking conditions)
- Wait 2.00 seconds
- Sound - Play Entering_Battle <gen>
- -------- Fading the screen --------
- Cinematic - Fade out over 0.25 seconds using texture White mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- Wait 2.00 seconds
- -------- When the player encounters some enemies, a ! symbol appears over their heads. This destroys those symbols --------
- Special Effect - Destroy ARRAY_SYMBOLS[2]
- Special Effect - Destroy ARRAY_SYMBOLS[3]
- Special Effect - Destroy ARRAY_SYMBOLS[4]
- -------- Checking if the player has 1 character or has 2, and creating those characters on the battle arena --------
- -------- This also sets the camera for the battle --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ALONE Equal to False
-
Then - Actions
- Set TempLoc = (Center of Aelan DOUBLE <gen>)
- Unit - Create 1 Aelan (Battle) for Neutral pasive at TempLoc facing 90.00 degrees
- Custom script: call RemoveLocation(udg_TempLoc)
- Unit - Change color of (Last created unit) to Black
- Set Aelan = (Last created unit)
- Animation - Play Aelan's stand ready animation, using only Current animations
- Set TempLoc = (Center of Ruy DOUBLE <gen>)
- Unidad - Create 1 Ruy (Battle) for Neutral pasive at TempLoc facing 90.00 degrees
- Custom script: call RemoveLocation(udg_TempLoc)
- Unit - Change color of (Last created unit) to Black
- Set Ruy = (Last created unit)
- Animation - Play Ruy's stand ready animation, using only Current animations
- Camera - Apply BATTLE Allies DOUBLE <gen> for Player 1 (red) over 0.00 seconds
-
Other - Actions
- Set TempLoc = (Center of Aelan SOLO <gen>)
- Unit - Create 1 Aelan (Battle) for Neutral pasive at TempLoc facing 90.00 degrees
- Custom script: call RemoveLocation(udg_TempLoc)
- Unit - Change color of (Last created unit) to Black
- Set Aelan = (Last created unit)
- Animation - Play Aelan's stand ready animation, using only Current animations
- Camera - Aplicar BATTLE Allies SOLO <gen> for Player 1 (red) over 0.00 seconds
-
If - Conditions
- -------- Creating the enemy group on the battle arena --------
- Set TempLoc = (Center of Monster 1 <gen>)
- Unit - Create 1 Treant (Battle) for Player 9 (Grey) at TempLoc facing 270.00 degrees
- Unit - Change color of (Last created unit) to Black
- Custom script: call RemoveLocation(udg_TempLoc)
- Set Monster_01 = (Last created unit)
- Set TempLoc = (Center of Monster 2 <gen>)
- Unit - Create 1 Mantis (Battle) for Player 9 (Gray) at TempLoc facing 270.00 degrees
- Unit - Change color of (Last created unit) to Black
- Custom script: call RemoveLocation(udg_TempLoc)
- Set Monster_02 = (Last created unit)
- Set TempLoc = (Center of Monster 3 <gen>)
- Unit - Create 1 Mantis (Battle) for Player 9 (Gray) at TempLoc facing 270.00 degrees
- Unit - Change color of (Last created unit) to Black
- Custom script: call RemoveLocation(udg_TempLoc)
- Set Monster_03 = (Last created unit)
- -------- Unfading the screen --------
- Cinematic - Fade out over 2.00 seconds using texture White mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- Wait 0.25 seconds
- -------- Fully healing the characters. The characters also begin the battles ar full HP and MP --------
- Set HP_Aelan = HP_Aelan_Original
- Set HP_Ruy = HP_Ruy_Original
- Set MP_Aelan = MP_Aelan_Original
- Set MP_Ruy = MP_Ruy_Original
- -------- Setting the enemy stats for the battle system --------
- Set Enemy_Number = 3
- Set HP_Monster_01_Original = 40
- Set HP_Monster_01 = 40
- Set FRZ_Monster_01 = 8
- Set RES_Monster_01 = 6
- Set HP_Monster_02_Original = 20
- Set HP_Monster_02 = 20
- Set FRZ_Monster_02 = 14
- Set RES_Monster_02 = 5
- Set HP_Monster_03_Original = 20
- Set HP_Monster_03 = 20
- Set FRZ_Monster_03 = 14
- Set RES_Monster_03 = 5
- -------- Setting which AI the battle system has to use for the enemies --------
- Set AI_01 = 0
- Set AI_02 = 1
- Set AI_03 = 1
- Set AI_Attack_01 = 0
- Set AI_Attack_02 = 1
- Set AI_Attack_03 = 1
- -------- Setting the ending data for the system --------
- Set END = 2
- -------- Starting the battle system --------
- Trigger - Run START SYSTEM <gen> (checking conditions)
-
Events
The second moment where the game seems to lag is when a battle ends. When the battle ends, some configurations have to be done to leave the battle system. This is divided in three different triggers:
-
End Battle
- Events
- Conditions
-
Actions
- -------- Some selection settings. That trigger does NOT lag (I'm sure of it) --------
- Set Selection = 0
- Trigger - Run ARRAY_Selections[Selection] (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Monster_01_Dead Equal to True) and ((Monster_02_Dead Equal to True) and (Monster_03_Dead Equal to True))
-
Then - Actions
- -------- Enabling cinematic mode and stopping the different possible battle musics --------
- Cinematic - Turn cinematic mode On for Player group: Player 1 (red)
- Countdown Timer - Pause ARRAY_Timers_Music[2]
- Countdown Timer - Pause ARRAY_Timers_Music[3]
- Countdown Timer - Pause ARRAY_Timers_Music[4]
- Countdown Timer - Pause ARRAY_Timers_Music[7]
- Countdown Timer - Pause ARRAY_Timers_Music[8]
- Sound - Stop music After fade-out
- -------- Reseting characters' animations --------
- Animation - Reset Aelan's animation
- Animation - Reset Ruy's animation
- Wait 0.01 seconds
- -------- Playing victory music --------
- Sound - Play Fanfare <gen>
- -------- Restoring the modifiers and bonuses that can be altered during battle --------
- Set MOD_FRZ_Aelan = 1.00
- Set MOD_FRZ_Ruy = 1.00
- Set MOD_FRZ_Monster = 1.00
- Set MOD_FRZ_Monster_01 = 1.00
- Set MOD_FRZ_Monster_02 = 1.00
- Set MOD_FRZ_Monster_03 = 1.00
- Set MOD_RES_Aelan = 1.00
- Set MOD_RES_Ruy = 1.00
- Set MOD_RES_Monster = 1.00
- Set MOD_RES_Monster_01 = 1.00
- Set MOD_RES_Monster_02 = 1.00
- Set MOD_RES_Monster_03 = 1.00
- Set MOD_MAG_Aelan = 1.00
- Set MOD_MAG_Ruy = 1.00
- Set MOD_MAG_Monster = 1.00
- Set MOD_MAG_Monster_01 = 1.00
- Set MOD_MAG_Monster_02 = 1.00
- Set MOD_MAG_Monster_03 = 1.00
- Set MOD_ESP_Aelan = 1.00
- Set MOD_ESP_Ruy = 1.00
- Set MOD_ESP_Monster = 1.00
- Set MOD_ESP_Monster_01 = 1.00
- Set MOD_ESP_Monster_02 = 1.00
- Set MOD_ESP_Monster_03 = 1.00
- -------- Erasing the battle multiboard --------
- Multiboard - Destroy BOARD_Battle
- -------- Running the "Victory" trigger --------
- Trigger - Run VICTORY <gen> (checking conditions)
- Other - Actions
-
If - Conditions
-
VICTORY
- Events
- Conditions
-
Actions
- -------- Setting the monsters as dead --------
- Set Monster_01_Dead = False
- Set Monster_02_Dead = False
- Set Monster_03_Dead = False
- -------- Disabling the configurations for special battle cameras --------
- Set Big_Battle = False
- Set Huge_Battle = False
- -------- Setting the experience reward --------
- Set RESULT_EXP = ARRAY_Experience[END]
- -------- Giving the experience to the characters the player has --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ALONE Equal to True
-
Then - Actions
- Set EXP_Aelan = (EXP_Aelan + RESULT_EXP)
-
Other - Actions
- Set EXP_Aelan = (EXP_Aelan + RESULT_EXP)
- Set EXP_Ruy = (EXP_Ruy + RESULT_EXP)
-
If - Conditions
- -------- Fading out the screen --------
- Cinematic - Fade out over 2.00 seconds using texture Black mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- Wait 2.00 seconds
- -------- Removing the enemies and the characters from the battle arena --------
- Unit - Remove Monster_01 from the game
- Unit - Remove Monster_02 from the game
- Unit - Remove Monster_03 from the game
- Unit - Remove Aelan from the game
- Unit - Remove Ruy from the game
- -------- Selection configurations --------
- Set Selection = 0
- Trigger - Run ARRAY_Selections[Selection] (ignoring conditions)
- -------- Disabling the triggers that keep the camera locked --------
- Trigger - Turn off Allies SOLO <gen>
- Trigger - Turn off Allies DOUBLE <gen>
- Trigger - Turn off Allies Big <gen>
- Trigger - Turn off Allies Huge <gen>
- Trigger - Turn off Monsters <gen>
- Trigger - Turn off Monsters Big <gen>
- Trigger - Turn off Monsters Huge <gen>
- -------- Applying the victory screen camera and fading in --------
- Camara - Apply RESULT SCREEN <gen> for Player 1 (red) over 0.00 seconds
- Cinematic - Fade in over 2.00 seconds using texture Black mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- -------- Showing the floating texts of the victory screen --------
- Set TempLoc = (Center of Text box 1 <gen>)
- Floating Text - Create floating text that reads VICTORY at TempLoc with Z offset 50.00, using font size 25.00, color (70.00%, 70.00%, 100.00%), and 0.00% transparency
- Custom script: call RemoveLocation(udg_TempLoc)
- Set RESULT_Text_01 = (Last created floating text)
- Set TempLoc = (Center of Text box 3 <gen>)
- Floating Text - Create floating text that reads ITEMS at TempLoc with Z offset 50.00, using font size 16.50, color (70.00%, 70.00%, 100.00%), and 0.00% transparency
- Custom script: call RemoveLocation(udg_TempLoc)
- Set RESULT_Text_03 = (Last created floating text)
- Wait 2.00 seconds
- Set TempLoc = (Center of Text box 2 <gen>)
- Floating Text - Create floating text that reads (You get + ((String(RESULT_EXP)) + EXP!)) at TempLoc with Z offset 50.00, using font size 15.00, color (100.00%, 60.00%, 0.00%), and 0.00% transparency
- Custom script: call RemoveLocation(udg_TempLoc)
- Set RESULT_Text_02 = (Last created floating text)
- Sound - Play Results <gen>
- Wait 0.50 seconds
- Set TempLoc = (Center of Text box 4 <gen>)
- Floating Text - Create floating text that reads <Unavailable yet> at TempLoc with z offset 50.00, using font size 15.00, color (100.00%, 60.00%, 0.00%), and 0.00% transparency
- Custom script: call RemoveLocation(udg_TempLoc)
- Set RESULT_Text_04 = (Last created floating text)
- Sound - Stop Results <gen> Immediately
- Sound - Play Results <gen>
- Wait 0.50 seconds
- Set TempLoc = (Center of Text box 5 <gen>)
- Floating Text - Create floating text that reads Press [ESC] to... at TempLoc with Z offset 50.00, using font size 15.00, color (70.00%, 70.00%, 100.00%), and 0.00% transparency
- Custom script: call RemoveLocation(udg_TempLoc)
- Set RESULT_Text_05 = (Last created floating text)
- -------- Allowing the player to leave the victory screen --------
- Trigger - Turn on ARRAY_End[END]
-
End Encounter 02
-
Events
- Player - Player 1 (red) skips a cinematic sequence
- Conditions
-
Actions
- -------- Disabling the trigger and fading out --------
- Trigger - Turn off (This trigger)
- Cinematic - Fade out over 2.00 seconds using texture Black mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- Wait 2.00 seconds
- -------- Stopping the victory music and playing the normal music --------
- Sound - Stop music After fade-out
- Trigger - Run Mangron Forest <gen> (checking conditions)
- -------- Restoring the camera control --------
- Camera - Lock camera target for Player (red) to Aelan 0000 <gen>, offset by (0.00, 0.00) using Default rotation
- Camera - Set Player 1 (red)'s camera Angle of attack to 325.00 over 0.00 seconds
- Set Camera_Height = 325.00
- Set CAMERA_CONTROL = True
- -------- Reconvering control over the characters --------
- Unit - Change ownership of Aelan 0000 <gen> to Player 1 (red) and Preserve color
- Unit - Change ownership of Ruy_Out_Battle to Player 1 (red) and Preserve color
- -------- Disabling cinematic mode and fading in --------
- Cinematic - Turn cinematic mode Off for Player group: Player 1 (red)
- Cinematic - Fade in over 2.00 seconds using texture Black mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
- -------- Allowing the player to access the main menu --------
- Trigger - Turn on Main Menu Access <gen>
- -------- Selection configurations --------
- Set Selection = 1
- Trigger - Run ARRAY_Selections[Selection] (ignoring conditions)
- -------- Erasing the victory screen --------
- Floating Text - Destroy RESULT_Text_01
- Floating Text - Destroy RESULT_Text_02
- Floating Text - Destroy RESULT_Text_03
- Floating Text - Destroy RESULT_Text_04
- Floating Text - Destroy RESULT_Text_05
- Wait 2.00 seconds
- -------- Killing the enemies (the real ones, not the ones in the battle arena) --------
- Unit - Kill Encounter_02_Treant
- Unit - Kill Encounter_02_Mantis_01
- Unit - Kill Encounter_02_Mantis_02
- -------- Resetting the characters' animations --------
- Animation - Reset Aelan's animation
- Animation - Reset Ruy_Out_Battle's animation
-
Events
Actually, the lag is the only thing that's pissing me off...
Regards