[MODCOMP] Unit Allegiance Mod

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Note from TheLopez
As you all know several excellent modders have left the community, but their work has not. To enable the community I have taken up the support of some of their work that includes this mod, the Unit Allegiance Mod by Snaitf. As part of the support I have updated it to be compatible with v1.61. Please note that if Snaitf decides to come back to the community I will relinquish the ownership of this mod component back to him if he wants it back. In the mean time, I will try to continue to make improvements on his mod as time permits.

Unit Allegiance Mod
By: Snaitf
Currently Supported By: The Lopez

Last Updated 08/06/06

Version: v0.4w
Patch Compatibility: Warlords v2.0.0.0
MP Compatible: ?
Download Mod v0.4w

Version: v0.4
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.4

Description:
Whenever a living human land-based unit is defeated by another land-based unit,
there is a chance that the unit about to be defeated switches allegiance and
joins the victors. They keep all promotions, exp, and levels, lose 1/2 hp, and
can't be moved until next turn.


Installation Instructions:

1) Unzip this into the "civ4_install_folder\Mods\" folder.
2) Open the CivilizationIV.ini configuration file
3) Change the Mod line to read: Mod = Mods\Unit Allegiance Mod
4) Load the game.
5) Then play as normal.


-----Version Information-----


-----v0.4-----

- Added the configurable option allowing players to include the unit combat
types of units belonging to the winner of combat that should not be allowed
to influence the change of allegiance of enemy units.

- Added the configurable option allowing players to include the unit combat
types of units belonging to the loser of combat that should not be allowed to
change their allegiance.

- Added the configurable option allowing players to change the chance that
units will change their allegiance before being defeated in combat

- Added the configurable option allowing players to change the amount of damage
units will have after they change their allegiance.

- Change from using random to using getSorenRandNum. Provided by Jeckel

Spoiler :


-----v0.3-----

- Updated the custom event manager to use Dr. Elmer Jiggles custom event manager


-----v0.2-----

- TheLopez took over the support of the mod

- Updated the mod to be compatible with the v1.61 patch


-----v0.1------

- Initial creation of the mod by Snaitf


-----===Credits & Thanks===-----

- Exavier
[TAB]Composite Mod - readme.txt format

- Snaitf
[TAB]Original author of the mod

- Testers
[TAB]Jeckel, Caesium, Los Tirano
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Well,

1) All of the code is fully documented now with comments, as best as I could
2) I prepared the code to be configurable.
3) Took over support of the mod since Snaitf hasn't been around for a long time.

The next version of the code will integrate Dr. Elmer Jiggle's custom event manager, for easy integration with other mods, and his INI parser code. I will then add configurable options for the mod allowing mod makers and players to tweak the mod as much as possible.
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Feel free to post ideas for the new version of the mod. I will try to do my best to add them.
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
Does this work in Mulitiplayer?

I could never get it to work in MP with the 1.52 Patch
(damn OOS errors)


does the 1.61 patch resolve this?
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
I haven't had a chance to test it in MP. Can you give it a go and let me know if it works?
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
TheLopez said:
I haven't had a chance to test it in MP. Can you give it a go and let me know if it works?


I'll test it... but it will be a while...

I have to upgrade a mod (plus all my minor additions) im using to 1.61 and I have to find out the changes it wants when adding a mod! :mad:

Once I update the mod I will then I will try to merge this mod with the one I am using :crazyeye:

However only in a few cases (in 1.52) I got Python type mods too work... most dont :sad:

For example I can get Snaitf's Show attitude Mod to work (it doesnt affect AI)

but I couldnt get Snaitf's "contact" nor "allegiance" mod to work (in MP...single player works fine) due to AI conflicts


and Snaitf's demolition mod doesnt work in MP either

but I will try... I just wish python wasnt so finicky in MP :(
 

Jeckel

Great Reverend
Joined
Nov 16, 2005
Messages
1,637
Location
Peoria, IL
I have never had problems running mods in MP over a LAN. As long as both people have the same mod loaded and the mods python code calls stuff for the active player and not just player 0, and the proper random number generators are used, then it should work just fine. From what I've seen in LAN games there is no iherent problem with python mods, though maybe its different on internet games, though I don't see why it would be.
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
Jeckel said:
I have never had problems running mods in MP over a LAN. As long as both people have the same mod loaded...


when I play over MP we both have the same mod

some mods work...some mods dont... Im just saying in my experience when I use (python changed scripting) mods that effect AI decisions/actions like the alliegence mod and contact mod or effect gameplay like the demolition mod... I get problems...

when I use mods that work with python mods that dont effect gameplay like Show attitude mod... I do not get OOS errors


however when I use mods that mainly alter XML files or not python gameplay changes... it works fine


(CivMore is a prime example where it changes xml files and only changes/adds to python files that do not mess with AI/gameplay)


Jeckel said:
...and the mods python code calls stuff for the active player and not just player 0, and the proper random number generators are used, then it should work just fine...


I am unfamiliar with any coding with Python so I dont know what you mean here...

perhaps this is the problem (changing python code to active players as opposed to player 0)

if you have any ideas how I can fix these various mods (Alliegance/Demolition/Lopez's Great General (morale bonus)/first contact mods)... it would be greatly appreciated...

then I could get these mods to work in MP for me
 

Jeckel

Great Reverend
Joined
Nov 16, 2005
Messages
1,637
Location
Peoria, IL
Since TheLopez's plate is kinda full at the moment I looked through this mod again and I think I found somthing that might explain why this doesn't work in MP.

It seems this mod uses the built in python random number generator, I'm thinking this is the cause of the OOS error as all players would be generating a different random number and this could cause Civ to choke.

I attached a modified version of the CustomEventManager.py file, in it I changed the python random num generator to Civ4's Soren rand number generator. Give this a try Reene and let me know if this fixes the problem. :)
 

Attachments

  • CvCustomEventManager.zip
    1.1 KB · Views: 278

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
Jeckel said:
Since TheLopez's plate is kinda full at the moment I looked through this mod again and I think I found somthing that might explain why this doesn't work in MP.

It seems this mod uses the built in python random number generator, I'm thinking this is the cause of the OOS error as all players would be generating a different random number and this could cause Civ to choke.

I attached a modified version of the CustomEventManager.py file, in it I changed the python random num generator to Civ4's Soren rand number generator. Give this a try Reene and let me know if this fixes the problem. :)


thanks....I'll try it

but it wont be right away since I cant play MP til next week (schedule conflicts)


did you mark off your changes? I'd like to merge this with the existing mod...

and possibly use it in conjuntion with the show contact/demolition mod...

also does this work with 1.52? Im still upgrading the mods im using to meet 1.61 standards... so I havent upgraded to 1.61 till I complete the updates (hopefully by the end of next week)
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
I'm not 100% sure but I don't think it wikll work with with the v1.52 patch.
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
TheLopez said:
I'm not 100% sure but I don't think it wikll work with with the v1.52 patch.



ok...guess I'll have to wait until I finish updating my main mod...
 

Jeckel

Great Reverend
Joined
Nov 16, 2005
Messages
1,637
Location
Peoria, IL
O, sorry, ment to mention what I changed, but forgot.

Just changed one variable, under the handleCombatResult() method, the iRand variable. I changed 'random.randint(1, 100)' to 'CyGame().getSorenRandNum(100, "Random Unit Allegience Number.")'.

That simple, assumeing the SorenRand was in 1.52, but should be totally MP compatable. :)
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Thanks Jeckel, I was about to release a new version of this mod but I will make your suggested changes and then release.
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
Jeckel said:
O, sorry, ment to mention what I changed, but forgot.

No Problem... thanks for all your help on this...

Jeckel said:
Just changed one variable, under the handleCombatResult() method, the iRand variable. I changed 'random.randint(1, 100)' to 'CyGame().getSorenRandNum(100, "Random Unit Allegience Number.")'.

now will this work with the other Python mods that I am having problems with in MP? (like the first contact mod and the demolition mod)

and if it does... is that the only change I have to do to successfully merge them all together?


Jeckel said:
That simple, assumeing the SorenRand was in 1.52, but should be totally MP compatable. :)

I am sorry I am illiterate in Python...

do you me SorenRand being in the 1.52 patch itself or in the 1.52 version of the allegence mod?


again thx for your help....

sooner or later I'll get this working (I hope)


Note: finished alot of things for the upgrade.... all I have left is the pesky python updating and the static leaderheads (for less lag in later parts of game)


then I can test (and finally patch up to 1.61) if this whole bowl of wax works in MP!
 

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Alright, I have uploaded a new version of the Unit Allegiance Mod that uses the soren rand instead of the original rand.
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
When I merge this mod with another mod....

do I need to intergrate (copy) the Unit Allegiance Mod Config file (text) into the main mod's Config file?

(basically cut and pasting the info from Allegiance Config to the other config file)


thx for your help
 

Officer Reene

It hates you all
Joined
Jan 21, 2006
Messages
698
Location
In the middle of nowhere
I have been examining your files to merge with the CivMore (by Fitchn) Mod


I notice that the CvCustomEventManager.py "imports" the CvEventManager .py


since there CivMore Modifies the CvEventManager.py file

is there anything I need to do to merge the mods?

or can I just place this mod component within the CivMore Mod (following the correct folder placement) ?

Thx for your help
 
Top Bottom