~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» [EN, RU][Offline] HoMM1 Tournament of the Landless 2017 (Турнир Безземельных)
by Orzie Yesterday at 01:32

» How autoborder/autofixer works...
by Unknown_Hero 2017-08-15, 23:31

» Navigation secondary skill - Too short to disembark
by Unknown_Hero 2017-08-13, 22:08

» [EN, RU][Offline] HoMM1 Trade Guild Tourney 2017 (Турнир Торговой Гильдии)
by Orzie 2017-08-12, 16:27

» Happy Birthdays and Congrats!
by Dr Slash 2017-08-10, 11:10

» The Symphony of Heroes - Paul Romero with ochestra concert
by Sir Albe 2017-08-10, 04:08

» Change to the Arena (PoL)
by Unknown_Hero 2017-08-08, 22:07

Poll
"Wait" in HoMM2?
Yes
80%
 80% [ 44 ]
No
20%
 20% [ 11 ]
Total Votes : 55
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!
Серия книг "Земли Меча и Магии"
Heroes of Might and Magic 3: The Succession Wars - General info

Share | 
 

 [Script System][Suggestions] WaitEndOfEvent()

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

Messages : 332
Quality Points : 37
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 : 167
Quality Points : 30
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
-
» One Woman in India dies every hour due to the dowry system
» Minecraft's Coordinate System
» Award system
» Latest Topics (new system)
» Warning 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: