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
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?
http://www.twcenter.net/forums/showthread.php?t=425548
http://www.twcenter.net/forums/showthread.php?t=428786
If you know how, you can get lua to tell you all sorts of stuff![]()
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
You gotta tell us how to use getfenv() mateYou need to do this!!!
The links are very promising, but tons of information there is missing, since it is probably too much to write or inaccessible. What are our options?
Let me know if you don't understand any of this:
Code:local test123 = getfenv() io.output(io.open("data/Region Turn Log.txt","w")) for k, v in pairs(test123) do io.write(tostring(k).."\t"..tostring(v).."\n") if type(test123[k]) == "table" then for K, V in pairs(test123[k]) do io.write("\t\t"..tostring(K).."\t"..tostring(V).."\n") end end end
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
Will check it out. So far it looks OK. Will return once I try it.