~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» The Symphony of Heroes - Paul Romero with ochestra concert
by Orzie Yesterday at 20:01

» H3SW: General Graphics discussion
by robizeratul 2017-10-18, 11:45

» Ragoon's Graphics For HoMM3SW
by robizeratul 2017-10-18, 11:40

» Creature Quest – The New Adventure from JVC (feat some old NWC members)
by Galaad 2017-10-13, 20:34

» Modding Questions
by GodRage 2017-10-12, 18:32

» Introduce yourself
by Orzie 2017-10-12, 17:10

» [Ironfist ver 1.3.0] Sorrow's End map - Sprites of creatures missing on the adventure map
by Kristo 2017-10-12, 15:13

Poll
"Wait" in HoMM2?
Yes
80%
 80% [ 45 ]
No
20%
 20% [ 11 ]
Total Votes : 56
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
H3SW Map List: Work in progress
Dervish Faction General Concept
Enrothian Fan Art
H3SW Recruitment Point - Enroth Needs You!
Серия книг "Земли Меча и Магии"
Commanders?

Share | 
 

 [Script System][Suggestions] WaitEndOfEvent()

View previous topic View next topic Go down 
AuthorMessage
Unknown_Hero
Minotaur
Minotaur
avatar

Messages : 344
Quality Points : 40
Registration Date : 2015-09-06

PostSubject: [Script System][Suggestions] WaitEndOfEvent()   2017-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
avatar

Messages : 175
Quality Points : 32
Registration Date : 2014-12-27

PostSubject: Re: [Script System][Suggestions] WaitEndOfEvent()   2017-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()
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» [Script System][Suggestions] So, which expressions are the most desirable?
» One Woman in India dies every hour due to the dowry system
» Minecraft's Coordinate System
» Award system
» Latest Topics (new system)

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: