HoMM WoW IV; Detecting ownership of an external creature dwelling.

Maps and the art of mapmaking.
User avatar
Gintoki
Leprechaun
Leprechaun
Posts: 2
Joined: 16 Sep 2024
Location: Denmark

HoMM WoW IV; Detecting ownership of an external creature dwelling.

Unread postby Gintoki » 16 Sep 2024, 11:24

Hi

I'm in the midst of making a map and am trying to detect if a certain player owns a certain dwelling.

I do this by having a triggerable event in the dwelling building which when triggered, sets a boolean true/false variable depending on if the owner is human or not.
But this function do not work for some reason.
I've tested every part of my events and used "display message" to debug every step and the one that keeps on failing is the detection of ownership of the dwelling.

I'm not sure where I'm going wrong with this or whether it's an actual bug I've encountered.

Any help is really appreciated. Thanks!
Kind regards
Gintoki

Here's a screenshot of the triggerable event on the creature dwelling.
Image

User avatar
Pitsu
Round Table Hero
Round Table Hero
Posts: 1842
Joined: 22 Nov 2005

Re: HoMM WoW IV; Detecting ownership of an external creature dwelling.

Unread postby Pitsu » 16 Sep 2024, 15:05

Has been some time from H4 scripting. Is your problem not that triggerable events can only be triggered by other scripts and they do not run when player interacts with the object? You have placed events around the dwelling, do you have the placed events scripted to trigger custom event named "check_owner"? Would it be a solution? Sure, the placed event should not disaspear after the first time then... You could also have a continous event under map properties, it should run the script continously (better remove the messages, as they will be displayed non-stop)
Avatar image credit: N Lüdimois

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 787
Joined: 21 Jul 2014

Re: HoMM WoW IV; Detecting ownership of an external creature dwelling.

Unread postby iLiVeInAbOx05 » 16 Sep 2024, 15:08

I can't remember the exact bug, but I believe the "is owner" script just doesn't work on dwelling events.

The way you can make this work is by setting a specific player color on the "General" tab of the event, so that the event only runs for a certain player. If you want human or AI, those "run for" check boxes work as well. You won't need to do any checking, since you'll know the event only runs for a particular player or human / AI.

Then you'll want a map wide continuous event (Campaign->Map Properties, events tab, continuous events) that calls your triggerable event to set your owner variables. Then you can do whatever you need to if the variables are set.

If you want an example of what the full scripting looks like, you can use the H4 Advanced Editor. Create an empty map and put a dwelling on it. Then open the map with the advanced editor and add the "Flag All Dwellings" win condition.

If you don't have the advanced editor, you can get it here.

Hmm, I think actually I haven't released the updated version that has the special win / loss conditions, so you'll need to try what I said above yourself first, and then hopefully I can finish the things I've been working on so that I can release the latest.

User avatar
Gintoki
Leprechaun
Leprechaun
Posts: 2
Joined: 16 Sep 2024
Location: Denmark

Re: HoMM WoW IV; Detecting ownership of an external creature dwelling.

Unread postby Gintoki » 16 Sep 2024, 17:18

Thanks for the replies! :)

@Pitsu, the event is triggered as it should, it's just the owner detecting part that apparently is bugged and don't work.

@iLiVeInAbOx05, now you mention how to do it in a more cumbersome way, it reminds me that I've dealt with this bug before and had to do it a more tedious way than else.
I've made a map containing all falgable structures and each has a triggerable scrip that relinquishes them from their owner, shold the current owner meet its demise. (same as how it is in H3 where the flagable structures revert to neutral upon owners death)
Originally I wanted to make the script triggerable and just a general one that would check if the owner was alive or not.
But I ended up making a triggerable event for each player color and then have a global continous event monitor each player and trigger the corresponding event in the flagable structures.

It indeed seems as the "check owner" function does not work on dwellings. Sadly. I would love to implement town dwelling increase per external owned dwelling but havn't found a workable method due to this bug.

Also an additional question: Is there any complete list of all scripting bugs in H4WOW?
I know there's a bug with quest generated battles and their win/loose branches, where it does not matter who wins, it will always trigger the same branch.

And yes, I have that editor, thanks! :)

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 787
Joined: 21 Jul 2014

Re: HoMM WoW IV; Detecting ownership of an external creature dwelling.

Unread postby iLiVeInAbOx05 » 16 Sep 2024, 18:12

Gintoki wrote: 16 Sep 2024, 17:18 @iLiVeInAbOx05, now you mention how to do it in a more cumbersome way, it reminds me that I've dealt with this bug before and had to do it a more tedious way than else.
I've made a map containing all falgable structures and each has a triggerable scrip that relinquishes them from their owner, shold the current owner meet its demise. (same as how it is in H3 where the flagable structures revert to neutral upon owners death)
Originally I wanted to make the script triggerable and just a general one that would check if the owner was alive or not.
But I ended up making a triggerable event for each player color and then have a global continous event monitor each player and trigger the corresponding event in the flagable structures.
Yep, I'm pretty sure that's the way I did it for the "Flag all dwellings" victory condition. Need a triggerable event for each color with that color checked for run the event for where you set all your boolean variables. Then the continuous event calls each triggerable event, and then you check your variables and perform any actions.

In your case, you would then need a second triggerable event for each player color that changes the owner to neutral. You would call that in your continuous event if the player was defeated.

Actually you wouldn't really need the first event to set any variables based on the owner, since the triggerable event would only run for the player color that owns it. All you would need to do in your continuous event is to check if the player was defeated, and then call the triggerable event to change the dwelling owner to neutral for that player color. Still good practice though and gives you more control using the boolean variables.
Gintoki wrote: 16 Sep 2024, 17:18 It indeed seems as the "check owner" function does not work on dwellings. Sadly. I would love to implement town dwelling increase per external owned dwelling but havn't found a workable method due to this bug.

Also an additional question: Is there any complete list of all scripting bugs in H4WOW?
I know there's a bug with quest generated battles and their win/loose branches, where it does not matter who wins, it will always trigger the same branch.

And yes, I have that editor, thanks! :)
You can still implement that since it is possible to detect dwelling owners. In your continuous event you could set a numeric variable to 0 (one for each player color), then call your triggerable events to detect dwelling owners. They can increase the numeric variable by 1. Then on towns you would add logic that uses those variables and then increases dwelling populations.

It's a lot of scripting, but if you're using the advanced editor then you can copy / paste events and scripts, which will greatly reduce the time it takes :)


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests