GUYS Thank you so much for your replies.
Still not working, but before get in the codes, let me get this right!
If I move my marshal to the city, the window automatically pops up, without pressing the D key on the keyboard.
But the action still not showing! (edit: the city has 2 corruption)
I was talking about the D letter because of the "Bombard" actions (1,2 and 3). They have a range of 2,3 and 4 respectively.
And it is working properly. My friends and I are having a lot of fun (despite the fights with our wives).
But if there is another way to trigger these actions, please tell me! Pleeeease!!!
So, to make this right, I started over again, copied the entire civ2civ3 ruleset, and made only the following changes:
units.ruleset (added the flag "Lawman" and copy and paste the Dragoons unit,
changed to Marshall and associate with only ONE Flag, the Lawman)
Code: Select all
flags =
{ "name", "helptxt"
...
_("OneAttack")
_("Lawman")
}
; copied from Dragoons
[unit_marshall]
name = _("Marshall")
...
flags = "Lawman"
game.ruleset (removed the target_regs attribute)
Code: Select all
ui_name_user_action_1 = _("%sReduce Crime%s")
user_action_1_target_kind = "City"
user_action_1_min_range = 1
user_action_1_max_range = 1
user_action_1_actor_consuming_always = FALSE
[actionenabler_marshall]
action = "User Action 1"
actor_reqs =
{ "type", "name", "range", "present"
"UnitFlag", "Lawman", "Local", TRUE
"MinMoveFrags", "1", "Local", TRUE
}
effects.ruleset (added the Action_Success_Actor_Move_Cost with value 65535)
Code: Select all
[effect_action_success_move_cost_marshall]
type = "Action_Success_Actor_Move_Cost"
value = 65535
reqs =
{ "type", "name", "range", "present"
"Action", "User Action 1", "Local", TRUE
}
[effect_action_marshall]
type = "Output_Waste_Pct"
value = -50
reqs =
{ "type", "name", "range"
"Action", "User Action 1", "Local"
"OutputType", "Shield", "Local"
}
script.lua (calling the 'action_started_unit_city' because the action is at a city) (copied from sandbox, of course)
The message "Got here" only reveals when i disband the marshall, but since i dont have a User action 1, the YEAHHHH message is never read))
Code: Select all
function action_marshall(action, actor, target)
notify.event_msg(nil,nil,2,"Got here")
if action:rule_name() == "User Action 1" then
notify.event_msg(nil,nil,2,"YEAHHHHHH")
end
end
signal.connect("action_started_unit_city", "action_marshall")
Ignatus wrote: ↑Tue Jan 02, 2024 12:02 am
Have you tried forcing one with /lua cmd find.unit(...):perform_action(...) ?
Sorry but I am very noob in LUA, I tried type this in the chat box, playing the ruleset civ2civ3 and the marshall was on a tile adjacent to a city,
but of course this is not the correct way:
Code: Select all
/lua cmd find.unit("Marshall"):perform_action("User Action 1")
What am i doing wrong? What am I missing?
Thanks in advance guys, you all are amazing in this project