Function activate/deactivate regions.

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Private Second Class
User avatar
Posts: 70
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Republic object RX
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Function activate/deactivate regions.

Postby correctmushroom2013 » Fri Feb 02, 2018 3:34 pm

I create a damage region that should work like radiation. If I'll destroy "name" object, it's activate damage region and If I'll repair object, regions is remove. Like on Tantive 4 map.
But... Function work only with death regions, not damage regions. What the problem?

Hidden/Spoiler:
First code with DeadRegion (working)
Code: Select all
OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "radiator_r" then
         AddDeathRegion("DeathRegion_rad")
      end
   end
)
OnObjectRespawn(
      function (object)
            if GetEntityName(object) == "radiator_r" then
                  RemoveRegion("DeathRegion_rad")
            end   
      end
)


Second code with DamageRegion (idle)
Code: Select all
OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "radiator_r" then
         AddDamageRegion("DamageRegion_rad")
      end
   end
)
OnObjectRespawn(
      function (object)
            if GetEntityName(object) == "radiator_r" then
                  RemoveRegion("DamageRegion_rad")
            end   
      end
)


I also tried
"DeactivateRegion"
"RemoveDamageRegion"
And others...
What else, the DamageRegion is already on the map when the level starts.

Command Sergeant Major
User avatar
Posts: 256
Joined: Mon Apr 18, 2011 2:53 pm
Location: The Milky Way/The Solar System/Earth/Hungary
Projects :: Underground City The Complex [WIP]
Games I'm Playing :: SWBF2

Re: Function activate/deactivate regions.

Postby hunpeter12 » Sun Feb 04, 2018 12:05 am

Does a damage region have to be specified in the Lua normally? As far as I know, you can't really remove regions, you can only tell the game whether they are a death (or landing) region or not. So what you are trying to do might not be possible, but I don't know much about scripting, so I'm not sure. (As a side note: Activate and DeactivateRegion only change whether an OnEnterRegion function will be triggered by the region.)

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 2 guests