~ Forums of Enroth ~
Would you like to react to this message? Create an account in a few clicks or log in to continue.

~ Forums of Enroth ~

The Enroth diehard fan community
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» [H3SW v0.8.2] Witch Hunt
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby GodRage 2024-11-18, 22:56

» 5Kings1Ring
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby GodRage 2024-11-18, 22:54

» Polskie powitanie
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby rrravyn 2024-11-15, 09:53

» loading simplification
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby badtoper 2024-11-15, 04:37

» Easier Troop Management Between Garrison and Hero in Town
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby badtoper 2024-11-15, 04:05

» Improvements for Hero Management and Turn Confirmation
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby badtoper 2024-11-15, 01:57

» [H3SW v0.8.2] Desert Isle
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby Sir Albe 2024-10-31, 07:56

Poll
Global announcements should be:
Everlasting, 1 for each project.
[Script System][Suggestions] WaitEndOfEvent() Redbar110%[Script System][Suggestions] WaitEndOfEvent() Redbar12
 0% [ 0 ]
Temporary, when there is something new to announce.
[Script System][Suggestions] WaitEndOfEvent() Redbar11100%[Script System][Suggestions] WaitEndOfEvent() Redbar12
 100% [ 6 ]
Holalala... No idea where the Ultimate artifact is.
[Script System][Suggestions] WaitEndOfEvent() Redbar110%[Script System][Suggestions] WaitEndOfEvent() Redbar12
 0% [ 0 ]
Total Votes : 6
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
Introduce yourself
H3SW General Discussion
H3SW Map List: Work in progress
H3SW: Dwelling Development
The Floody Land
Forum Admins Feed
Enrothian Fan Art
Heroes III: The Succession Wars v0.8.2 Beta

 

 [Script System][Suggestions] WaitEndOfEvent()

Go down 
2 posters
AuthorMessage
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 780
Quality Points : 78
Registration Date : 2015-09-06

[Script System][Suggestions] WaitEndOfEvent() Empty
PostSubject: [Script System][Suggestions] WaitEndOfEvent()   [Script System][Suggestions] WaitEndOfEvent() Icon_minitime2017-03-09, 03:37

Tested with Ironfist version 1.2.1+ (version of December 15, 2016).

*

Currently, there is no way to execute instructions after an event is completed, it's always before.

*

"WaitEndOfEvent" waits for the end of an event to continue the instructions.
It can be used with callbacks that can trigger events.

Currently:

- OnLocationVisit
- OnHeroMove
- OnUnitRecruit

Examples of use:

function OnLocationVisit(type, x, y)
 if x == 6 and y == 3 and type == LOCATION_RUINS then
   MessageBox("Text displayed before visiting the Ruins.");
   MessageBox("Text still displayed before visiting the Ruins.");
 end
end;

When the hero moves on the active square of the Ruins, this happens:

The message box "Text displayed before visiting the Ruins." is displayed first.
Then, the message box "Text still displayed before visiting the Ruins." is displayed.
Then, the standard box of the location "Ruins - You've found some Medusas living in the ruins.  They are willing to join your army for a price.  Do you want to recruit Medusa? [YES] [NO]" is displayed.
And then, the recruit box for the Medusas is displayed.

function OnLocationVisit(type, x, y)
 if x == 6 and y == 3 and type == LOCATION_RUINS then
   MessageBox("Text displayed before visiting the Ruins.");
   WaitEndOfEvent();
   MessageBox("Text displayed after visiting the Ruins.");
 end
end;

With "WaitEndOfEvent", when the hero moves on the active square of the Ruins, this happens:

The message box "Text displayed before visiting the Ruins." is displayed first.
Then, the standard box of the location "Ruins - You've found some Medusas living in the ruins.  They are willing to join your army for a price.  Do you want to recruit Medusa? [YES] [NO]" is displayed.
Then, the recruit box for the Medusas is displayed.
After the recruit box for the Medusas is closed, the message "Text displayed after visiting the Ruins." is displayed.

*

function OnHeroMove(x, y)
 if x == 10 and y == 9 then
   MessageBox("Text displayed before visiting the Ore Mine.");
   WaitEndOfEvent();
   MessageBox("Text displayed after visiting the Ore Mine.");
 end
end;

With "WaitEndOfEvent", when the hero moves on the active square of the Ore Mine, this happens:

The message box "Text displayed before visiting the Ore Mine." is displayed first.
Then, the standard box of the location "Ore Mine - You gain control of an ore mine. It will provide you with two units of ore per day. [OKAY]" is displayed.
Then, the message box "Text displayed after visiting the Ore Mine." is displayed.

*

function OnUnitRecruit(creatureid)
 if creatureid == CREATURE_RANGER then
   MessageBox("The Rangers were eagerly awaiting you.");
   WaitEndOfEvent();
   MessageBox("The Rangers wish you a glorious victory!!!");
 end
end;

With "WaitEndOfEvent", when the user recruit Rangers, the message "The Rangers were eagerly awaiting you." is displayed.
Then, the recruit box for the Rangers is opened.
After the recruit box for the Rangers is closed, the message "The Rangers wish you a glorious victory!!!" is displayed.

***** Updated on March 12, 2017 *****

Also with:

- OnBattleStart

Example of use:

function OnBattleStart()
 if GetHeroName(BattleGetHero(1)) == "Ector" then
   MessageBox("The battle begins... Good luck Ector!!!");
   WaitEndOfEvent();
   MessageBox("Text displayed after the end of the combat.");
 end
end;

With "WaitEndOfEvent", when the battle starts, this happens:

The message box "The battle begins... Good luck Ector!!!" is displayed first.
Then, the combat takes place.
And after the last message box of the end of the combat is closed, the message "Text displayed after the end of the combat." is displayed.

***** Updated on March 17, 2017 *****

Also with:

- OnTownOpen

"WaitEndOfEvent" waits for the end of the "animation" of the exit of the town after the player has clicked the "EXIT" button and is back on the view of the map.

- OnBattleMeleeAttack

"WaitEndOfEvent" waits for the end of the "animation" of the melee attack.


Last edited by Unknown_Hero on 2017-03-18, 02:19; edited 1 time in total
Back to top Go down
Darmani
Master Modder
Master Modder
Darmani


Messages : 289
Quality Points : 47
Registration Date : 2014-12-27

[Script System][Suggestions] WaitEndOfEvent() Empty
PostSubject: Re: [Script System][Suggestions] WaitEndOfEvent()   [Script System][Suggestions] WaitEndOfEvent() Icon_minitime2017-03-13, 07:45

Hmmm.....I was about to say that this would be very difficult, because it would require an advanced programming technique called coroutines. But....I think we might actually be able to do this. Noted.
Back to top Go down
 
[Script System][Suggestions] WaitEndOfEvent()
Back to top 
Page 1 of 1
 Similar topics
-
» [Script System][Suggestions] GetCreaturesInGeneratorQuantity(x, y) and more
» [Script System][Suggestions] GetUserDifficultyChoice() and more
» [Script System][Suggestions] BattleGetCurrentTurn() and more
» [Script System][Suggestions] CancelShareVision(p1, p2)
» [Script System][Suggestions] GetGlobalCreatureUpgradeCost(value) and more

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: Modding Guild :: Heroes of Might and Magic II: Project Ironfist :: Modding and Mapmaking-
Jump to: