Page 1 of 1

Problem killing object with OnEnterRegion function [Solved]

Posted: Tue Dec 20, 2016 11:57 pm
by SkinnyODST
I added in this to my LUA

Code: Select all

ActivateRegion("wamparegion")
testfunction = OnEnterRegion(
   function(region, player)
      if IsCharacterHuman (character) then
         KillObject("yav2_bldg_window_ruin_30")
      end
   end,
"wamparegion"
)
The idea is that when I enter the "wamparegion", the ruined window will dissapear. I`ve tried the OnEnterRegion function but it doesn`t "Kill" it. I`ve also tried changing the "(character)" to "(player)" just to see if that made a difference.
The "wamparegion" is also referenced by a SetupAmbushTrigger code.

Re: Problem killing object with OnEnterRegion function

Posted: Wed Dec 21, 2016 12:39 am
by AQT
  • Change (character) back to (player).
  • Make sure "yav2_bldg_window_ruin_30" is actually the name of the object in ZE.
  • KillObject does not work with a prop. Turn "yav2_bldg_window_ruin_30" into a destructiblebuilding. A good example of a destructiblebuilding ODF are those stock energy collector shields from Mygeeto.
  • Make sure you aren't already using the variable testfunction elsewhere.

Re: Problem killing object with OnEnterRegion function

Posted: Wed Dec 21, 2016 1:41 am
by SkinnyODST
Thanks! I changed it to a destructiblebuilding and it works now. Thanks again for your help!