The 3rd Age

BFME 2: Arcade Edition

BFME 2: Arcade Edition

Throws out all the conventional rules of a RTS game and opens the game up like a playable cheat code

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

Avatar of bilbothehobbit

bilbothehobbit

Category: Code
Level: Intermediate
Created: Thursday November 5, 2020 - 10:39
Updated: Sunday March 20, 2022 - 16:53
Views: 3742
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."

 
22:49:19