Modding Question as to the Possibility of Python in changing Traits for a new Civ

orinsul

Warlord
Joined
Nov 13, 2006
Messages
159
New Civ Proposal followed by the Question thats being asked so as whats proposed might become possible.

Fellowship Elves

Alright so ive been thinking for some time about a new Civ based off the Elves, pretty much since i first read the elven backstory, the court as it used to be or atleast a group of people trying to bring it back to what it used to be. And alot of it came from disagreement with the notion that all the winter elves would suddenly give up their religious beliefs because their queen said so, that a people whos fundamental quality is deception and those cruel liberties that elves are famed for would do anything that their queen ask of them is enough without anything as important as that, that some would have stayed with the leaves atleast in the privacy of their homes and from that the idea of a civil war within a civil war, a rebellion which is not in league with the established rebels and is just as oppose to what they stand for as they are towards the authority. And on the other side with have the Summer Elves who now claim the right to rule in perpetuality, even with the threat of Faeryl would that have united support, would there not be those who would not suffer it, be them traditionalists or mere discontents.
The simple fact is that i felt that there was a need for a Thrid Elven civilisation, one which maintained the Fellowship, the strucuture of the old united Elven empire, the Dual-monarchy that never tuched but for the fingertips of those wirling and tumbling giants, the mad government of the Elves which could only be a possibility to elves to whom it would be the most rational thing in the world. And for atleast some Winter Elves to hold Sucellus in their hearts too, Nature worship is the everything, not just the light of day but the dead of night too and all that happens in it, thats kind of the point. No break from it is needed to be evil, nature worship isnt neutral its simply good and evil to same degree as each other, not the half way point but black and white at the same time without being gray and once it makes that step and mixes well then the whole society crumbles and from a merely theological viewpoint you need to have both, it winter never comes then the bears would never have the time to dream anyway.
Back to the point, once i had come to the conclusion that this new Civilisation was needed for the game i set myself the task of making it and soon came across what might have been a hurdle but on closer inspection turned out to be a mountain. I couldnt for the life of me figure out how to do the one thing, simple in theory, that was vital for it, the spirit and heart of it. So this is all to ask here how it might be done.

THE QUESTION

Is there an easy way to have two traits that switch between each other every six [maybe twelve] turns or so. One the Summer Court which grants the Summerelf promotion to all created units and the other Winter Court that does likewise with its own, and perhaps a minor bonus or two, watered down variants of the traits of the Courts who are theoretically switiching in and out. [maybe including dex. and sinsiter bonus' as well or just artistic/deceictful modifers], I figure witht he existance of the insane and adaptive traits it must be possible but it looks as though pythons responsible for it and well that might as well be a snake for how much trouble you get in for messing around with it even if youre less likely to get eaten.


Also if anyone else has already done this thatd be brilliant but i looked around and saw an attempt with civics but not this and this to me atleast seems the way to do it, and maybe it cant be done but it might so see, with the asking.


heres the rest of the brainstorming and blind writing towards the new Civ, what im trying to get at, and once its done, possibly with just the singular queen leaderheads if the dual-switching cant be managed [as it could be an expedition lead by one of behalf of the whole as given the size of the map its plausible that its not the whole world but rather a so-far empty region of the world to be divided between the nations already established elsewhere.
Spoiler :

The Fellowship Court

Those Elves who reject the legitimacy of the two Queens and stand for the Restoration of Elven Unity under the Fellowship Court.

The King

While the true leadership and power in the Fellowship was always held by the Queens the King was the centre-point of the Elven Government, the one offical who did not change with the seasons, the one fixed star. With the Duty to see the smooth running of the state, enacting the Queens' decisions into law, overseeing the transistions and when it was required mediating between the summer and winter courts...
His posistion is specific to the unique nature of the Elven state and so it cannot without great difficulty be explained in human terms but for a rough allorgy to allow you the reader to 'get a grip' of his role might be to say that while the minister and policy change with each new government the civil service remains the same and the King of the Elves was the supreme civil servant, the entire beaucracy in the body of one man.
-Extracts from Walwain Leigh's A History of the Elves


Rivanna the Wrath [does she already have a backstory? if not here is one that might do]
Winter Queen [Fellowship]
and once Chancellor of the Winter Court and Lady of the Drax Aulundae.

Once the Ruler of an Entire Continent in the name of the Winter Court [Unseelie], albiet the empty and barron frozen wastes around the pole but it was still a prestigeous title. During the Summer Months when her lands were habitable She and her people toiled to work some life from the land and she was known by her people as a just and capable ruler, if a little autocratic. When Autumn came and the closing of the Summer Court her people headed south and became the Army of the Elves as all the Fellowship Court turned with the seasons and she took her place in the Winter Court itself as one of the closest, if not trusted, advisors to Faeryl Viconia, the Winter Queen. So it had always been and so would it always be.
But then the Age of Magic came to an end and the Fellowship was broken and the court sundered in two and plunged into War. Under the pretense of dealing with the crisis Viconia consolidated the Svartalfar onto herself and abolished the old feudal rights and ties and especially placing the military directly under her sole command. Betrayed and suddenly powerless Rivanna abandoned the Winter Court and sojourned in the wilderness of her empty realm. It is rumoured that during the frozen years she gave her hand in fealty to the Illians or even Mulcarn himself.
When the Svartalfar gathered together for the first time since to the winter she refused to aknowledge Faeryl Viconia as her Queen and with the backing of the others of the winter court who had little love for the Queen and her policies, whether though loyality to the old religion, petty rivalries or the opportunity for self-gain, put herself forward as the next Queen of the Svartalfar and the Winter Court. After her failed coup she and those who had stood with her chose a self-imposed exile [i.e. fled] over imprisonment and execution at the Queen's mercy and travelled to the Umbrawood, once the heart of the Elven kingdom and found there the slowly gathering remanents of the elven people, all the scraps and the rebels as well as those simply lost and she began to band them together for whatever purpose she might one day need them to serve her.
The nature of the deal the King struck with Rivanna to bring her in and bind her to the New Fellowship will probably never be known.

a new Summer Queen for the Fellowship court will also be needed but that can happen later and once an appropraite picture already handly turned into a leaderhead has turned up. Probably with a back story of someone coming from the Summer Elves who were never involved in the civil war, or possibly a young queen born during the winter or even in the early years of the rebirth.
 
Heres what i would do. I think you are on right way, mimicing effects similar to TRAIT_INSANE and TRAIT_ADAPTIVE is the way to go.
Forst you need to two more traits, TRAIT_SUMMER_COURT and TRAIT_WINTER_COURT and let the civ start with one of them. Add them in xml/civilisations/civ4traitinfos. You might need a "mother trait" to handle the switch between but i think you can code it so that the traits can remove themself and replace with the other and then it isnt needed. So for the coming suggestion you need two variants for each step, one for wintercourt and one for summer court.
Then you need to python the triggers in CvEventManager.py/OnBeginPlayerTurn, the trait_adaptive is the best suitable to mimic, do one for winter court and one for summer court. Set iCycle 12 (8,18,36 for other speeds). Set
if (i * iCycle) - iCycle/2== iGameTurn: for
the trait you start with and
if (i * iCycle) == iGameTurn:
for the other.
After that you need to goto XML/Events
In Civ4EventInfos make variants of EVENT_TRAIT_INSANE, but change the pythoncallbacks doTraitInsane to appropriate ones.
In Civ4EventTriggerInfos make variants of EVENTTRIGGER_TRAIT_INSANE.
Finally you go to CvRandomEventInterface.py
Look for doTraitInsane and mimic it. My varints would look like
Code:
def doTraitXcourt(argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	pPlayer.setHasTrait(getstringforx, False)
	pPlayer.setHasTrait(getstringfory, True)
 
Hey thanks for that, i'll give it a try.
 
Okay this ive got so far for the CvRandomEventInterface.py and im pretty sure all the XML is alright and the other python too as the problem ive come up against is that it doesnt switch, the event happens and the flag flickers as to give the impression that somethings happened but its still the same trait in the slot. And ive tried a couple variations, pPlayer.setHasTrait(gc.getInfoTypeForString('TRAIT_WINTERCOURT'), False and a couple of other copied from other events in the .py without any notion of what it means but each time the same thing has happened.
And so im pretty sure this is where the problem is and if this looks right to you then ill have another look at the rest. And again thanks for the help so far.

Code:
def doFellowshipSpring (argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	pPlayer.setHasTrait('TRAIT_WINTERCOURT', False)
	pPlayer.setHasTrait('TRAIT_SUMMERCOURT', True)
	
def doFellowshipAutumn (argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	pPlayer.setHasTrait('TRAIT_SUMMERCOURT', False)
	pPlayer.setHasTrait('TRAIT_WINTERCOURT', True)
 
Okay this ive got so far for the CvRandomEventInterface.py and im pretty sure all the XML is alright and the other python too as the problem ive come up against is that it doesnt switch, the event happens and the flag flickers as to give the impression that somethings happened but its still the same trait in the slot. And ive tried a couple variations, pPlayer.setHasTrait(gc.getInfoTypeForString('TRAIT_WINTERCOURT'), False and a couple of other copied from other events in the .py without any notion of what it means but each time the same thing has happened.
And so im pretty sure this is where the problem is and if this looks right to you then ill have another look at the rest. And again thanks for the help so far.

Code:
def doFellowshipSpring (argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	pPlayer.setHasTrait('TRAIT_WINTERCOURT', False)
	pPlayer.setHasTrait('TRAIT_SUMMERCOURT', True)
	
def doFellowshipAutumn (argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	pPlayer.setHasTrait('TRAIT_SUMMERCOURT', False)
	pPlayer.setHasTrait('TRAIT_WINTERCOURT', True)

pPlayer.setHasTrait(gc.getInfoTypeForString('TRAIT_WINTERCOURT'), False) is what seems right to me. I am not that used to programming events, i think from this point you need help from someone better a coding than me.
My final suggestion is to insert this before the switch to test if the everything else works.
CyInterface().addMessage(0,true,25,"This is Player %s: Trying to switch traits %s" %(pPlayer.getName(),pPlayer.getName()),'',0,'',ColorTypes(11), 0, 0, True,True)
 
That event code is correct, which tells me that if it's not firing correctly, your trigger is not correct. Can you post it for us?

For comparison, here's one of the events for Emergent leaders in RifE:

Code:
def doAddArcane(argsList):
    iEvent = argsList[0]
    kTriggeredData = argsList[1]
    iPlayer = kTriggeredData.ePlayer
    pPlayer = gc.getPlayer(iPlayer)
    pPlayer.setHasTrait(gc.getInfoTypeForString('TRAIT_ARCANE'),True)
    pPlayer.setLeaderStatus(gc.getInfoTypeForString('MAJOR_STATUS'))

Aside from not removing a trait (which used to be the case in RifE, until I made LeaderStatus), it is virtually the same.
 
Thanks for the help so far.
Alright so this is the Modular compents in the wee folder along with the two pythons, is there a way to do python modularlly? currently these are just the base FfHII event pythons with the two new entries added in in what seems the right places and they are basically carbon copies of other entries from it edited to fit the bill and ive looked at it from every direction but i cant figure why its not working.
What happens is that about ten turns in the event fires and clicking on the event does nothing, it causes the flag to flicker as though something has been changed but the old trait is still the only there.
If anyone can figure whats missing itd be well helpful. Lots still hasnt been done, one of the leaderheads is a spacefiller and another just doesnt exist but in the text file and others things just dont have any text at all. But if anyone can help with the stumbling block itd be a blessing.
 

Attachments

  • Fellowship Unfinished.rar
    81.8 KB · Views: 69
I got it working. The problem was in your CvRandomInterface.py, I think. In your def doFellowshipSpring and def doFellowshipAutumn, somehow the three last lines was considered out of loop. You can see in the left screen of notepad++, right after the line number, there is a line indicating a loop. Somehow, in your file, def doFellowshipSpring and def doFellowshipAutumn was broken into two loop (indicated by a horizontal line), excluding the three last lines. I fix this simply by deleting the blank spaces in front of those three last lines, then enter, then tab, so they are at correct position. You can use this edited version.

Here are screenshots from my game, testing your idea (nice idea, btw) :goodjob:

The event is triggered for the first time
Spoiler :


The event is changing my Civ's Trait
Spoiler :


I produced Ljos Warrior (I play a little with your SummerCourt trait, just giving my unit light elf race, for all unitcombat. It rather long to wait for an Archer :D)
Spoiler :



By the way, just suggesting minor thing here : I think your Winter and SummerCourt trait should do more than giving race promo, dexterous and sinister for specific unitcombat. At least, make it a race promo for all unitcombat. Thus, every units you produce in Winter time will be Svart-alike. Not just the recon ones.
 

Attachments

  • Civ4ScreenShot0020.JPG
    Civ4ScreenShot0020.JPG
    138.7 KB · Views: 151
  • Civ4ScreenShot0021.JPG
    Civ4ScreenShot0021.JPG
    166 KB · Views: 150
  • Civ4ScreenShot0022.JPG
    Civ4ScreenShot0022.JPG
    163.7 KB · Views: 153
  • CvRandomEventInterface.rar
    23.4 KB · Views: 86
hey brilliant thank you, and yes the traits still need alot of work, everything was just on hold until the foundations were there.
 
Top Bottom