antstubell Posted August 9, 2019 Posted August 9, 2019 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. Reveal hidden contents ObjectReference Property DisObj AutoObjectReference Property EnObj AutoObjectReference Property ActiObj AutoEvent 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)endifEndEvent What is confusing me more is this script... Reveal hidden contents ObjectReference Property DisObj AutoObjectReference Property EnObj AutoEvent 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)endifEndEvent Runs perfect on a LeanToTrap that also has falling rocks.Help!
IsharaMeradin Posted August 9, 2019 Posted August 9, 2019 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.
maxarturo Posted August 9, 2019 Posted August 9, 2019 (edited) Erased it, cause IsharaMeradin got first while i was typing. Edited August 9, 2019 by maxarturo
Recommended Posts