units walking on water?

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
I appreciate Maniac's contribution of the dropship code to Dune Wars.

We have another feature we would like to add to Dune Wars, but I am not quite sure how to do it. I have been told that this feature exists in Planetfall.

We would like to have a unit with two different arts: one when it is on land, and one when it is on ocean. I have tried to accomplish this with the python unitMove event as described in this thread. There is a list of several problems there, one of which is unsolved. The unit has a movement of 2 on land, 4 on water, and when it moves more than one plot, a free unit is generated. It is fun to watch. In the tiny example mod in the thread, move the scout two plots, and you get one free scout. Repeat till map is filled. :-)

I have heard that in planetfall, land units can move into water, and automatically turn into some kind of boat unit. I read through the datalinks in v11, and tried some things using WB, but I cannot see that behavior.

Is there a way to do this in planetfall which I can borrow? If not do you have any suggestions on why the free scout is getting generated in my example mod?
 
IIRC, Maniac used the siege tower spot (appears when a unit attacks a city in the vanilla game during the early era's) and adjusted it to show the transport foil.
 
There are two ways to do what you want:

1) You can recycle the siege tower animation. For that you need to
a) change ARTDEFINE_SIEGE_TOWER or whatever it is called
b) search into the Planetfall SDK for SetSiegeTower. You'll probably get the idea from reading that and be able to modify the code to your specific wishes.

2) Add the FfH code which lets promotions change unit graphics. Look into CIV4UnitArtStyleTypeInfos.xml and especially Civ4PromotionInfos.xml and follow <UnitArtStyleType> to see the code which has been added.

Then you can (also in the SDK for best performance) add/remove a promotion automatically when certain units move on certain plots, and let that promotion change unit graphics.
 
You can recycle the siege tower animation.

Well, that is completely unexpected. I thought the siege tower appeared during city attacks, only, and was added to the existing unit art. What controls how it appears and disappears? Does the unit art become invisible while the siege tower is displayed?

I guess all units traveling by this type of naval transport have the same icon. Can the player, or an enemy, tell them apart?

As a player, how can I see this effect in planetfall? I tried placing marines and other units on coast using WB, and then moving them into water. The game shows the red circle icon indicating movement is not possible.

EDIT: OK, searching SetSiegeTower in your sources revealed some answers but not all. I can see in CvUnit::setXY a line like, "If the unit is in an invalid domain, then call SST", and I can see that your siege tower art is the foil. But, as a player, how do I command the unit to move into an invalid domain? None of your ground units have bCanMoveAllTerrain, and I can't see any other hooks to allow that.

EDIT2: There may be one step missing. I added to CvUnit::setXY:
Code:
		if (isAmphib()) CvDLLEntity::SetSiegeTower(true);
		else CvDLLEntity::SetSiegeTower(false);
I can use the existing bAmphib promotion tag, which connects to the existing CvUnit::isAmphib. This makes sense in my mod and I do not need amphibious for anything else.

But now when I move units with bAmphib, I see *both* the siege tower unit art as well as the original unit art. Is that what happens in planetfall also? Is there a way to remove the original unit art?
 

In Planetfall, Centauri Hydrology allows units to walk inside the owner's territorial waters.

EDIT2: But now when I move units with bAmphib, I see *both* the siege tower unit art as well as the original unit art. Is that what happens in planetfall also?

Yes.

Is there a way to remove the original unit art?

Not with Method 1 as far as I know. Method 2 with promotions replaces the whole unit art if that's what you're after.
 
Back
Top Bottom