The 3rd Age

Kings of the West Mod

Kings of the West Mod

Adds Minas Morgul as well as new heroes, units, buildings, and spells

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

Making patrols near buildings

Tutorial for Battle for Middle-earth II BFME 2, Battle for Middle-earth II: Rise of the Witch-king ROTWK

Avatar of bilbothehobbit

bilbothehobbit

Category: Code
Level: Intermediate
Created: Thursday November 5, 2020 - 10:39
Updated: Thursday November 5, 2020 - 11:10
Views: 946
Summary: This tutorial will show you how to make buildings have patrols.

Rating

Staff says

-

Members say

-

Average

-

0 votes

Page 1 2 3
Before you edit the building you want, you will need to make ChildObjects of the desired patrol. For example, if I want to make a Lorien Archer patrol the Elven Barracks, I will go to elvenlorienarcher.ini, which is located at data\ini\object\goodfaction\units\elven, go to the end of the file, after the last End, and add these lines of code:

//------------------------------------------------------------------------------
ChildObject LorienArcher_B ElvenLorienArcher
    IsTrainable = No
    CommandPoints = 0
    EquivalentTo = ElvenLorienArcher

    RadarPriority = UNIT
    KindOf = PRELOAD CAN_CAST_REFLECTIONS INFANTRY PATH_THROUGH_EACH_OTHER SCORE CAN_BE_REPULSED

    CommandSet = EmptyCommandSet

    Body = ActiveBody ModuleTag_02
        CheerRadius = EMOTION_CHEER_RADIUS
        MaxHealth = 100
        MaxHealthDamaged = 50
        BurningDeathBehavior = Yes
        BurningDeathFX = FX_InfantryBurningFlame
    End


    Behavior = SlavedUpdate ModuleTag_Slave
        GuardMaxRange = 100
        GuardWanderRange = 100
        UseSlaverAsControlForEvaObjectSightedEvents = No
        DieOnMastersDeath = Yes
        FadeOutRange = 0
        FadeTime = 1000 //in msec
    End
End


Let's review the code step by step.

ChildObject LorienArcher_B ElvenLorienArcher --> This line creates a new unit, that has all of the Lorien Archer traits, and we can change it the way we want

KindOf = PRELOAD CAN_CAST_REFLECTIONS INFANTRY PATH_THROUGH_EACH_OTHER SCORE CAN_BE_REPULSED --> This lines set what type of unit the object will be. These KindOfs are my preference, but you can change it to different kindofs of your choosing.

Body = ActiveBody ModuleTag_02
        CheerRadius = EMOTION_CHEER_RADIUS
        MaxHealth = 100
        MaxHealthDamaged = 50
        BurningDeathBehavior = Yes
        BurningDeathFX = FX_InfantryBurningFlame
    End
--> These lines set the amount of health the patroling unit will have.

Behavior = SlavedUpdate ModuleTag_Slave
        GuardMaxRange = 100
        GuardWanderRange = 100
        UseSlaverAsControlForEvaObjectSightedEvents = No
        DieOnMastersDeath = Yes
        FadeOutRange = 0
        FadeTime = 1000 //in msec
    End
--> These lines of code set the unit to be patroling a building, and to what distance they will go

DieOnMastersDeath = Yes --> Make the unit die when the Building it guards dies, you can change it to 'No' if you want to disable their death.

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
1:56:43