Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization

Notices

Reply
 
Thread Tools
Old Jan 18, 2012, 10:44 AM   #1
wuTz
Warlord
 
wuTz's Avatar
 
Join Date: Jan 2012
Posts: 104
Science Free promotion after tech research

I think, this could be an interesting element for mods...

My question:
I want the scout to have the promotion sentry after discovering tech optics. How is it possible?

Could it be similar to the allow_embarkation element?

Do I have to create a lua script or is it possible via xml/sql?

My idea (not the best)->
Sentry_promo requires optics_tech ()
Give scout free sentry_promo from gamestart
Possible? Thanks for your advice
wuTz is offline   Reply With Quote
Old Jan 18, 2012, 12:12 PM   #2
Pouakai
Tangaroa
 
Pouakai's Avatar
 
Join Date: Jun 2010
Location: New Zealand
Posts: 4,671
Images: 24
I just took a look at the optics entry in Civ5Technologies.xml, and that doesn't use a free promotion tag, instead it uses <AllowsEmbarking>true</AllowsEmbarking> . So I'm not quite sure as to how this could be done, although I have a suspicion it would involve LUA
Pouakai is offline   Reply With Quote
Old Jan 18, 2012, 02:47 PM   #3
Spatzimaus
Mad Scientist
 
Spatzimaus's Avatar
 
Join Date: Sep 2005
Location: Los Angeles, CA
Posts: 3,062
Quote:
Originally Posted by Pouakai View Post
So I'm not quite sure as to how this could be done, although I have a suspicion it would involve LUA
Correct. There's no way to do this in XML, outside of the obvious kludge (make a low-cost National Wonder that gives the promotion to all units and make that NW require the tech you want). In Lua, it's fairly easy to do, though, as there's a Lua event that triggers when a tech is researched. The problem is, the Lua method's great if you want a one-shot effect (give every unit you own a free promotion when you reach tech X), and isn't so good for persistent effects (once you have that tech, every new unit will get that promotion from then on). You CAN tie this into the SerialEventUnitCreated function, to where all new units would gain the promotion as long as you have that tech, but that wouldn't help units that already exist, so you'd need two separate Lua triggers to do this right. Just be aware that SerialEventUnitCreated triggers multiple times (when a unit is created, when a unit embarks, when a unit disembarks, when an air unit rebases, and so on); since you only care about giving the promotion and never taking it away, this isn't really a problem.

Or you can combine the two approaches: in XML, make a "hidden" national wonder that gives the promotion to all units. When you research a certain tech, the Lua code triggers and an invisible copy of that wonder is placed in your capital. From then on, all units (both the ones you already had and the ones you'll build later) will have that promotion because the wonder will continue to exist. The downside to the wonder method is that if your capital is conquered, the building would be destroyed and you'd have no way to get it back unless you added ANOTHER Lua check. You could also do this with Policies, which'd have the benefit of being "intangible" and unable to be destroyed, but that has a whole slew of other issues. Projects would be ideal, as those are linked to the player (like Policies) and aren't destroyable, but Projects don't have any real effects in XML, so you'd still need Lua to place the promotions, and if you're doing that, then why bother with the Project?
__________________
Once upon a time there was the Ages of Man mod set. Then Firaxis broke it. But thanks to the DLL efforts of the community, the mods shall rise again!
Spatzimaus is offline   Reply With Quote
Old Jan 18, 2012, 04:20 PM   #4
wuTz
Warlord
 
wuTz's Avatar
 
Join Date: Jan 2012
Posts: 104
Hm. So I will have to learn about LUA
That will take a while, because I just started modding and I am already gratified when XML/SQL works

Thank you for your advice, spatzimaus.
wuTz is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > Free promotion after tech research

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 05:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR