The 3rd Age

Battle for the Galaxy

Battle for the Galaxy

Battle for the Galaxy seeks to change the land of Middle-earth into the vast Star Wars Galaxy.

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

Removing Auto-Repair

Tutorial for Battle for Middle-earth BFME, Battle for Middle-earth II BFME 2

Avatar of Rob38

Rob38

Category: Code
Level: Beginner
Created: Sunday February 3, 2008 - 21:22
Updated: Tuesday March 10, 2009 - 22:02
Views: 6210
Summary: Preventing structures from auto-repairing

Rating

Staff says

2.5

Members say

3.0

Average

2.8/5.0

4 votes

This is a simple tutorial explaining how to remove auto-repair from structures. It took me a little while to figure out how to remove it properly as some other methods cause serious errors with the building object.

First, let me explain and show what won't remove auto-repair properly. Open up any structure file and you should find the behavior code below in it:
              
Code

    Behavior = GettingBuiltBehavior GetBuiltBehaviorTag
        WorkerName    = GondorWorkerNoSelect ;
        SpawnTimer    = -1.0 ;DEFAULT_STRUCTURE_HEALDELAY
    End

This was the first method I tried. Since the spawn timer is negative, the worker shouldn't spawn, correct? Well, that turns out to be false. It completely ignores the timer and will spawn anyways. Same goes if you make the spawn timer a really high number. It seems to completely ignore what the timer says.
              
Code

    ;Behavior = GettingBuiltBehavior GetBuiltBehaviorTag
    ;    WorkerName    = GondorWorkerNoSelect ;
    ;    SpawnTimer    = DEFAULT_STRUCTURE_HEALDELAY
    ;End

How about just commenting out/removing the behavior? That's a big no-no! If you do that, you get some serious glitches when you try building that structure. You can't cancel the construction of it and you are allowed to start making units during construction. Not what any person wants.

-------------------------------------

Here's the correct method to doing it now.
              
Code

    ; Don't want auto-repair but need for build-up
    Behavior = GettingBuiltBehavior GetBuiltBehaviorTag
        WorkerName    = RohanWorkerVoidHD ;GondorWorkerNoSelect
        SpawnTimer    = DEFAULT_STRUCTURE_HEALDELAY
    End


I keep the behavior and add a new worker name. But what is this new worker? First, find the worker file for whatever faction you want. I will be using gondorworker.ini found in ini\object\goodfaction\units\men. Open up the file and create a new childobject at the bottom with this information:
              
Code

ChildObject RohanWorkerVoidHD GondorWorkerObject

    Draw = W3DScriptedModelDraw ModuleTag_01

        DefaultModelConditionState
            Model = None
        End
    End

    Behavior = WorkerAIUpdate ModuleTag_10
        RepairHealthPercentPerSecond = 0.0% ;% of max health to repair each second
        BoredTime = 1000 ; in milliseconds
        BoredRange = 120 ; when bored, we look this far away to do something
        SpecialContactPoints         = Repair
    End
End

So what did we just do above? We essentially created a dud object. While it does spawn when a structure is damaged, it has no visible model and it repairs 0% per second. In other words, it can't do a thing! If the structure is fully healed by other means, than the worker would still properly disappear as usual. Pretty neat :)

That's all!

Comments

Display order: Newest first

x1xexitsx1x - Wednesday September 11, 2013 - 21:58

where is the download link?

Sulherokhh (Team Chamber Member) - Tuesday February 5, 2008 - 6:46

Yes, exactly. Sorry i wasn't clear about it. I meant the self-repair initiated by the press of the button. Like it is with wall segments when they are destroyed and leave rubble. Or the non-rubble instances like repairing gates and outposts.

Which leads me to another example of a working deactivated auto-repair. The outpost, inn and signalfire should provide all necessary coding data for a manual only repair.

Guess Who - Monday February 4, 2008 - 21:16

He means will it affect the manual repair.

Rob38 (Team Chamber Member) - Monday February 4, 2008 - 14:28

What do you mean? I don't understand your question.

Sulherokhh (Team Chamber Member) - Monday February 4, 2008 - 5:32

Of course. :) Good.

Does it still work without conflicting with self-repair?

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."

 
19:45:41