ShowMeAllDaUnitz

avain

(key)
Joined
Jul 29, 2006
Messages
2,770
Location
Budapest, EU
ShowMeAllDaUnitz mod
for [civ4] :bts: 3.19
current version: v1.1
date: 2010.04.15

Aim of the mod: show all the units belonging to all the (alive) civilizations

Now this is one HUGE modcomp! Just kidding, it's like 8 lines of code, but it can save some manual labour if you are like me and make ethnic unit sets. (or anything similar)

So what does it do?

Try renaming a unit (click on it's name) and you'll get all the units of all alive civilizations spread out in rows and lines across the map! So you can compare them, check them, see if your modification to unit graphics worked, etc.

The real code is only this:
Code:
# ShowMeAllDaUnitz, avain, 2010-04-15 BEGIN

		for iPlayer in range(0,int(gc.getMAX_PLAYERS())):
			if ((gc.getPlayer(iPlayer).isAlive()) and (gc.getPlayer(iPlayer).isBarbarian()!=true) ):
				for j in range( CyGlobalContext().getNumUnitClassInfos() ):
					eLoopUnit = CyGlobalContext().getCivilizationInfo(gc.getPlayer(iPlayer).getCivilizationType()).getCivilizationUnits(j)
					if (eLoopUnit != -1):
						x = j%10 + 1 + iPlayer*12
						y = (j/10) + 5
						gc.getMap().plot( x, y ).setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"), 1, 1)
						gc.getPlayer(iPlayer).initUnit( eLoopUnit, x, y, UnitAITypes.UNITAI_UNKNOWN, DirectionTypes.NO_DIRECTION )

# ShowMeAllDaUnitz, avain, 2010-04-15 END

But I've uploaded here a modified CvEventManager.py for your pleasure!
(You can put it into your mods Python folder and it should work - unless you have python changes already but in this case you should already know what you are supposed to do;) )

Enjoy!

version history
v1.1
added code to change terrain to ocean below the unit

v1.0
initial version
 

Attachments

  • ShowMeDaUnitz.jpg
    ShowMeDaUnitz.jpg
    86.1 KB · Views: 291
  • CvEventManager.7z
    8.4 KB · Views: 72
Nice idea :goodjob:.

I'm a bit confused:
PHP:
pNewUnit = gc.getPlayer(iPlayer).initUnit( eLoopUnit, x, y, UnitAITypes.UNITAI_UNKNOWN, DirectionTypes.NO_DIRECTION )

that creates a new unit, but i don't see, where you kill the new units :confused: -> After a unit renaming, you should have, with your code, all units twice.
 
Nice idea :goodjob:.

I'm a bit confused:
PHP:
pNewUnit = gc.getPlayer(iPlayer).initUnit( eLoopUnit, x, y, UnitAITypes.UNITAI_UNKNOWN, DirectionTypes.NO_DIRECTION )

that creates a new unit, but i don't see, where you kill the new units :confused: -> After a unit renaming, you should have, with your code, all units twice.

Thanks!
Nope, it only creates the units once, but you are correct, the variable pNewUnit is not needed.
The unit renaming is only the place in CvEventManager.py where I put the code in. It could be anywhere.
 
:wallbash: i completly missunderstood the usage of this mod.

Could you add some things to it? When i take a screenshot, i like it, when all terrain is the same.
-> Could you transform all the used plots to the same terrain type and remove features/hills/peaks on it?
Would be nicer :).
 
:wallbash: i completly missunderstood the usage of this mod.

Could you add some things to it? When i take a screenshot, i like it, when all terrain is the same.
-> Could you transform all the used plots to the same terrain type and remove features/hills/peaks on it?
Would be nicer :).

Done! v1.1 uploaded.
I'm really proud how quickly I respond to requests! I'm already thinking about changing my nickname to avain-blitz-stormtrooper!!! :woohoo:
 
!!!

This is incredibly useful, thanks so much!
 
Whoa! Completely useless for players, but a gold mine for modders! :D

I wonder what happens when there are more units than tiles on the map... :mischief:
 
Top Bottom