Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
I'm trying to change some diplomatic agreement effects, but I cant find their effects..
I'm looking mainly for make protectorade/ally events, where could I find them?
Most diplomatic stuff is hardcoded. Any diplomacy editing via scripts would involve setting up a listener (for when certain factions attain the wanted diplomatic stance towards each other) and when the conditions are met, apply some sort of effect. Though apply db based effects from scripting isn't straightforward.
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Well that could work, I just want to give military access to allies and protectorates, making it that way I could even make it happens only between AI factions to avoid posible human exploits..
When you said a listener you mean a background process like a trigger that is waiting for some conditions to be executed?
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
I'm not 100% sure if this is what you want, let me know.
I've added comments just to make things that bit easier You'll have to fill the factions table in manually; I have conflicting information as to whether or not a function to return living factions exists in S2 or not (and right now I can't check it). The table has some NTW factions in it, just so you know how to fill it out.
Notes:Code:local factions = {"prussia", "britain", "austria", "russia"} local TCS_Diplomacy_Variable_Check = nil --We need to loop through the factions twice so we can get two different names --during any one iteration of the loop for i = 1, #factions do for e = 1, #factions do --Shut down all military access between the given factions scripting.game_interface:force_diplomacy(factions[i], factions[e], "military access", false, false) --Check the factions diplomacy stance, assign it to a variable TCS_Diplomacy_Variable_Check = CampaignUI.RetrieveDiplomaticStanceString(factions[i], factions[e]) --If they are allied then.... if TCS_Diplomacy_Variable_Check == "Allied" then --Allow military access scripting.game_interface:force_diplomacy(factions[i], factions[e], "military access", true, false) end end end
- It's much more difficult to check if they have a protectorate agreement in place as it uses a different function with output that is far harder to check against (the other faction outputs a big block of strings rather than just one, and isn't even in a table format). Anyway, being allied covers most of the situations.
- An "end" gets cut off on my browser by the bottom of the code box, watch out for it
What were your ideas in regards to the player? I haven't factored that in yet.
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Thanks a lot!
It seems we can't use the diplomatic agrement trigger like in M2TW so we have to check all factions every turn even those destroyed..
About "shutting" down previous status, that would make non allied factions loose their agreements.. or you can only ask for military access when allied?
To make it works with protectorates we should add if TCS_Diplomacy_Variable_Check == "Allied" or TCS_Diplomacy_Variable_Check == "Protector" or TCS_Diplomacy_Variable_Check == "Patron" , isn't it?
About the player I was thinking to make it works only 1 way.. AI factions get military access, but Human player should have to ask for it, but if the penalties for breaking an alliance works I shouldn't be worry about human exploiting it happily
Last edited by Thorn; June 05, 2011 at 02:34 PM.
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Ouch, I was editing my post when you answered, I was adding this:
About "shutting" down previous status, that would make non allied factions loose their agreements.. or you can only ask for military access when allied?
To make it works with protectorates we should add if TCS_Diplomacy_Variable_Check == "Allied" or TCS_Diplomacy_Variable_Check == "Protector" or TCS_Diplomacy_Variable_Check == "Patron" , isn't it?
It doesn't cause already existing statuses to be lost, it simply blocks the diplomatic offering.
As I said above, the Protectorate information comes from a different function that outputs a large string such as this:
As that's all the one string, it's very hard to pick out the relevant information.Code:Protectorate Trade agreement Grants military access (indefinite) Has military access to your lands (indefinite)
Remember, I'm speaking from a NTW standpoint here. Things may be different in S2, but you'll have to log the functions yourself. There's a section in the OP about that if you are interested
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Oh.. I see.., but then protectorate grants military access by default... I should take a look on that, because then the problem is the dumb AI not helping its allies...
I can see a full Imagawa stack waiting at Tokugawas frontier while Oda armies are invading it, so I thought they had no military access, but maybe I'm wrong.
Thanks for the info
I am using the following random number generation method, which seems to work very good. It is partially your method, so thanks T.C.
'
Code:local num1,num2,num3,num4 num1 = os.clock() num2 = math.modf(num1) num3 = math.ceil((num1-num2)*10000) math.randomseed(num3) num4 = math.random(a,b)
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Three questions (Ugh. Shameful display - sorry for the bother. I knew I should have taken more compsci when I had the chance...)
- If I want to get into the details of the event.lua script, how do I go about doing that? In particular, I'd like to see how a few of the events are designed.
- If I wish to code in my own custom event (mostly just displaying text for narrative purposes), is there an approximately hard-coded event that I can clone and modify?
- How do I code dilemmas? Is it basically just a mission with yes/no and different parameters assigned to each, or is a dilemma a different thing altogether?
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Mm, as always, I tend to be a bit overly ambitious when coming to these things. Blame it on the fangirling. But pretty please? I promise I'm teachable .
I've tried your tutorials, and downloaded/wrote a number of scripts to play with. I can do a lot of the simple things (giving units, adding money, even custom battles with a bit of help from .Mitch.). What else should I be trying out?You need to start with some basic stuff until you get familiar with Lua; what you are asking is very complex and would take me a while to write. If you have no experience with Lua I doubt it would make any sense at all to you.
I think I've actually made some headway. All of the event text and things are located conveniently in the local_INSERTLANGUAGEHERE. There is one for the titles (event_log_descriptions, message_event_log_descriptions) and another event for the text itself. Given what I'm trying to do is mostly narrative-based, I'd really like to know how an event is actually put together.
Thanks again!
I misread what you were trying to do, it's fairly simple after all
Well if I was building an event for Napoleon I'd add an entry in the events table in the db. Then you'd have to add an entry in data/events.lua. That's for a historic event.
You can't build a custom event such as OnFactionTurnStart, but you can use these events to be very specific, mainly by using stuff like context.string as an argument. But you'd have to log context.string first to see what it's output is.
You'll need to be a bit clearer about this, I'm not sure what you're getting at:
- If I want to get into the details of the event.lua script, how do I go about doing that? In particular, I'd like to see how a few of the events are designed.
Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
My Tools, Tutorials and Resources
The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell
Thanks for the help, T.C! I'll be fiddling around when I get home tonight.
Ah. Alright. Man, this isn't making our lives easier at all...You can't build a custom event such as OnFactionTurnStart, but you can use these events to be very specific, mainly by using stuff like context.string as an argument. But you'd have to log context.string first to see what it's output is.
Oh. What I mean is that I'd like to see for myself regarding the functionality of a few of events cited there - DummyEvent, DuelDemanded/DuelFought, the differences between HistoricalEvents, Historical_Events and HistoricalCharacters. That sort of thing. I went into the scripting.lua file but couldn't find any details as to where they were, nor can I find examples (sometimes you can find a lot of things in the tutorial's scripting. )You'll need to be a bit clearer about this, I'm not sure what you're getting at:
I think for any serious scripting effort, we need a list of functions we can call (including effects etc.) from a script. I believe for coding ease, a lot of functions were allowed for script calls. We just have to find them out
But I have no clue how. What are the chances that CA releases this information to us?