saintgrimm92 Posted March 9, 2015 Share Posted March 9, 2015 Hello! I'm trying to make a trigger box cause damage to the player every so often as long as the player is inside of the trigger box, however, I'm a very novice scripter and the only scripts I can actually be AT ALL confident about are quest scripts... I tried to use my knowledge of quest scripting for trigger boxes, but it seems it won't compile. Here is my script: Float Property DamageHealthAmount Auto Float Property TimeBetween Auto Actor Property PlayerREF Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF Game.GetPlayer().DamageActorValue("Health",DamageHealthAmount) RegisterForSingleUpdate(TimeBetween) EndIf EndEvent Event OnUpdate() Game.GetPlayer().DamageActorValue("Health",DamageHealthAmount) RegisterForSingleUpdate(TimeBetween) EndEvent Event OnTriggerLeave(ObjectRefence akActionRef) If akActionRef == PlayerREF UnRegisterForUpdate() EndIf EndEventI get more than one error from this:1. Unknown Type ObjectReference2. Cannot compare a objectreference to a actor (cast missing or types unrelated)3. the parameter types of function ontriggerleave in the empty state on script do not match the parent script object reference Any help is highly appreciated! Link to comment Share on other sites More sharing options...
ubuntufreakdragon Posted March 9, 2015 Share Posted March 9, 2015 Sounds like a misspelling:in the 3. event you wrote 'ObjectRefence' instead of 'ObjectReference' Link to comment Share on other sites More sharing options...
saintgrimm92 Posted March 9, 2015 Author Share Posted March 9, 2015 -facepalm- Thank you... Link to comment Share on other sites More sharing options...
Mattiewagg Posted March 9, 2015 Share Posted March 9, 2015 I recommend a better way to do this. There is an event called OnTrigger which is called every so often while one is in the trigger. It would negate the need for Updates. Link to comment Share on other sites More sharing options...
ubuntufreakdragon Posted March 9, 2015 Share Posted March 9, 2015 You cannot decide how often OnTrigger fires per second, so OnTriggerEnter/Leave is more reliable, but I would recommend to add a bool is_on_trigger = false which is set inside the ontrigger###### events and make it stop the onUpdate-block to prevent race conditions. Link to comment Share on other sites More sharing options...
Mattiewagg Posted March 9, 2015 Share Posted March 9, 2015 You cannot decide how often OnTrigger fires per second, so OnTriggerEnter/Leave is more reliable, but I would recommend to add a bool is_on_trigger = false which is set inside the ontrigger###### events and make it stop the onUpdate-block to prevent race conditions.You can't decide how often, no. But if you don't need to then you can use it. Link to comment Share on other sites More sharing options...
Recommended Posts