Maybe a building that is not otherwise buildable. That would better show up in the city dialog.Ignatus wrote: ↑Tue Jan 02, 2024 12:02 amYes, you need to put an "Output_Waste_Pct" effect there, just you need some different trigger for it that you most probably will need Lua to put. Since we don't have city flags or counters settable yet, you probably will have to put an extra on city center that will mark reduced crime in that city (maybe you also want to remove that extra in "city_destroyed" callback). List that extra in the effect's reqs.
'User Action 1' not working
Re: 'User Action 1' not working
-
- Posts: 23
- Joined: Mon Jan 01, 2024 3:22 am
Re: 'User Action 1' not working
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)
game.ruleset (removed the target_regs attribute)
effects.ruleset (added the Action_Success_Actor_Move_Cost with value 65535)
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))
but of course this is not the correct way:
What am i doing wrong? What am I missing?
Thanks in advance guys, you all are amazing in this project
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"
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
}
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"
}
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")
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")
Thanks in advance guys, you all are amazing in this project
Re: 'User Action 1' not working
With both min and max range 1, the action works only when the unit is adjacent to the city, not when inside the city (including when entering the city tile)
Re: 'User Action 1' not working
I meant, use chat window to test if the action works at all even if not shown in the interface. Place a marshall next to a city, record ids of the marshall unit (say, 1234) and the city (say, 1357) and type in the chatleo.priori wrote: ↑Tue Jan 02, 2024 4:14 am but of course this is not the correct way:Code: Select all
/lua cmd find.unit("Marshall"):perform_action("User Action 1")
Code: Select all
/lua cmd find.unit(nil, 1234):perform_action(find.action("User Action 1"), find.city(nil, 1357))
-
- Posts: 23
- Joined: Mon Jan 01, 2024 3:22 am
Re: 'User Action 1' not working
Just like a explorer, a diplomatic, a caravan or others when they are adjacent to a city and will enter to the center. The message pops up with the options (Establish Trade Route or Investigate city, etc).
Thats exactly what i want. I want the action 'User Action 1' in this list.
Dear Lord i will take at least a decade to find out this command.
But i am not so lucky.
Im using 3.1 beta4 Qt-client and my midclick not showing the id.



The X,Y helps?
I could try to show the id using script.lua. Something like this inside the function action_mashall
Code: Select all
function action_marshall(action, actor, target)
local id_unit = actor.getId()
local id_city = target.getId()
local msg = string.format("Unit: %d City: %d", id_unit, id_city)
notify.event_msg(nil,nil,2,msg)
end
Re: 'User Action 1' not working
That's from some other API, ours has actor.id
And that won't work if you need ids before you run the action. Likely, you can get ids with something like (sorry, didn't test )
Code: Select all
for p in players_iterate() do
notify.all("%s's units:", p.name)
for u in p:units_iterate() do
notify.all(" %4d %s\t%d,%d", u.id, u.utype:rule_name(), u.tile.x, u.tile.y)
end
notify.all("%s's cities:", p.name)
for c in p:cities_iterate() do
notify.all(" %4d %s\t%d,%d", c.id, c.name, c.tile.x, c.tile.y)
end
end
Re: 'User Action 1' not working
Yes. Like, we could put a requirement
Code: Select all
{"type", "name", "range", "present"
"None", "", "Local", FALSE}
Code: Select all
target:create_building(find.building"Reduced Crime")
Re: 'User Action 1' not working
Try setting min range to zero, so the action is legal in the very city tile too.leo.priori wrote: ↑Tue Jan 02, 2024 12:03 pmJust like a explorer, a diplomatic, a caravan or others when they are adjacent to a city and will enter to the center. The message pops up with the options (Establish Trade Route or Investigate city, etc).
Thats exactly what i want. I want the action 'User Action 1' in this list.
Re: 'User Action 1' not working
README.effects documents Output_Waste_Pct as:leo.priori wrote: ↑Mon Jan 01, 2024 4:05 amCode: Select all
[effect_reduce_crime] type = "Output_Waste_Pct" value = -50
So I think you mean "50", not "-50"Output_Waste_Pct
Reduce waste by amount percent.