Newbie Modding Questions

Do you want to help out with Freeciv development? Then check out this forum.
Eusebio Ptolomeu
Posts: 27
Joined: Sat Oct 07, 2017 1:51 am

Re: Newbie Modding Questions

Post by Eusebio Ptolomeu »

I've been taking a look at the link about the Lua resources provided by cazfi. I haven't the chance to put it into practice yet, but reading the list let me give a very rough idea of how to implement the "revolting cities" feature.

If I'm not mistaken, there are no specific Lua commands to transfer ownership of a city from one player to the other, so this wouldn't be possible in a direct manner. One way to achieve this transfer of ownership, ina very indirect manner, would be to do so:

1- Find a city which has been in disorder for some time (I think the find and city modules would be useful here).
2- Try to read all that is possible about this city (name, tile, size, buildings and any unit which is homed to this city) and store it for later use.
3- Destroy the city.
4-Create a new city (after creating a new player, of course) using all the data gathered by the last step, also add a government center to this city. The edit feature would be useful here).
5- Take all units homed in the older city, make this new city these unit's new home city, and transport them to this new city.

Of course, this method is a little more convoluted than a simple "transfer ownership" would be, and I have the feeling it wouldn't be very efficient memory-wise, maybe. But in terms of gameplay, it should give roughly the same results in terms of gameplay, wouldn't it?
Posts: 2913
Joined: Tue Jan 29, 2013 6:54 pm

Re: Newbie Modding Questions

Post by cazfi »

One thing you should do, now that you have a clearly defined need for an addition to the lua API ( method to transfer city from a player to another ), is to open a ticket about it ->

With the current freeciv versions you may need to use the method you described, but we should make it better for the future versions.
User avatar
Posts: 1278
Joined: Mon Jan 13, 2014 11:13 pm

Re: Newbie Modding Questions

Post by Corbeau »

cazfi wrote: Mon Jun 26, 2023 8:14 pm
Corbeau wrote: Mon Jun 26, 2023 4:03 pmIf you'd like to take part in an active fork coding community
There's plenty of things to implement in freeciv itself, if one is ready to contribute ;-)
It all depends on the level of the cntributor ;) For example, even in my wildest dreams there is no way in hell I'd be able to contribute to the code. Rulesets are my level. And since I'm doing rulesets, why not do it for the multiplayer community so I can play them with other people? :)
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Post Reply