Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: Heroes 4 script question
Thread: Heroes 4 script question
vulcancolak
vulcancolak


Famous Hero
posted June 17, 2020 03:06 PM

Heroes 4 script question

Hello everyone. I want to create system like Heroes 6 territory system.

When the player captures town X, set ownership of ore mine bla bla and gold mine bla bla

I have tried many things but i haven't succeed yet. Is there a way to do that?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Promising
Known Hero
posted June 18, 2020 05:50 PM

I haven't really done much scripting on mines, so I would have to take a look myself, but you could try the triggerable events on your mines.

Create a triggerable event and see if you can "change owner" of that particular mine in the scripting options. You'll need a variable (numeric) that you will set in the town captured event to determine which color you should change to.

Then on the town the mine belongs to, you can add scripting to the captured event that sets the color to the color that captured the town, and then call the triggerable event on your mines.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
TheUnknown
TheUnknown


Known Hero
posted June 18, 2020 10:20 PM

iliveinabox05 said:
I haven't really done much scripting on mines, so I would have to take a look myself, but you could try the triggerable events on your mines.


You are right on that one, and you can do this without variables.

When selecting event action, my advice is to try and always use sequence because it's easier to edit and reuse in the future.

1. Create triggerable events on the mine(s) for all player colors used in the game (at most 6 per mine)
2. Set effect to change owner to the color of the given player
------------------------------------
3. On the town that would influence the mines, create a captured event.
4. Create conditional action that checks if owner is certain color (at most 6)
5. For each of those conditions, trigger the corresponding color event from the mine ... here you can trigger the events of multiple mines or other objects like borders

If this still isn't clear, I can try and provide a simpler one color example

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
vulcancolak
vulcancolak


Famous Hero
posted June 20, 2020 11:13 AM

Honestly i will be happy if you can provide 1 example color because , haven't succeed it yet.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
TheUnknown
TheUnknown


Known Hero
posted June 21, 2020 07:12 AM

vulcancolak said:
Honestly i will be happy if you can provide 1 example color because , haven't succeed it yet.


https://www.youtube.com/watch?v=rg3Hx3TWYyw

I think this will help

Note that with scripting you can even prevent the enemies from capturing it, or refresh the owner of each new day to match the town owner.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
vulcancolak
vulcancolak


Famous Hero
posted June 21, 2020 10:59 AM
Edited by vulcancolak at 11:24, 21 Jun 2020.

Wait. It was so easy like this? Man, you can't imagine how many complex scripts i was tried for this. I will try it tonight and reply back. Thank you so much!

Edit: Ok here is the fast question. Both of us are playing. I have captured the town and gold mine is mine now. What happens when you capture the town as Player Blue?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
TheUnknown
TheUnknown


Known Hero
posted June 21, 2020 04:24 PM
Edited by TheUnknown at 16:26, 21 Jun 2020.

vulcancolak said:
Ok here is the fast question. Both of us are playing. I have captured the town and gold mine is mine now. What happens when you capture the town as Player Blue?


For now this will only work whenever player red captures or recaptures the town.

You have to add the logic for player blue as well.
1. In mine you have to add one more trigerragble event "Change Owner to Blue".
2. In town in the "captured" event "sequence", you have to press "new" and add one more condition for player blue just as you did for player red.

This way anyone that captures the town will capture the mine as well.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0247 seconds