Hi, I'm trying to make various effects run via lua script for the purpose of roleplay. However, I keep running into the same problems with regards to changing effects via lua script.
If I try effects.world_bonus(effect_type_name), where effect is example Reveal_Map, it produces error: bad argument #2 to 'world_bonus' (got 'nil', 'string' expected). Why is there an argument #2? If I try to put a 2nd argument and put a random string in, it then says bad argument #2 to 'world_bonus' (got 'string', '(null)' expected).
When I try effects.player_bonus(player, effect_type_name), I get the same problem except it's now because of bad argument #3 instead of 2. I'm assuming the same problem exists for effects.city_bonus? How do I change effects via lua script then?
A side question: Is it possible to have a dialogue box appear for the player with "yes" and "no" choice for events which happen in-game?
Question: Lua Script Effects Module
Re: Question: Lua Script Effects Module
The function arguments are enumerated from 2, AFAIK. Have you assignedTemeria wrote: If I try effects.world_bonus(effect_type_name), where effect is example Reveal_Map, it produces error: bad argument #2 to 'world_bonus' (got 'nil', 'string' expected). Why is there an argument #2?
Code: Select all
effect_type_name = "Reveal_Map";
Not yet, both no such functionality for client- and server side.A side question: Is it possible to have a dialogue box appear for the player with "yes" and "no" choice for events which happen in-game?
Re: Question: Lua Script Effects Module
This would be odd, since the error message changes when I change effects.world_bonus(Reveal_Map, 'string') to effects.world_bonus(Reveal_Map, 5). Now the error is "argument #2 is 'number'; '(null)' expected."The function arguments are enumerated from 2, AFAIK.
Using your suggestion and making the argument a string:
Code: Select all
local effect_type_name = "Reveal_Map";
effects.player_bonus(find.player(0), effect_type_name)
At the moment, I'm trying to write an event which changes Gain_AI_Love by x amount, but I don't know how to change effects amount by lua. However, presently the problem is, can't even get a binary effect like Reveal_Map to trigger.
Re: Question: Lua Script Effects Module
Ah, you want to trigger effects? Sorry, they are mostly not triggerable with Lua, the effects module contains only checking functions that return the effect's current value and can't modify it. It is not done intentionally to keep the rules simple enough, especially for the AI. In theory, AI love may be made modifiable but actually it is not. Only the history-type culture can be changed from Lua (in the newer versions where it exists), you can try to tie effects to culture diapasones if you don't use other culture effects.
Re: Question: Lua Script Effects Module
That's a pity as it would help with modding and creating scenarios with story, which I think Civ 2 was quite good at. With regards to AI, I fail to see the relevance as event effects can be made to apply only to human for roleplay, and at any rate, if one is unhappy with its effects on AI, one can simply highlight it in the lua and delete the whole thing, versus making changes in the rulesets which might go on and affect multiple files. Thanks for replying.
Re: Question: Lua Script Effects Module
Wow, GPT-2 powered spam in the wild.
Re: Question: Lua Script Effects Module
Dafuq was that?!
--
* 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...
* 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...