Editing Units

Officer Reene said:
now the big question... does the AI know it can do that also? :crazyeye:

I wrote a paragraph explaining why it should, then when going into the code to prove it, I found out that the CvUnit::canAirBomb function returns false if the unit has attacked (if CvUnit::isMadeAttack() returns true). It just so happens that the unit's isMadeAttack flag is set to true during an air bomb. So, technically, the second air bomb should never even be allowed to happen, either for AI or Human.

I don't have Civ4 installed right now, but looking at the code it would seem that if you do a bombing run, you would be unable to do the bombing run as the second move, since a bombing run counts as an attack and each unit can only attack once per turn. However, I might just be looking at it wrong.
 
Gerikes said:
I wrote a paragraph explaining why it should, then when going into the code to prove it, I found out that the CvUnit::canAirBomb function returns false if the unit has attacked (if CvUnit::isMadeAttack() returns true). It just so happens that the unit's isMadeAttack flag is set to true during an air bomb. So, technically, the second air bomb should never even be allowed to happen, either for AI or Human.

I don't have Civ4 installed right now, but looking at the code it would seem that if you do a bombing run, you would be unable to do the bombing run as the second move, since a bombing run counts as an attack and each unit can only attack once per turn. However, I might just be looking at it wrong.


well since I dont understand python at all it probably wouldnt make sense to me...:crazyeye:


my second question if the AI can do 2nd bombing runs...
then does it work in MP?

I use MP and am currently working on an MP friendly mod....

this intrigues me to possibly add this feature if it works.... however if there is python/SDK AI editing I find it usually doesnt work well in MP :mad:


another possibility (if this can work :mischief: ) is making the 2nd bombing run associated with a tech so you get the 2nd bombing run after discovery of a tech...

I suppose that you could just make a new unit with a 2nd bombing run... but that seems counter-productive

just a thought ;)
 
I set the number of moves at three and I only had one bombing run and one strike. Even though I had two moves left, I couldn't do any more bombing runs.
 
maynardsthirdey said:
I set the number of moves at three and I only had one bombing run and one strike. Even though I had two moves left, I couldn't do any more bombing runs.

Just as I thought. There's a flag on each unit that tells you if it's attacked or not every turn. After the first bombing run or air mission, that flag gets set, so you can't do any more even if you have the moves.

On one hand, that flag is exposed. If you do pUnit.setMadeAttack(False), you will make it seem as if the bomber never did an air bomb mission, and thus it can make another bombing run during the turn. Unfortunately, the question is WHEN to do this code. I don't believe there's a function that is called directly before or after an air bomb or air strike. But, if you can find somewhere in python that is called during one of these two times, you can make sure that the madeAttack flag is set to false.

But, doing this without modifying the SDK is probably out of a modders hands.
 
hehe..:blush: ..i found out why i could do 2 bombruns when i set the movement to 2:
i use roger bacon's flyingMOD and in there he has choped the only-1-bombrun-flag.. :mischief:
:D
 
Back
Top Bottom