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