|
Thread: Heroes 4 script question | |
|
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?
|
|
iliveinabox05
Honorable
Famous 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.
|
|
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
|
|
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.
|
|
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.
|
|
vulcancolak
Famous Hero
|
posted June 21, 2020 10:59 AM |
|
|
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?
|
|
TheUnknown
Known Hero
|
posted June 21, 2020 04:24 PM |
|
|
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.
|
|
|