Majesty Gold HD

Majesty Gold HD

Customize Majesty!
Create and upload new Quests and Mods for Majesty HD!
Defend Building Problem
I have noticed that the commands like:

if ($defend_building(thisagent,"Rangers_guild") == False)

In the decision tree makes a hero defend enemy kingdom building as well. I have noticed Barbarians and Warriors of Discord do this, it looks like their attacking it, but they seem to end up killing themselves. Has it happened to anyone else?
Last edited by Blargh the 2nd; 20 Jan, 2020 @ 1:43pm
< >
Showing 1-2 of 2 comments
VikesRule 40 22 Mar, 2020 @ 10:52pm 
I have observed this as well. Looking at the $defend_building function:
function defend_building(agent thisagent,string whatbuilding) is boolean declare list bldgs; agent bldg; boolean Flag; begin // make a list of all buildings of type string // then see if any are under attack. // if so, send the hero to the closest one to defend if ( $ListObjects( thisagent,"building",-1, bldgs, #CheckTitles, WhatBuilding ) > 0 ) begin Foreach Bldg in Bldgs do begin If (Flag == False) begin if ($is_in_danger(bldg,thisagent)) begin $SpecifyIntent (ThisAgent, #Intent_Defending_Building); Flag = True; end end end end return Flag; end

During the building of the list, it looks like it doesn't differentiate between enemy/ally buildings. So if you add #MyPlayer, I think it would fix it and make it so it only defends buildings of the same team like so:
if ( $ListObjects( thisagent,"building",-1, bldgs, #MyPlayer, #CheckTitles, WhatBuilding ) > 0 )

Last edited by VikesRule; 22 Mar, 2020 @ 10:58pm
Blargh the 2nd 27 Mar, 2020 @ 8:10am 
Hey, thanks! I will try this out later.
< >
Showing 1-2 of 2 comments
Per page: 1530 50