Hi SharpEyed,
thank you for your kind answer, sadly i don't think that you got what my problem really is.

Originally Posted by
SharpEyed
I already found this topic, well the thing is: this has nothing to do with my questions. In fact these are resources to help you write new lua script, and i have no real problem with that.

Originally Posted by
SharpEyed
2nd, those id's not seem related with scripts at all.
Those are just put there to keep them in order, so they won't mess up with each other.
And ID's not only exist on that table, there are a lot places they appear.
I think you missunderstood what i was talking about.
You are surely talking about PFM UI row numbers.
I, on the other hand, am talking about the id column which is quite rare, in fact even if i didn't checked all the DB tables i'm fairly sure this id column is pretty unique to trigger_effects.
Moreover i'd like to stress the fact that thess ids are not incrementals at all so i'm quite sure they are acting as foreign keys to associate the db to the script or something like that, but i could be wrong, maybe they are just useless or serve another purpose.

Originally Posted by
SharpEyed
3rd, well this is the hardest question.
But it seems like this: "If this happens, then this triggers" , if doesn't happen = it won't trigger.
Condition.
Yes exactly.
The script export_triggers.lua is basicaly a lot of functions implementations that return a boolean depending on conditions, then it calls these functions with tests (if statements) to determine if the following events should trigger or not a trait point gain for example.
Well, again, i have not problem at all with that being myself a dev, the issue is not understanding or editing lua scripts.

Originally Posted by
SharpEyed
So if you add new trait/s to the db table of traits, I don't think you will have to add them into script as well.
But then they will have the chance to appear any time, without any condition.
I don't think so because first it means that the function related to the trigger has to be defined in the script (which is not a problem if you are using a trigger that already exist like att_trig_faction_leader_age_old_player_only_not_horde
for instance ), 2nd if the event occurs you have to define in the function what will happend (like gaining x point in y trait with z% chance).
Well this is only speculative as maybe a new script can be generated by the game depending on the trigger_effects tablecontent , but i'm quite sure that's not the case.
Ok so now i'll try to be more clear and specific on what my problem really is:
Let's take for example the trait healthy (att_trait_all_physical_all_healthy)
One of the trigger to gain point in the trait healthy for you agent is to be in a region with low squalor.
So let's see how it looks in the db (trigger_effects table) :
3347 |
|
att_trig_agent_in_region_low_squalor |
|
att_trait_all_physical_all_healthy |
|
1 |
|
2 |
|
Which means that the trigger att_trig_agent_in_region_low_squalor has 2% of chance to increase the trait healthy by one point each turn the conditions are met.
Now let's take a look at the lua script and more precisely at the function related to this particular trigger:
--[[ att_trig_agent_in_region_low_squalor ]]--
function att_trig_agent_in_region_low_squalor_impl (context)
return char_is_agent(context:character()) and context:character():has_region() and context:character():region():squalor() < 30 and context:character():model():turn_number() > 5
end
events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
if att_trig_agent_in_region_low_squalor_impl(context) then
effect.trait("att_trait_all_physical_all_healthy", "agent", 1, 2, context)
return true
end
return false
end
The first function ( att_trig_agent_in_region_low_squalor_impl ) check if the caracter has been in a region with less than 30 squalor for more than 5 turns and return true or false according to these factors.
The second one calls the previous during a test, each turn, and if it's true then call a method that has 2% chance to add 1 point to the healthy trait of your agent.
And here is my real problem:
effect.trait("att_trait_all_physical_all_healthy", "agent", 1, 2, context)
these values passed as parameters to the method trait (%=2 and number of point = 1) are hardcoded and i can't imagine how the values in the trigger_effects table are supposed to overwrite them.
If it used variables instead of hardcoded integers it would be totally clear but like this i just don't get how this is supposed to interact.. That's why i was thinking the id column of the trigger_effects table plays a role in that.
Maybe i'm looking at it the wrong way but it completely screws my brain.
I know Hellbent and Dresden worked on something similar with Rome 2 (http://www.twcenter.net/forums/showt...DLC-Compatible) maybe they can enlighten me.
I'm sorry if i don't express myself clearly but as you could easily see: English is not my mother tongue..
I'd like to thank in advance all the people that will take the time to read my question and try to answer it.