Star Sign modmod

strategyonly

C2C Supreme Commander
Joined
Mar 13, 2006
Messages
20,994
Location
MN
This is a modmod created by Smeagolheart re-made by StrategyOnly and re-designed python by Dancing Hoskuld.

Some how i had to get the Star Signs into a mod because i believe MOSTLY everything the Ancients did were done by the "stars" themselves. It might just be me, what can i say.

What is it?

It is more or less just promotions that are like the name says Star Signs. ie: In Alphabetical order:

Aquarius, Aries, Cancer, Capricorn, Gemini, Leo, Libra, Pisces, Sagittarius, Scorpio, Taurus, and Virgo.

What does it do (in order with above reference):

A: <iExperiencePercent>25</iExperiencePercent>
A: <iChanceFirstStrikesChange>3</iChanceFirstStrikesChange>
C: <bDefensiveVictoryMove>1</bDefensiveVictoryMove>
C: <bAmphib>1</bAmphib> and <bRiver>1</bRiver>
G: <iVictoryHeal>15</iVictoryHeal>
L: <iStrengthChange>1</iStrengthChange>
L: <iUpgradeDiscount>25</iUpgradeDiscount>
P: <bOneUp>1</bOneUp>
S: <iFirstStrikesChange>3</iFirstStrikesChange>
S: <iSurvivorChance>20</iSurvivorChance>
T: <iVictoryAdjacentHeal>15</iVictoryAdjacentHeal> and <iVictoryStackHeal>15</iVictoryStackHeal>
V: <iHillsDefense>50</iHillsDefense>

PYTHON:

The most important part is the python by the chances it gives:

Right now they there is a very LOW chance of getting these, because of the uniqueness:

if chance == 7: ### Lucky 7 Lol -> so 1% chance of getting a "sign promotion" ###

Example Gemini:

Spoiler :
Code:
elif chance2 == 4:
				pUnit.setHasPromotion(promSign5, true)
				szIcon = "Art/Interface/Buttons/promotions/GEMINI.dds"


Changes for this are welcome, and will be "considered" but maybe not implemented.

DOWNLOAD HERE
:
http://www.gamefront.com/files/23219928/Star+Signs.zip
 
So are you going to add the Chinese and Incan star signs? And if so are you going to restrict them by base culture? Sorry, I meant to ask you that when we were working on it.
 
Mechanical effects from star signs that are inherently connected to one cultural group? I'm against it. C2C seems to be about having all cultural groups be represented, so adding a mechanic that only represents one seems odd. *Maybe* make this random thing a promotion from a religious building, but even then, I'm not so keen.
 
Try a lower case u
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
    StarSigns
-->
<mod id="StarSigns" module="StarSignsPromotion">
   	<event type="[B][COLOR="Red"]u[/COLOR][/B]nitCreated" function="onUnitCreated"/>
   	<event type="unitBuilt" function="onUnitBuilt"/>
</mod>
 
OK now i get this error:

Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "StarSigns", line 141, in onUnitBuilt
NameError: global name 'pUnit' is not defined

Spoiler :
Code:
		elif chance2 == 11:
			pUnit.setHasPromotion(promSign12, true)
			szIcon = "Art/Interface/Buttons/promotions/VIRGO.dds"
 
OK now i get this error:

Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "StarSigns", line 141, in onUnitBuilt
NameError: global name 'pUnit' is not defined

Spoiler :
Code:
		elif chance2 == 11:
			pUnit.setHasPromotion(promSign12, true)
			szIcon = "Art/Interface/Buttons/promotions/VIRGO.dds"

on line 82 try changing
Code:
	unit = argsList[1]
to
Code:
	pUnit = argsList[1]

I've got appointments all of this morning and I'll soon be late so I could not test that this is the fix. As far as I can find there is no documentation for these functions that actually tell you what those parameters are. I think it may really be iUnit but then the naming conventions used in Python are not explicitly used by everyone and since they need to guess at the parameters passed all the time it is no wonder they are not followed.
 
Spoiler :
Code:
@ DH: OK i tried the above should i try the other one, because i get this error now?(pUnit)

Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "StarSigns", line 144, in onUnitBuilt
NameError: global name 'pPlayer' is not defined

Spoiler :
Code:
		elif chance2 == 11:
			pUnit.setHasPromotion(promSign12, true)
			szIcon = "Art/Interface/Buttons/promotions/VIRGO.dds"

		[B][U]pPID = pPlayer.getID()[/U][/B]
		iXa = pUnit.getX()
		iYa = pUnit.getY()

and if

(iUnit) i get this error?

Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "StarSigns", line 108, in onUnitBuilt
NameError: global name 'pUnit' is not defined

Spoiler :
Code:
if chance == 7:  ### Lucky 7 Lol -> so 1% chance of getting a "sign promotion" ###
		signTrue = true
		if chance2 == 0:
			[B][U]pUnit.setHasPromotion(promSign1, true)[/U][/B]
			szIcon = "Art/Interface/Buttons/promotions/AQUARIUS.dds"
 
I've got this mostly working, I just cant get the promotion star sign to appear in the event bubble thingy. I have an appointment now but will package this up for you when I get back.

edit Here it is.
 
Should i change the module name to match the Config file "Star Signs"?

The name in the init.xml points to the file in the config folder. The name inside the config file points to the name of the python file. They don't have to be the same. It probably reduces confusion if they are the same. So its is up to you what you do. It should work as is.
 
Out of boredom while searching for ideas...
Give you a little help on how to display button
Spoiler :

Code:
## 
		if unit.getUnitCombatType() > -1:
			lStar = ["COMBAT1", "COMBAT2", "COMBAT3"]
			iChance = CyGame().getSorenRandNum(100, "Star Promotion")	## 1% for each Promotion
			if iChance < len(lStar):
				iStar = gc.getInfoTypeForString("PROMOTION_" + lStar[iChance])
				unit.setHasPromotion(iStar, True)
				StarInfo = gc.getPromotionInfo(iStar)
				CyInterface().addMessage(unit.getOwner(),True,15,CyTranslator().getText("TXT_STAR_PROMOTION",(unit.getName(), StarInfo.getDescription(),)),'',0, StarInfo.getButton(),ColorTypes(11), unit.getX(), unit.getY(), True,True)
##
Code:
<TEXT>
	<Tag>TXT_STAR_PROMOTION</Tag>
	<English>[COLOR_GREEN]%s1 has earned %s2 Promotion![COLOR_REVERT]</English>
</TEXT>
Works in both onUnitBuilt or onUnitCreated whichever you like.
Just replace the combat promotions with your star ones.
 
Out of boredom while searching for ideas...
Give you a little help on how to display button
Spoiler :

Code:
## 
		if unit.getUnitCombatType() > -1:
			lStar = ["COMBAT1", "COMBAT2", "COMBAT3"]
			iChance = CyGame().getSorenRandNum(100, "Star Promotion")	## 1% for each Promotion
			if iChance < len(lStar):
				iStar = gc.getInfoTypeForString("PROMOTION_" + lStar[iChance])
				unit.setHasPromotion(iStar, True)
				StarInfo = gc.getPromotionInfo(iStar)
				CyInterface().addMessage(unit.getOwner(),True,15,CyTranslator().getText("TXT_STAR_PROMOTION",(unit.getName(), StarInfo.getDescription(),)),'',0, StarInfo.getButton(),ColorTypes(11), unit.getX(), unit.getY(), True,True)
##
Code:
<TEXT>
	<Tag>TXT_STAR_PROMOTION</Tag>
	<English>[COLOR_GREEN]%s1 has earned %s2 Promotion![COLOR_REVERT]</English>
</TEXT>
Works in both onUnitBuilt or onUnitCreated whichever you like.
Just replace the combat promotions with your star ones.


Great thx, I was just going to write DH on this, because it gave me the promotion but i wasn't even aware of it?? Plus he's away from his PC and hopefully enjoying life.

\I will see if i can make the changes and see what happens, again thx so much.;)
 
Out of boredom while searching for ideas...
Give you a little help on how to display button
Spoiler :

Code:
## 
		[B]if unit.getUnitCombatType() > -1:[/B]
			lStar = ["COMBAT1", "COMBAT2", "COMBAT3"]
			iChance = CyGame().getSorenRandNum(100, "Star Promotion")	## 1% for each Promotion
			if iChance < len(lStar):
				iStar = gc.getInfoTypeForString("PROMOTION_" + lStar[iChance])
				unit.setHasPromotion(iStar, True)
				StarInfo = gc.getPromotionInfo(iStar)
				CyInterface().addMessage(unit.getOwner(),True,15,CyTranslator().getText("TXT_STAR_PROMOTION",(unit.getName(), StarInfo.getDescription(),)),'',0, StarInfo.getButton(),ColorTypes(11), unit.getX(), unit.getY(), True,True)
##
Code:
<TEXT>
	<Tag>TXT_STAR_PROMOTION</Tag>
	<English>[COLOR_GREEN]%s1 has earned %s2 Promotion![COLOR_REVERT]</English>
</TEXT>
Works in both onUnitBuilt or onUnitCreated whichever you like.
Just replace the combat promotions with your star ones.

Sorry i cant figure out where that goes, i dont have anything like that in the python??
 
Top Bottom