How do you create a script to display a message when object has been taken by the AI?
When the AI takes its turn and captures your castle a message is displayed stating that fact.
How do I create one when the AI take either a gold mine or another object e.g. Pandora's Box?
please advise
H4 Displaying a message during AI turn when an object is taking
- Grythandril
- Leprechaun
- Posts: 19
- Joined: 06 Jan 2006
- Location: Grythandril
H4 Displaying a message during AI turn when an object is taking
Last edited by Grythandril on 25 Aug 2019, 21:29, edited 1 time in total.
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: H4 Displaying a message during AI turn when an object is taking
I'll have to take a look later to verify, but don't mines have standard events? If they do, then you can simply use the captured event to place your scripting in.
Not sure on the pandora's box, I'll have to try to take a look at the editor later.
Not sure on the pandora's box, I'll have to try to take a look at the editor later.
- Grythandril
- Leprechaun
- Posts: 19
- Joined: 06 Jan 2006
- Location: Grythandril
Re: H4 Displaying a message during AI turn when an object is taking
I'm able to use the Pandora box (named Pandora 01) and the bomb object (named bomb1) to remove the box
Then create an placed event for the human player to be asked if they wish to open the box
If the answer is yes then the player will receive the contents which then delete the box and remove the script
Also so far I think the AI cannot do the above so have placed an event close to the box and create a script - placed event for the computer to automatically open the box and get the different contents when its cross the placed event.
But so far cannot produce a message for the human player (during the AI turn) to indicate that the Pandora's box has been opened
Then create an placed event for the human player to be asked if they wish to open the box
If the answer is yes then the player will receive the contents which then delete the box and remove the script
Also so far I think the AI cannot do the above so have placed an event close to the box and create a script - placed event for the computer to automatically open the box and get the different contents when its cross the placed event.
But so far cannot produce a message for the human player (during the AI turn) to indicate that the Pandora's box has been opened
- Grythandril
- Leprechaun
- Posts: 19
- Joined: 06 Jan 2006
- Location: Grythandril
Re: H4 Displaying a message during AI turn when an object is taking
Also noticed in the help page for scripting that its only for Quest huts, Quest gates, Quest Guards, Towns, armies, creatures and Heroes.
now the mines has the same facilities as the town but they I cannot find a way to display a message during the AI turn that your mine has been captured like that when your town is captured.
I have tried using these options at the start
Attacked: Allows you to script an event that will activate when an enemy army attacks the town.
Captured: Allows you to script an event that will activate after an enemy army conquers the town.
Victorious: Allows you to script an event that will activate after an enemy army attacks the town but loses the battle.
Encountered: Allows you to script an event that will activate when a friendly or allied army visits the town.
but none of these will display that message
now the mines has the same facilities as the town but they I cannot find a way to display a message during the AI turn that your mine has been captured like that when your town is captured.
I have tried using these options at the start
Attacked: Allows you to script an event that will activate when an enemy army attacks the town.
Captured: Allows you to script an event that will activate after an enemy army conquers the town.
Victorious: Allows you to script an event that will activate after an enemy army attacks the town but loses the battle.
Encountered: Allows you to script an event that will activate when a friendly or allied army visits the town.
but none of these will display that message
Re: H4 Displaying a message during AI turn when an object is taking
You can try a conditional that runs at the start of your turn each day, if green player has "artifact" then text Green player has "artifact", and have it step through all the colors. It would be tedious if you want this for more than a few artifacts. I used this whenever a critical artifact might be acquired or important hero was defeated by one of the AI players. It seems to work very well and I also have set variables that later help determine if victory conditions have been met. The script can also be written to account for neutral AI stacks defeating heroes.
Last edited by jeff on 29 Aug 2019, 23:50, edited 1 time in total.
Mala Ipsa Nova
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: H4 Displaying a message during AI turn when an object is taking
The tedious aspect can be taken away if you use the H4 Advanced Options Editor. Then you only have to write the script once and you copy and paste and just change the artifact (or whatever you need to change) in the pasted script.
Still haven't had a chance to take a look, but I think Jeff has given you some good leads
Still haven't had a chance to take a look, but I think Jeff has given you some good leads
Re: H4 Displaying a message during AI turn when an object is taking
I had to add these scripts when the victory conditions dictated the player defeat certain heroes. If an AI army defeated them or they got defeated by a neutral stack, then that condition couldn't be met. Those scripts were added as a map script and I have tested them repeatedly and they work.
Now I did also added other scripts telling the player that it occurred, relieving them of the requirement; that script also set the necessary variables ensuring the player could complete the map.
Now I did also added other scripts telling the player that it occurred, relieving them of the requirement; that script also set the necessary variables ensuring the player could complete the map.
Last edited by jeff on 30 Aug 2019, 23:11, edited 1 time in total.
Mala Ipsa Nova
Re: H4 Displaying a message during AI turn when an object is taking
1. Create time event (run every day if current player is human) "Check someone mines".How do you create a script to display a message when object has been taken by the AI?
2. In "Check someone mines" place calling trigger event "My owner is"
3. Place trigger event "My owner is" at mine.
4. In "My owner is":
Code: Select all
if Owner is computer then
Display "The mine has been captured by AI"
Remove Script
- Grythandril
- Leprechaun
- Posts: 19
- Joined: 06 Jan 2006
- Location: Grythandril
Re: H4 Displaying a message during AI turn when an object is taking
Thanks
I tried that and it worked only once but if i delete the remove the script then it displayed the message every day.
Is I will try this on a event next to the Pandora's box when the AI takes it.
Cheers
I tried that and it worked only once but if i delete the remove the script then it displayed the message every day.
Is I will try this on a event next to the Pandora's box when the AI takes it.
Cheers
Re: H4 Displaying a message during AI turn when an object is taking
There are ways to have the message occur again; so when do you want this to show and when would you want it to repeat.
Mala Ipsa Nova
Who is online
Users browsing this forum: No registered users and 0 guests