Quote:
Originally Posted by Yuki Kiba Dakatsu
I am trying to code a building to switch Commandsets, or the whole building itself, depending upon which faction controls it. I have tried ObjectReplace with different buildings for each side, but it doesnt work. Is there a way to make this work (I have Six sides in my mod)
|
Here is another way:
Give the building a suicide weapon and a button to fire it.
When the player captures the building, he fires the suicide weapon and the buildings kills itself.
When it dies, it's InstantDeathBehavior module has OCL = OCL_NewBuildingCreatingObject which creates with disposition ON_GROUND_ALIGNED a new object, lets call it NewBuildingCreatingObject.
NewBuildingCreatingObject in turn, will delete itself after a short time, via DeletionUpdate, and it has the same model as the building that died so it looks to the player as if it is the same building and the player does not see it die.
Before NewBuildingCreatingObject deletes itself, it has an OCLUpdate module that calls an OCL based on the owning player's faction. For an example see Object TechReinforcementPad in TechBuildings.ini whose OCLUpdate module has different FactionOCLs.
Depending on what faction owns the object, a different OCL is used. This OCL in turn creates a new object with the same model as the original object that was suicided so the player still does not see any difference and it looks as if it is the same building. However, the different objects have different command sets. Et voila!