Modders & units makers Help us please

boneys26

BTS Play session tester
Joined
Nov 24, 2005
Messages
839
Location
Coventry, England
I done a poll in the forum to see how many people want the cruise missile back I polled 100 people and 78/100 want this unit back (and the paratrooper) so could someone please make this unit I try'd using the ICBM but I can't remove "you nuked us" or the fall out so my guess is you will need to use the SDK to make this unit (so the AI also knows how to use it) if anyone is making this unit or is planning on making it soon please let us know..
 
I promise that as soon as someone demonstrates working code for a cruise missile I'll make a model for one. So far I haven't seen any code, but if I do, you'll get your missile.

-Smitty
 
snafusmith said:
I promise that as soon as someone demonstrates working code for a cruise missile to work I'll make a model for one. So far I haven't seen any code, but if I do, you'll get your missile.

-Smitty


Thanks smitty I've been trying for ages to find someone that will do the code for it :(
 
Lord Olleus said:
Why don't you learn python and c++ if you want the cruise missile so badly?


I am trying to teach myself C & C++ atm.... I have been for the past month :p but its not something anyone can pick up over night,:crazyeye: so far I got 3 books: beginning programming, C by example & C++ (was also given 2 other books html & Excel VBA programming) but html i sort of know and only helps a bit with .xml and excel i could use in the way others have to make small program for a map editer...

so I'm not doing nothing about it I am trying but like i said C & C++ isn't easy to pick up quick:eek: (if you know C & C++ then you will understand)
 
Lord Olleus said:
Finaly, Its nice to see someone who is prepared to do something and not just sit back and watch it all happen.

About the code. I guess that the only thing you need is to make a normal unit in xml, but add a python code that kills it even if it wins combat.

Disclaimer - I have not tested this.


wow that was quick! lol what folder do i put the python into? see what i mean about not being able to pick it up over night, this would have taken me weeks. still will take me weeks lol I want to do alsorts of missiles for anti-armor to anti-ship

also do you know if anyone is doing a write up on the SDK so we know what folders are for what?
 
OK I've done it i can get the unit to work :)but the missile doesn't die at the end of the attack:(

OH and I didn't say thanks lord olleus when you gave me the code to try so thanks mate :):)
 
How about:

Code:
	if pWinner.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_CRUISE_MISSILE"):
			pWinner.kill(0, pWinner.getOwner())
			CvUtil.pyPrint("The Cruise Misile has detonated!")

This will only work if you change some XML files as well: CIV4UnitInfos (add a unit with the unit class UNITCLASS_CRUISE_MISSILE) and CIV4UnitClassInfos (add UNITCLASS_CRUISE_MISSILE).

You might have to add Text Information for the unit as well, but this shouldn't affect game mechanics.
 
have i put it in the right folder? CustomAssets\python\CvEventManager

i changed
Code:
def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
		if (not self.__LOG_COMBAT):
			return
		if playerX and playerX and unitX and playerY:
			CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s' 
				%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(), 
				playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))
to
Code:
def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
		if (not self.__LOG_COMBAT):
			return
		if playerX and playerX and unitX and playerY:
			CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s' 
				%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(), 
				playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))
		if pWinner.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_CRUISE_MISSILE"):
			pWinner.kill(0, pWinner.getOwner())
			CvUtil.pyPrint("The Cruise Misile has detonated!")
 
Lord Olleus said:
no thats the wrong folder.
As I've already said:
c:/Program files/firaxis games/civilisation 4/mods
And you need to make a new unit called UNITCLASS_CRUISE_MISSILE.
There's a guide somewhere on the forum about how to make new units.

:confused:
I've done the unit and the .xml's, text and all i'm just not clear about the python if i just add it to the mods folder then I'm just going to have that bit of code saved (like a work document) don't i add it into another python code somewhere so the game knows its there and can read it? and your other post said unzip into the mods folder theres no zip document to unzip there :cry: :confused: :confused: :cry:
 
for testing purposes, you can edit the files in the CustomAssets directory. But if you want to publish it, it's recommended to put all files you changed into a mod folder.
 
but what folder do i put the python into if CvEventManager is the wrong one? thats the only one i can find with that same text "def onCombatResult"
 
You know we might want to make a new boolean XML flag "bKamakazi" for units that would get checked by Python to tell it to do this. This would have the advantage of being easily aplied to other units (like for example Japanese Kamakazis) and it would be possible for the AI to eventualy be programed to recognize the special nature of these units and employ them in a special way. The current code will probaby result in the AI trying to build way too many missles as it will think the Missle is a regular unit capable of being used over and over.

I could do some work on this but I currently have 3 other things I am moding, I will made a deal, if a model is made (and it needs to look good!) I will comit myself to making the AI recognize the Kamakazi nature of it and using it atleast semi-logicaly.
 
Impaler[WrG] said:
I could do some work on this but I currently have 3 other things I am moding, I will made a deal, if a model is made (and it needs to look good!) I will comit myself to making the AI recognize the Kamakazi nature of it and using it atleast semi-logicaly.


we have 2 units atm the V1 & V2 rocket and smitty will be making a laod more as soon as we get a working code for the missile we could also make the japs WW2 Kamakazi planes :)
 
Then I would sugjest having the V2 in the game as the initial weak Rocket, short range, modest damage avalible roughly WW2 era. Cruise Missle being avalible late game (Rocketry ofcorse) with greater range, power and possibly some kind of improved targeting ability like able to selectivly attack any unit in a stack or hit a specific building in a city (these would be very sophisticated but cool additions, I cant currently comit myself to doing them though).
 
well the plan is (as soon as we get a working code) to do a load of missiles each missile will have its own bonus like anti-ship missile (to weaken any transport/task force coming in) could have +10% Vs sea units anti-armor (like the anti-tank) + 10% Vs armor and so on. we are going to start with the V1 or V2 then moving up through the missiles untill we get the modern cruise missile, we could do 3 types of missile land = it will damage any land unit -10% Vs armor, anti-armor and anti-ship. making 2 or more missiles for each one each one would be stronger or weaker than the other.

but thinking this through there would have to be a whole new domain like "DOMAIN_MISSILE" so each missile can go on land/sea and got over mountins

I have so many Ideas for things if only i could get my head round this damn C & C++ :(
 
Impaler[WrG] said:
I could do some work on this but I currently have 3 other things I am moding, I will made a deal, if a model is made (and it needs to look good!) I will comit myself to making the AI recognize the Kamakazi nature of it and using it atleast semi-logicaly.

Well we got 3 units V1, V2, and now smittys unit + another 3 skins coming for that unit i have been talking to other modders trying to get there ideas to help us out and one idea sticks out more than the others
Dale said:
You could do cruise missiles through xml and python. No need for an SDK hack. I don't 100% know, as this is just a guess but:

- Setup the cruise as a fighter plane
- Capture the airBomb() event in python
- Kill cruise missile after the airBomb

Dale
would this be easier and quicker for you to do? (that is if your willing to do it for us)

Thanks
 
Thats a good temporary solution, SDK stuff is mostly to get the AI to use it properly, it will likly be some time before I can get to this and it will be my first atempt to Mod the AI. Sugjest you set up the simple Python scripts now and start playing around, watch the AI and see how it behaves so we know what needs to be changed later.
 
Ok I've tried 3 or 4 different python codes now and i cant get any of them to kill the missile after it hits its mark. has anyone seen a thread on how to get python to kill the unit at the end of its attack even if it wins? I don't know python but give me as much info as you can and i'ld do something with it

some codes i've tried are:
Code:
def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
		if (not self.__LOG_COMBAT):
			return
		if playerX and playerX and unitX and playerY:
			CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s' 
				%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(), 
				playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))
		if pWinner.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_CRUISE_MISSILE"):
			pWinner.kill(0, pWinner.getOwner())
			CvUtil.pyPrint("The Cruise Misile has detonated!")
and
Code:
def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
		if(pWinner.getUnitClassType() == gc.getInfoTypeForString("UNIT_CRUISE_MISSILE") 
		pWinner.killed(0,0) # This kills the unit if it is a cruise missle and if it won combat. If it lost combat it is already dead.
 
Back
Top Bottom