T
Tirlititi
Guest
Your error is perfectly understandable: that's because of me.
I decided to automatically name several functions with "XXX_Loop" (the functions with ID 1) because that's what they do most of the time. However, it's not because they are called like that that they loop: they loop because they have the lines "Wait(1)" and "loop" at the end most of the time.
In this case, "Lich_Loop" doesn't have those lines but simply returns at the end. You don't want to just replace the "return" by a "Wait(1) + loop" either because it would run the dialog again everytime.
The easiest solution there is to put the looping part in an infinite "while" loop:
Code: [Select]
More generally:
‣ The "XXX_Main" function runs as soon as the entry is initialized; the script level is set to 0 until it returns, which means that you shouldn't use any RunSync or similars inside the main function that would run a script of the same entry (you can use a RunSync on another entry though, provided that entry was initialized and its main function already returned),
‣ The "XXX_Loop" function runs right after the main function ends; the script level is defaulted to 7 so you can use RunSync codes inside. It runs only once.
In Field and World Map scripts:
‣ The "XXX_Reinit" function runs after returning to the field from a battle. Several datas are flushed when a battle triggers and this function set them back.
‣ The "XXX_Range" function runs every frame when the player's character is close to an object (determined with the collision radius set by SetObjectLogicalSize) or inside a region. It should only be used with entries initialized by InitRegion or InitObject.
‣ The "XXX_SpeakBTN" function runs when pressing the "confirm" button while the player's character is next to the object and facing it (the radius is determined with the talk radius set by SetObjectLogicalSize) or inside a region. In Steam, its presence adds an icon over the player's character. It should only be used with entries initialized by InitRegion or InitObject.
‣ The "XXX_CardBTN" function works the same as "XXX_SpeakBTN" except that it's triggered by the "card/moogle" button.
‣ The "Main_Unk" function runs when a menu opens on a World Map (either the player opens the main menu or the script issues a Menu code).
In Battle scripts:
‣ The "XXX_ATB" function runs when the enemy's ATB gets full. Attacks issued inside are added as "Enemy Command" at the end of the command queue. It has to issue an attack command.
‣ The "XXX_Counter" function runs when the enemy has been affected by an attack from a player character that was not a counter-attack or a Charge!, etc... and if it still has more than 0 HP. Attacks issued inside are added as "Enemy Counter" commands and take priority over most of the other commands.
‣ The "XXX_Death" function runs when the enemy has been affected by an attack from a player character, if it has 0 HP and if the related flag is enabled. Attacks issued inside take priority over most of the other commands. Attacks issued inside are added as "Enemy Death" commands and take priority over most of the other commands.
‣ The "XXX_CounterEx" function runs when the enemy has been affected by any attack.
I decided to automatically name several functions with "XXX_Loop" (the functions with ID 1) because that's what they do most of the time. However, it's not because they are called like that that they loop: they loop because they have the lines "Wait(1)" and "loop" at the end most of the time.
In this case, "Lich_Loop" doesn't have those lines but simply returns at the end. You don't want to just replace the "return" by a "Wait(1) + loop" either because it would run the dialog again everytime.
The easiest solution there is to put the looping part in an infinite "while" loop:
Code: [Select]
Code:
// ... RunBattleCode( 35, 0 ) while ( GetBattleState != 4 ) { Wait( 1 ) } while ( 1 ) { if ( #( SV_FunctionEnemy[HP] <$ 10000 ) ) { if ( VAR_LocUInt8_60 < 1 ) { set VAR_LocUInt8_60++ set SV_FunctionEnemy[HP] =$ 40000 } } Wait( 1 ) // If you forget that, the game will freeze } return
‣ The "XXX_Main" function runs as soon as the entry is initialized; the script level is set to 0 until it returns, which means that you shouldn't use any RunSync or similars inside the main function that would run a script of the same entry (you can use a RunSync on another entry though, provided that entry was initialized and its main function already returned),
‣ The "XXX_Loop" function runs right after the main function ends; the script level is defaulted to 7 so you can use RunSync codes inside. It runs only once.
In Field and World Map scripts:
‣ The "XXX_Reinit" function runs after returning to the field from a battle. Several datas are flushed when a battle triggers and this function set them back.
‣ The "XXX_Range" function runs every frame when the player's character is close to an object (determined with the collision radius set by SetObjectLogicalSize) or inside a region. It should only be used with entries initialized by InitRegion or InitObject.
‣ The "XXX_SpeakBTN" function runs when pressing the "confirm" button while the player's character is next to the object and facing it (the radius is determined with the talk radius set by SetObjectLogicalSize) or inside a region. In Steam, its presence adds an icon over the player's character. It should only be used with entries initialized by InitRegion or InitObject.
‣ The "XXX_CardBTN" function works the same as "XXX_SpeakBTN" except that it's triggered by the "card/moogle" button.
‣ The "Main_Unk" function runs when a menu opens on a World Map (either the player opens the main menu or the script issues a Menu code).
In Battle scripts:
‣ The "XXX_ATB" function runs when the enemy's ATB gets full. Attacks issued inside are added as "Enemy Command" at the end of the command queue. It has to issue an attack command.
‣ The "XXX_Counter" function runs when the enemy has been affected by an attack from a player character that was not a counter-attack or a Charge!, etc... and if it still has more than 0 HP. Attacks issued inside are added as "Enemy Counter" commands and take priority over most of the other commands.
‣ The "XXX_Death" function runs when the enemy has been affected by an attack from a player character, if it has 0 HP and if the related flag is enabled. Attacks issued inside take priority over most of the other commands. Attacks issued inside are added as "Enemy Death" commands and take priority over most of the other commands.
‣ The "XXX_CounterEx" function runs when the enemy has been affected by any attack.
Last edited: