Jump to content

Why won't rocks fall with OnHit script?


Recommended Posts

Successfully created rockfalls with Ontriggerenter but just can't work out how to do it with OnHit. Script is running locally on a spiked barricade (ones you see outside forts) which is an activator,

ObjectReference Property ActiObj Auto is a TrapFallingRock activator, other properties not required as of yet.

 

ObjectReference Property DisObj Auto
ObjectReference Property EnObj Auto
ObjectReference Property ActiObj Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

if (akAggressor == Game.GetPlayer())
DisObj.disable()
EnObj.enable()
Activate(ActiObj)

endif
EndEvent

 

What is confusing me more is this script...

 

ObjectReference Property DisObj Auto
ObjectReference Property EnObj Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

if (akAggressor == Game.GetPlayer())
DisObj.disable()
EnObj.enable()
activate(self)


endif
EndEvent

 

Runs perfect on a LeanToTrap that also has falling rocks.

Help!

Link to comment
Share on other sites

Difference in the two scripts:

Self is a special variable available to all papyrus scripts it can be used to reference the object holding the script. If that object also has an OnActivate event, calling Activate will trigger that event.

 

Possible reason for the first to not be working:

If you try to activate an object that does not have a script with the OnActivate event, nothing will happen. First step then is to determine if the object to be activated does have an OnActivate event available to run. If not, create one.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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