Can one script contingencies for unit obsolescence? Mainly, I'm interested in making units obsolete based on certain events such as year or technological discovery.
Can one script contingencies for unit obsolescence? Mainly, I'm interested in making units obsolete based on certain events such as year or technological discovery.
I think it's possible for a technology to obsolete a unit, but I'm not sure about scripting it based on year or anything else. Interesting idea though.
I actually thought the opposite lol. I used to know a bit of LUA myself, how conditions work. However I'm unfamiliar with the functions here.
Make tech is very simple. You see my units in the signature. The Guard, Gens d'Armes and Leib-Karabiener I can only get with techs.
I did it, cause Prussia have from beginning the palast, so they would have from beginning guards, what I don't want. I will make it for hussars too (the standart hussars stay. The 3 others can be recruit after research tech). So I can decide, how my Army will looks. I plan the same for infantry too.
The techs need 4 rounds, but I must check it ingame, cause maybe it's to long.
Edictum mod adds new edicts to Rome II. http://www.twcenter.net / YouTube: Edictum Mod / Click here for Edictum Mod on steam
Vote Brain Slug for president.
That's the problem. My techs add only new units. I have a new pc and many problems to get run him, so I can't try many things at moment, but it's possible to script that. As the_vicar said, look for alpaca's script info.
I plan to create 2 periods for the prussians at first. Before 1740 and after.
If thats work, I do that for france too. Before 1763 and after.
Edictum mod adds new edicts to Rome II. http://www.twcenter.net / YouTube: Edictum Mod / Click here for Edictum Mod on steam
Vote Brain Slug for president.
If you take a look at Alpaca's script information post, he says something about being able to globally remove a unit from recruitment.
Maybe look into that?
Every day takes figuring out all over again how to live.
Quoting from Alpacas Script-o-Rama (currently page 2 of this forum):
So my very limited scripting tells me that this could work:
add_restricted_unit_record(<unit_key>)
add_restricted_unit_record allows you to remove a unit from being available for recruitment world-wide (similar to the SF units)
Parameters: Unit key as string (as it appears in the units table)
Example:
scripting.game_interface:add_restricted_unit_record("euro_expat_infantry_regiments_etrangeres")
remove_restricted_unit_record(<unit_key>)
remove_restricted_unit_record removes the restriction on a unit record that was previously set with add_restricted_unit_record
Parameters: Unit key as string (as it appears in the units table)
Example:
scripting.game_interface:remove_restricted_unit_record("euro_expat_infantry_regiments_etrangeres")
local function OnFactionTurnStart(context)
if conditions.TurnNumber(context) == 25 then
scripting.game_interface:remove_restricted_unit_record("euro_expat_infantry_regiments_etrangeres")
end
end
sadly the turn number and faction name conditions are the only ones i know, i guess a tech-linking is what you are looking for,
and propably a national lockout, but that can be worked around by giving national units.
Hi all, I was directed here by erasmus so I shall post here then.
Would anyone know a way to do changes for Textures only, there are plenty of links for cannon shot types i.e. advanced grapeshot, (removing old types) and for removing units and for including new units (i have done it myself at least twice)
but to allow new skins for units as time goes on, the easiest way would be to link it to research. I am thinking of this in terms of naval marines. i.e. adding and removing a texture for late game rather than for early game.
In this case instead of using a script to remove grapeshot and allow advanced grapeshot, would there be a way to remove a model and replace it with another model??
I have no knowledge of coding, so I am simply stumbling around in the dark
Thanks if anyone can help
Rusty
ALSO DEVELOPERS CAMERA
Pessimism is a term used by Optimists, to attempt to discredit those who see the world as it really is!
The condition you're looking for is FactionTechExists, it takes three arguments: A faction ID string, a unit ID string and a faction event context. Otherwise the script LK posted should be alright, only for disabling a unit you need to use the add_restricted_unit_record command
Last edited by erasmus777; June 28, 2009 at 05:18 PM.
May I ask if there is a similar one for Textures, not just units?
Apologies if this is redundant.
ALSO DEVELOPERS CAMERA
Pessimism is a term used by Optimists, to attempt to discredit those who see the world as it really is!
No, putting scripting.lua into a pack is a bad idea because which one is used depends on the timestamp of the file on the disk - so if a player reinstalls after you released your mod chances are they won't see the scripted changes. That's why APE:TI is overwriting the vanilla file.
And no, you can only create new units with a different texture but not change textures directly.
Did someone try it? I dindn't have time yesterday.
Thanks alpaca for support.
Edictum mod adds new edicts to Rome II. http://www.twcenter.net / YouTube: Edictum Mod / Click here for Edictum Mod on steam
Vote Brain Slug for president.
damn, I apologise Alpaca, I meant models, not textures, I.e. early and late models not early and late units.
But from your last comment I take it that this is the same is it not?
For naval battles the models is all you can change, not units, unless...
Two units, twice the work, one with a different model of crew than the other.
ALSO DEVELOPERS CAMERA
Pessimism is a term used by Optimists, to attempt to discredit those who see the world as it really is!
Yeah, but there are ways to make this easy. I found an awesome freeware app for editing tsv files:http://csved.sjfrancke.nl/index.html. It's what I use for the most part now. Open and save your tsv file as "All files '.*'". If only the first column shows up, press add column as many times as you need to see the rest of the table. For long entries such as the loc file, double click on the cell, then add rows to see all the text at the same time.
Among the things you can do with this program is add prefixes to existing entries, meaning you could add "early_" onto all the names in unit_stas_land in 5 seconds. You could do that for all the files, so it wouldn't take long. There's also a plug-in for batch renaming files in GIMP and a built-in one for PS, so you can quickly change the file names for textures too.
Last edited by erasmus777; June 30, 2009 at 08:25 AM.
Is there any way to tie this to a specific faction?
That is, the way I'm reading the script you provided, it only applies to the first faction that researches the tech, and then the effects are global, right?
So, if I have 2 units line_infantry and line_infantry_2, with line_infantry being obsolesced by researching some generic infantry_reforms tech, and line_infantry_2 being enabled, then the effects are felt by every faction upon some random AI researching this tech before the player?
Because if there isn't a way to tie the call to a specific faction, e.g. event.has.happened(faction_name) or some such, then that would require a LOT of work to get around.
Every day takes figuring out all over again how to live.
You can make the tech for special faction, so only this faction would have this tech.
Edictum mod adds new edicts to Rome II. http://www.twcenter.net / YouTube: Edictum Mod / Click here for Edictum Mod on steam
Vote Brain Slug for president.