~ 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
» Songs of Conquest
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby Blake01 2024-04-07, 15:14

» ...to XP run...
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby CATMAN 2024-03-30, 03:16

» WARNING - The dreaded moment is here: Heroes 6 servers shutting down
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby Blake01 2024-03-29, 23:04

» Songs of Silence (HoMM like game)
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby Blake01 2024-03-27, 16:52

» Heroes Orchestra's 5th Birthday concerts with Paul Romero
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby rrravyn 2024-03-23, 22:45

» fheroes2 General Announcements
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby sirDranik 2024-03-17, 23:35

» Photo Gallery
[Script System][Suggestions] WaitEndOfEvent() Icon_minitimeby Sir Albe 2024-03-07, 06:57

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
Forum Admins Feed
The Floody Land
Enrothian Fan Art
Heroes III: The Succession Wars v0.8.1 Beta

 

 [Script System][Suggestions] WaitEndOfEvent()

Go down 
2 posters
AuthorMessage
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 778
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 : 288
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] BattleGetCurrentTurn() and more
» [Script System][Suggestions] CancelShareVision(p1, p2)
» [Script System][Suggestions] GetGlobalCreatureUpgradeCost(value) and more
» [Script System][Suggestions] GetCreaturesInGeneratorQuantity(x, y) and more
» [Script System][Suggestions] GetUserDifficultyChoice() 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: