Hello friends. Firstly please excuse me for my english.
I am one of the main developers of BFME: Tactics and main coder and programmer of this project. i decided to tell you how we implemented our building system in project. It's simple, and perhaps tutorial is not required, but I have not seen anywhere else, I'll write it.
The essence of the system was as follows, in the defense system has walls and offense has not walls. Well, it's superficial description .
Let's start with the fact that this system is very easy to create and almost indistinguishable from the original system unpacking camps.
I propose to begin with, to create two the upgrade in data\ini\upgrade.ini
Upgrade Upgrade_MenAttakStance Type = OBJECT BuildCost = 0 BuildTime = 10 DisplayName = UPGRADE:SelectAttackUpgrade End Upgrade Upgrade_MenDefensStance Type = OBJECT BuildCost = 0 BuildTime = 10 DisplayName = UPGRADE:SelectDefenseUpgrade End
BuildTime = 10 I put here a value of 10, it is necessary as the team will have to unpack the system cooldown in 7 seconds, if I'm not mistaken, I made sure to 10.
Then create two command button в data\ini\commandbutton.ini
;------------------------------------------------------------------------- CommandButton Command_MenAttakStance Command = OBJECT_UPGRADE Options = CANCELABLE NOT_QUEUEABLE Upgrade = Upgrade_MenAttakStance TextLabel = CONTROLBAR:Command_MenAttakStance ButtonImage = MenStance_Attack ButtonBorderType = UPGRADE DescriptLabel = CONTROLBAR:ToolTipCommand_MenAttakStance Radial = Yes ;InPalantir = Yes End ;------------------------------------------------------------------------- CommandButton Command_MenDefensStance Command = OBJECT_UPGRADE Options = CANCELABLE NOT_QUEUEABLE Upgrade = Upgrade_MenDefensStance TextLabel = CONTROLBAR:Command_MenDefensStance ButtonImage = MenStance_Defense ButtonBorderType = UPGRADE DescriptLabel = CONTROLBAR:ToolTipCommand_MenDefensStance Radial = Yes ;InPalantir = Yes End
Next, create a new object, with which we will be unpacking. I created a new file and named it data\ini\object\civilian\civilianstartstance.ini
In it, I created four identical standard object. Almost ....
Consider one of them.
Object CastleFlagNew_NW ; *** ART Parameters *** Draw = W3DScriptedModelDraw ModuleTag_01 OkToChangeModelColor = Yes DefaultModelConditionState Model = NCastle_SKN ; ParticleSysBone = glowbone01 TorchGlow FollowBone:Yes ; ParticleSysBone = glowbone02 TorchGlow FollowBone:Yes ; ParticleSysBone = glowbone03 TorchGlow FollowBone:Yes ; ParticleSysBone = glowbone04 TorchGlow FollowBone:Yes ; ParticleSysBone = glowbone05 TorchGlow FollowBone:Yes End ModelConditionState = WORLD_BUILDER Model = Castle_FlagNW End IdleAnimationState Animation = flag AnimationName = NCastle_SKL.NCastle_IDLA AnimationMode = ONCE AnimationBlendTime = 90 End End AnimationState = JUST_BUILT ; for instant-build Animation = flag AnimationName = NCastle_SKL.NCastle_A AnimationMode = ONCE AnimationBlendTime = 0 End Flags = START_FRAME_LAST End AnimationState = UNPACKING Animation AnimationName = NCastle_SKL.NCastle_A AnimationMode = ONCE AnimationBlendTime = 90 End Flags = START_FRAME_LAST End AnimationState = PACKING Animation = flag AnimationName = NCastle_SKL.NCastle_IDLA AnimationMode = LOOP AnimationBlendTime = 90 End End End VoiceSelect = Gui_PlotSelect ; ***DESIGN parameters *** DisplayName = OBJECT:CastleFlag EditorSorting = STRUCTURE Side = Civilian ArmorSet Conditions = None Armor = InvulnerableArmor DamageFX = EmptyDamageFX ; just to avoid an assert End ; *** ENGINEERING Parameters *** RadarPriority = STRUCTURE KindOf = STRUCTURE SELECTABLE IMMOBILE BASE_FOUNDATION UNATTACKABLE BASE_SITE Body = ImmortalBody ModuleTag_02 MaxHealth = 1.0 End Behavior = CommandSetUpgrade ModuleTag_CommandSetMen TriggeredBy = Upgrade_MenFaction CommandSet = MenStanceSelectionCommandset End Behavior = ProductionUpdate ModuleTag_RequiredForUpgradeProduction End Behavior = DoCommandUpgrade Module_CastleReplace TriggeredBy = Upgrade_MenDefensStance Upgrade_MenDefensStance GetUpgradeCommandButtonName = Command_UnpackCastle End Behavior = CastleBehavior ModuleTag_castle CastleToUnpackForFaction = Men Castle_MenNW 5000 CastleToUnpackForFaction = Elves CastleA_ElvesNW 5000 CastleToUnpackForFaction = Dwarves CastleA_DwarvesNW 5000 CastleToUnpackForFaction = Isengard CastleA_IsengardNW 5000 CastleToUnpackForFaction = Mordor CastleA_MordorNW 5000 CastleToUnpackForFaction = Wild CastleA_WildNW 5000 FilterValidOwnedEntries = ANY +STRUCTURE +WALK_ON_TOP_OF_WALL +BASE_FOUNDATION +TACTICAL_MARKER ;Anything that does not fit this filter will be given to the neutral player, so the template can have rocks and props. MaxCastleRadius = 420.0 ScanDistance = 150 ;InstantUnpack = Yes End End
I added the following lines in this object:
Behavior = CommandSetUpgrade ModuleTag_CommandSetMen TriggeredBy = Upgrade_MenFaction CommandSet = MenStanceSelectionCommandset End
This Behavior - allows changing the command set depending on the faction.
Behavior = ProductionUpdate ModuleTag_RequiredForUpgradeProduction End
This Behavior - is to be able to make upgrades.
Behavior = DoCommandUpgrade Module_CastleReplace TriggeredBy = Upgrade_MenDefensStance Upgrade_MenDefensStance GetUpgradeCommandButtonName = Command_UnpackCastle End
This Behavior - is used to decompress the camps depending on upgrades.
Now consider our сommand set
CommandSet MenStanceSelectionCommandset 1 = Command_MenAttakStance 2 = Command_MenDefensStance End
It is simple, here are manufactured upgrades that I have described above.
The main part is over, and now we just need to configure objects fortress.
First, create a simple object.
Object GondorCastleNoWellNew End
Next to all the objects that we want to hide in the attacking position need add
;*********************************Attack No Build******************************************************* Behavior = InheritUpgradeCreate ModuleTag_InheritCastleAttackG Radius = 300 Upgrade = Upgrade_MenAttakStance Upgrade_MenDefensStance ObjectFilter = ANY +CastleFlagNew_NW +CastleFlagNew_NE +CastleFlagNew_SE +CastleFlagNew_SW End Behavior = ReplaceSelfUpgrade ModuleTag_Replace_With_CastleAttackG ReplaceWith = GondorCastleNoWellNew TriggeredBy = Upgrade_MenAttakStance ConflictsWith = Upgrade_MenDefensStance End ;**********************************************************************************************************
The end
If you need to change the model of the object, and not to hide it completely, you can use the following method.
In your object is created Draw
Draw = W3DScriptedModelDraw Draw_AnyUniqueName Your model and all other. End
Next, create another Draw and all do the following
Draw = W3DScriptedModelDraw Draw_AnyUniqueNameNew AnimationState = USER_1 BeginScript CurDrawableShowModule("Draw_AnyUniqueName ") ; CurDrawableHideModule("Draw_AnyUniqueNameNew ") EndScript End End
And in the future, among Behavior object write the following
Behavior = GeometryUpgrade ModueTag_AnyUniqueName TriggeredBy = Upgrade_MenAttakStance ConflictsWith = Upgrade_MenDefensStance CustomAnimAndDuration = AnimState:USER_1 AnimTime:0 End
Then, with a corresponding upgrade occurs will change models.
This, in fact, the whole tutorial on which the game can do a lot, not only the building system. Everything will depend on your fantasy and needs.