Problem killing object with OnEnterRegion function [Solved]

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
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Problem killing object with OnEnterRegion function [Solved]

Post 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.
Last edited by SkinnyODST on Wed Dec 21, 2016 1:41 am, edited 1 time in total.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Problem killing object with OnEnterRegion function

Post 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.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Problem killing object with OnEnterRegion function

Post by SkinnyODST »

Thanks! I changed it to a destructiblebuilding and it works now. Thanks again for your help!
Post Reply