Jump to content


Photo

new way to Delete Buildings


  • Please log in to reply
No replies to this topic

#1 JUS_SAURON

JUS_SAURON

    El Shaddai

  • Members
  • 1,582 posts
  • Location:Trinidad
  • Projects: BFME2 MOD - Power Of The Ring
  •   INI Coder

Posted 08 April 2026 - 08:21 PM

I am posting here a NEW way to Delete buildings .

Why ? Because in multiplayer , a lot of players delete their building when being attacked .IMO its spoils gameplay .Some units lose special attacks like Pillage .

How it now works .

The Building Sell Button is a fake button , giving information - Use Builder to delete Structure .

The Builder has a special power , altering the Commandset of the Building to allow the Sell Button.

The Building only has the sell button , nothing else .

Once active , the building has the Sell button , and will be automatically destroyed if not SOLD

The Builder can only activate this when enemies are not around .

 

So you can't just build a structure , then activate the sell option , waiting for an enemy to come close .Also you can't delete a Structure while the enemy is close and attacking the building .

You are forced to properly DEFEND that structure , rather than just Deleting it !

 

Here are the codes

CommandSet Command_Sell_NEW_BUILDING
    1        =      Command_Sell_NEW

End

In Building


;============================================================================
//Commandset upgrades TO SELL
	Behavior = CommandSetUpgrade ModuleTag_Sell_PORTER
		TriggeredBy	= Upgrade_Sell_PORTER
		CommandSet	= Command_Sell_NEW_BUILDING
	End



Behavior = ObjectCreationUpgrade MakeTheFreeSell
		TriggeredBy		= Upgrade_Sell_PORTER
		Delay			= 60000
		GrantUpgrade	= Upgrade_DeleteFoundation
	End

Behavior = ReplaceSelfUpgrade ModuleTag_Replace_With_Nothing
		ReplaceWith = TempThing2
		TriggeredBy = Upgrade_DeleteFoundation
		; ConflictsWith = Upgrade_ElvenWallHub
	End
;====================================== SELL END  ====================

in porter

;//-------------------------PORTER SELL --------------------------------------
	;;--------------------------------------------------------------------------------------------
	

	Behavior = SpecialEnemySenseUpdate ModuleTag_StingSeesOrcs
		SpecialEnemyFilter = ANY +INFANTRY +CAVALRY +MONSTER +HERO +CREEP ENEMIES
		ScanRange = 300  ; 200
		ScanInterval = 2000
                    
	End


	
	Behavior = SpecialPowerModule ModuleTag_PorterSellDummy
		SpecialPowerTemplate			= SpecialAbilitySell_PORTER
		StartsPaused					=     No
		UpdateModuleStartsAttack		= Yes
	End
	
	Behavior = ActivateModuleSpecialPower ModuleTag_CloseTheGap
		SpecialPowerTemplate			= SpecialAbilitySell_PORTER
		StartAbilityRange				= 100
		TriggerSpecialPower				= ModuleTag_PorterSellBuff		TARGETPOS
	
	End
	
	

	Behavior = SpecialPowerModule ModuleTag_PorterSellBuff
		SpecialPowerTemplate			= SpecialAbilityActivateeDummy
	        AttributeModifier			=  AttributeModifierSell_PORTER                         
		AttributeModifierRange			= 20
		AttributeModifierAffects	= ANY     +STRUCTURE   -BASE_FOUNDATION -EXPANSION_PAD   -IsengardBuildingFoundation -GondorBuildingFoundation -MordorBaseFoundation  -GoblinBuildingFoundation -RohanBuildingFoundation
		TriggerFX					=  FX_SpellRallyingCall
	End


in special power

 

 ;------------------------------------------------------------------------------
SpecialPower SpecialAbilitySell_PORTER
	Enum						   = SPECIAL_GENERAL_TARGETLESS_TWO	
	InitiateAtLocationSound		   = DainMightyRage
             RadiusCursorRadius		= 20
               Flags						   = NEEDS_OBJECT_FILTER NO_FORBIDDEN_OBJECTS 
	ObjectFilter				   =  ANY       +STRUCTURE  -BASE_FOUNDATION -EXPANSION_PAD   -IsengardBuildingFoundation -GondorBuildingFoundation -MordorBaseFoundation  -GoblinBuildingFoundation -RohanBuildingFoundation
	ReloadTime				= 90000
	ForbiddenObjectFilter	= ANY +INFANTRY +CAVALRY +CREEP +MONSTER +MACHINE +HERO ENEMIES
  ForbiddenObjectRange	= 300
End


The commansets / commandbuttons


CommandButton Command_Sell
  Command                 = NONE
  Options				  = NONPRESSABLE
  TextLabel				  = CONTROLBAR:SellBuilding
  ButtonImage             = BCSell
  ButtonBorderType        = SYSTEM
  DescriptLabel			  = CONTROLBAR:ToolTipSellBuilding
  ;Radial				  = Yes
  InPalantir			= Yes
End


CommandButton Command_Sell_NEW
  Command                 = SELL
  TextLabel				  = CONTROLBAR:SellBuilding
  ButtonImage             = BCSell
  ButtonBorderType        = SYSTEM
  DescriptLabel			  = CONTROLBAR:ToolTipSellBuilding1
  ;Radial				  = Yes
  InPalantir			= Yes
End

CommandButton Command_SpecialAbilitySell_PORTER
  Command                 = SPECIAL_POWER 
	SpecialPower		= SpecialAbilitySell_PORTER
  TextLabel				  = CONTROLBAR:SellBuilding
  ButtonImage             = BCSell
  ButtonBorderType        = ACTION 
	Options				= NEED_TARGET_POS
	RadiusCursorType	= HealRadiusCursor
	CursorName			= Bombard
	InvalidCursorName	= GenericInvalid
  DescriptLabel			  =  CONTROLBAR:TooltipSellBuildingPORTER
  ;Radial				  = Yes
  InPalantir			= Yes
DisableOnModelCondition = SPECIAL_ENEMY_NEAR
End


CONTROLBAR:SellBuilding
"Demolish Building"
END

CONTROLBAR:TooltipSellBuilding1
"Demolish "
END

CONTROLBAR:TooltipSellBuilding
"Demolish \n Use The Porter to Allow Demolish Command  "
END

CONTROLBAR:TooltipSellBuildingPORTER
"Demolish \n Left click icon then left click on target STRUCTURE \n \n CommandSet changes to Allow Demolish Command "
END

Attribute

ModifierList AttributeModifierSell_PORTER 
	Category = SPELL		 	
	Duration = 0
        Upgrade = Upgrade_Sell_PORTER Delay:1
	ModelCondition = MOUNTED
End

other things

Object TempThing2

 
; *** ART Parameters ***

; This is required for garrisoned objects - please put in all objects.
ButtonImage = HSGlorfindelStarlight
 

Draw = W3DScriptedModelDraw ModuleTag_01

OkToChangeModelColor = Yes

StaticModelLODMode = Yes
 NoRotate = Yes
DefaultModelConditionState

      Model =         NONE            
                             
		End   
 

End

; ***DESIGN parameters ***
Side = Men
EditorSorting = UNIT
ThreatLevel = 1.0
TransportSlotCount = TRANSPORTSLOTCOUNT_DOZER
ArmorSet
Conditions = None
Armor = NoArmor
DamageFX = NormalDamageFX
End

VisionRange = VISION_STANDARD_MELEE
ShroudClearingRange = SHROUD_CLEAR_STANDARD

BuildCost = MORDOR_LABORER_BUILDCOST
BuildTime = MORDOR_LABORER_BUILDTIME
BountyValue = MORDOR_LABORER_BOUNTY_VALUE


CrushableLevel = 0 ;What am I?: 0 = for infantry, 1 = for trees, 2 = general vehicles
CrusherLevel = 0 ;What can I crush?: 0 = small animals, 1 = infantry, 2 = trees, 3 = vehicles
 
CommandPoints = 0

 

; *** ENGINEERING Parameters ***

RadarPriority = NOT_ON_RADAR
  KindOf = IGNORE_FOR_VICTORY PRELOAD  IGNORED_IN_GUI   PATH_THROUGH_EACH_OTHER     UNATTACKABLE  
 
 


 
	IsTrainable = No
	CommandPoints = 0
	 
	Behavior = LifetimeUpdate ModuleTag_LifetimeUpdate
	// This one does the work, but the one in the horde displays the timer
		MinLifetime		= 50  
		MaxLifetime		= 50 
		DeathType		= FADED
	End	

	CommandSet =  EmptyCommandSet
	 
	Body = ActiveBody ModuleTag_02
		CheerRadius 	  = EMOTION_CHEER_RADIUS
		MaxHealth         =  500 ;GONDOR_TOWERGUARD_HEALTH             
		MaxHealthDamaged  = GONDOR_TOWERGUARD_HEALTH_DAMAGED
		BurningDeathBehavior = Yes
		BurningDeathFX       = FX_InfantryBurningFlame
	End


             Behavior = SlavedUpdate ModuleTag_Slave
		GuardMaxRange		= 500
		GuardWanderRange	= 400
		UseSlaverAsControlForEvaObjectSightedEvents = No
	End
            
            Behavior = AnimalAIUpdate ModuleTagWanderAround
		FleeRange = 100			; how close enemies have to be before we panic
		FleeDistance = 500      ; how far the animal will run once spooked
		WanderPercentage = 5	;percentage of the time we should move
		MaxWanderDistance = 500  ;maximum distance to move at once
		MaxWanderRadius = 500  ; how far to wander on our own
		UpdateTimer = 10000		; temp disable		10     ; how often do we want to check for enemies
	End     

 





LocomotorSet
Locomotor = HumanLocomotor
Condition = SET_NORMAL
Speed = 32
End

LocomotorSet
Locomotor = HumanWanderLocomotor
Condition = SET_WANDER
Speed = 32
End

Behavior = PhysicsBehavior ModuleTag_04
GravityMult = 1.0
End

Behavior = SlowDeathBehavior ModuleTag_05
DeathTypes = ALL -FADED
DeathFlags = DEATH_1
SinkDelay = 3000
SinkRate = 0.40 ; in Dist/Sec
DestructionDelay = 8000
 
End

Behavior = SlowDeathBehavior ModuleTag_ConstructionDeath
DeathTypes = NONE +FADED
DeathFlags = DEATH_2
FadeDelay = 500
FadeTime = 3500
DestructionDelay = 4500

End

        
Behavior = SquishCollide ModuleTag_06
;nothing
End

Behavior = BezierProjectileBehavior ModuleTag_08 ; Module starts asleep, and wakes up when thrown.
;
FirstHeight = 24 ; Height of Bezier control points above highest intervening terrain
SecondHeight = 24
FirstPercentIndent = 30% ; Percentage of shot distance control points are placed
SecondPercentIndent = 70%
TumbleRandomly = Yes

CrushStyle = Yes ; I don't detonate, I just hit
DieOnImpact = Yes
BounceCount = 1 ; When I hit the ground, I'll arc again
BounceDistance = 40 ; this far
BounceFirstHeight = 16 ; Height of Bezier control points above highest intervening terrain
BounceSecondHeight = 16
BounceFirstPercentIndent = 20% ; Percentage of shot distance control points are placed
BounceSecondPercentIndent = 80%

GroundHitFX = FX_ThrownRockGroundHit
GroundBounceFX = FX_ThrownRockBounceHit
End

Behavior = HitReactionBehavior HitReactionBehaviorModuleTag
HitReactionLifeTimer1 = 7 ; level 1 (light damage) hit reaction animations in frames (5 per sec)
HitReactionLifeTimer2 = 15 ; level 2 (medium damage) hit reaction animations in frames (5 per sec)
HitReactionLifeTimer3 = 10 ; level 3 (heavy damage) hit reaction animations in frames (5 per sec)

HitReactionThreshold1 = 0.0 ; level 1 (light damage) threshold trigger
HitReactionThreshold2 = 25.0 ; level 2 (medium damage) threshold trigger
HitReactionThreshold3 = 50.0 ; level 3 (heavy damage) threshold trigger
End

Geometry = CYLINDER
GeometryMajorRadius = 8.0
GeometryMinorRadius = 8.0
GeometryHeight = 19.2
GeometryIsSmall = Yes
Shadow = SHADOW_DECAL
ShadowSizeX = 19;
ShadowSizeY = 19;
ShadowTexture = ShadowI;
End


Edited by JUS_SAURON, 08 April 2026 - 08:49 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users