[Python-SDK]Change LeaderHead & Change Player

Fabrysse

Charming-snake learner
Joined
Sep 11, 2006
Messages
430
Location
Toulouse - France
My questions are about my Mod España 1936 (Spanish civil war).
All is OK (or not so far), except 2 important functions.
I'm afraid I'll have to go into the SDK. And each time I did it I couldn't compile. I'm ready to try again, but I have questions...

2 problems, 2 questions :

  • Change LeaderHead :
    I want, at a turn n, a civ to change of LeaderHead (graphical change minimally, real changing would be cool). With python, I tried to use these functions :
    Code:
    in CvArtInfoLeaderhead :
    [LIST][*]VOID setKFM(STRING szDesc)
    [*]VOID setNIF(STRING szDesc)
    [*]VOID setTag(STRING szDesc)[/LIST]
    
    in CyPlayer :
    [LIST][*]VOID setPersonalityType(LeaderHeadType eNewValue)[/LIST]
    It doesn't work !!
    I saw that Rhye's and Fall added a gc.getGame().setLeader(something) in the SDK. But the only copy/paste DLL to my mod crashes the game.

  • Change Player :
    At a turn n, I want the human player to choose if he wants to lead an other civ.
    In my Warlords version, I used the Revolution DLL. But with BtS, the DLL crashes my game when I use my map and creates several other problems.
    I saw that Rhye's and Fall added a gc.getPlayer(int).setActivePlayer(something, boolean) in the SDK. But the only copy/paste DLL to my mod crashes the game.


First : are we sure that there is no way doing that with python ?

Second : If I try to get these RiseNFall functions, and compile my special DLL, wich files will I have to change ? Will it be easy for a first try with dll mod ?
 
It would be cool to be able to do this with python.

I didn't find the way to do it with python.
The solution I finally choosed, is to compile my own dll.
I didn't write any C++ line, I just compiled whith what I needed. I explain :
I needed 3 elements :
- ChangePlayer (existing in Revolution Mod)
- Change Leader (existing in Revolution Mod)
- AnimosityAttack (existing in Warhammer FB Mod, copied from the Vanilia version)

With python, I know in wich file are these elements (ie, if python calls for exemple player.ChangerPlayer(), I know that the C++ function ChangePlayer will be found in the files cvplayer & cyplayer, .cpp and .h : it's easy to find, the files are well commented in these cases, thanks to the autors). So I copied these functions and the other functions necessary (the functions called by the function...), I pasted them in a new file, and with the Chazcon Tut, I compiled my dll successfully.
Just a thing I didn't know : how to expose these functions to python ? I found that the functions I needed was present too in the [...]interface files. Again, I copied/pasted, recompiled and it runs !!!

At the beginning of this thread, I didn't want to have anything else than python (because I had tried to compile with CodeBlocks and it failed). Now, I know it's easy to compile with MsVisualC++, and I'm ready to try to add modifications in C++ files ! :goodjob:

So, I think you should try the same thing...
 
Animosityattack!? Didn't know you need orcish behavior for Leaderchanges :lol:

Yeah I definitly will do SDK changes but since the new Warhammer Mod is based on FFH code for everthing that can't be done in python alone I will have to wait until Kael releases the sources - and Im truly afraid of the mess I'm going to create then:crazyeye:
 
Animosityattack!? Didn't know you need orcish behavior for Leaderchanges :lol:

No, no, no, no !! :lol:
I wanted animosityAttack too, because of the historic fighting between Anarchists & Communists in the Popular Front (in Spain 1936).
But ChangeLeader doesn't need that. The jdog5000's code runs very well.
 
No, no, no, no !! :lol:
I wanted animosityAttack too, because of the historic fighting between Anarchists & Communists in the Popular Front (in Spain 1936).
But ChangeLeader doesn't need that. The jdog5000's code runs very well.

Cool. I'll keep that in mind. Thx!:) Also good to know the animositycode still works in BTS. I already miss my Orcs hacking each other to bits.:D
 
Cool. I'll keep that in mind. Thx!:) Also good to know the animositycode still works in BTS. I already miss my Orcs hacking each other to bits.:D

I just use the animosityAttack function, not all the animosity code.
 
Top Bottom