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

Post Reply
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Function activate/deactivate regions.

Post by correctmushroom2013 »

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]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
)[/code]

Second code with DamageRegion (idle)
[code]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
)[/code]
I also tried
"DeactivateRegion"
"RemoveDamageRegion"
And others...
What else, the DamageRegion is already on the map when the level starts.
hunpeter12
Command Sergeant Major
Command Sergeant Major
Posts: 260
Joined: Mon Apr 18, 2011 2:53 pm
Projects :: Underground City The Complex [WIP]
Games I'm Playing :: SWBF2

Re: Function activate/deactivate regions.

Post by hunpeter12 »

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.)
Post Reply