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 Dec 22, 2011, 09:59 PM   #1
starter
Chieftain
 
Join Date: Dec 2011
Posts: 4
how to start golden age after certain tech discovered

Hey all, I am a naive learner on civ5 modding; and I want to write a mod where certain civilization could start a golden age when certain tech is discovered. However, my code doesn't work for some reasons. Hope I can get some suggestions from you.

For example, I want Isabella start a default-length golden age when Spain finds Archery. And here is my Lua script.
Quote:
local iTechArchery = GameInfo.Technologies["TECH_ARCHERY"].ID

function TechResearchedListener(iTeamId, iTechId, iChange)
pTeam = Teams[iTeamId]
if (pTeam:GetLeaderID() == GameInfo.Leaders["Isabella"].ID) then
if (iTechId == iTechArchery) then
for pPlayer in Players() do
if pPlayer:GetTeam() == iTeamId then
pPlayer:ChangeGoldenAgeTurns(pPlayer:GetGoldenAgeM odifier()*GameDefines.GOLDEN_AGE_LENGTH)
end
end
end
end
end

GameEvents.TeamTechResearched.Add(TechResearchedLi stener)
Thank you for your help!!!


P.S. Perhaps as you noticed, I don't know how to find playerID given a teamID, and that's why I used a for sentence. Is there any function I can use to directly get player ID from a team? Thank you~


Moderator Action: Moved to the main forum.
Because the tutorials subforum is only for tutorials .

Last edited by The_J; Dec 23, 2011 at 07:21 AM.
starter is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > how to start golden age after certain tech discovered

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 11:32 PM.


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