Jump to content

Enabling an object with Havok enabled?


SGTbayk47

Recommended Posts

Hey all.

 

I'm using trying to enable a disabled reference *and* make the havok kick in. What happens at the minute is the object is enabled but doesnt react to the physics unless the player interacts with the item themselves.

 

I'm enabling the item in a simple OnActivate script with another item, so would there be something I can add to that script to enable havok right after the object is enabled?

 

This is the script I'm using:

SCN EnableScript

Begin OnActivate Player

DisabledRef.Enable
SetDestroyed 1

End

Hopefully someone knows how to achieve this, if it's possible.

 

Cheers, BayK.

Link to comment
Share on other sites

I've made a fake explosion, by removing the model and all the sounds etc. and leaving a bit of force and a radius. Then I tried using PlaceAtMe to put the explosion on the object which needs havok. I'm guessing that the explosion is called way to quickly after the reference being enabled, because nothing happens in-game.

 

Anyhow, this is the script at the moment:

SCN EnableScript

Begin OnActivate Player

DisabledRef.Enable
DisabledRef.PlaceAtMe FakeExplosion 1
SetDestroyed 1

End

If the explosion is called too fast, do you know how to add a delay to a script?

Edited by SGTbayk47
Link to comment
Share on other sites

You do that in gamemode. Something like this:

SCN EnableScript

int bEnabled
float fTimer

Begin OnActivate Player
   if DisabledRef.GetDisabled
      Let bEnabled := 1
      DisabledRef.Enable
   endif
End

Begin GameMode

   if bEnabled == 1
      if fTimer < 2
         Let fTimer += GetSecondsPassed
      else
         Let bEnabled := 2
         DisabledRef.PlaceAtMe FakeExplosion 1
         SetDestroyed 1
      endif
   endif
End

PS for the model, you should use a specific model, it's named null-something, don't remember the exact name

Link to comment
Share on other sites


SCN EnableScript

int bEnabled
float fTimer

Begin OnActivate Player
if DisabledRef.GetDisabled
Set bEnabled to 1
DisabledRef.Enable
endif
End

Begin GameMode

if bEnabled == 1
if fTimer < 2
Set fTimer to fTimer + GetSecondsPassed
else
Set bEnabled to 2
DisabledRef.PlaceAtMe FakeExplosion 1
SetDestroyed 1
endif
endif
End
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...