antstubell Posted October 19, 2019 Share Posted October 19, 2019 Can somebody explain why this script is fine... ObjectReference Property ObjToActivate1 AutoEvent OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer())ObjToActivate1.Activate(self)Disable(self)EndifEndEvent … but this script... ObjectReference Property ObjToActivate1 AutoEvent OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer())ObjToActivate1.Activate(self)Delete(self)EndifEndEvent … gives the error...too many arguments passed to function? Link to comment Share on other sites More sharing options...
maxarturo Posted October 19, 2019 Share Posted October 19, 2019 (edited) Correct way to script this : ObjectReference Property ObjToActivate1 Auto Event OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer()) ObjToActivate1.Activate(self)Self.Disable() EndifEndEvent .................................................................................................................. ObjectReference Property ObjToActivate1 Auto Event OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer()) ObjToActivate1.Activate(self)Utility.Wait(1.0)Self.Disable()Self.Delete() EndifEndEvent It's recommended to "Wait" before "Disable/Delete", if before you have an "Activate()" function, the reason is that the "Activate()" can easily be interrupted before the "activate()" function is finish.Example: if the activated object has an animation to play that need some seconds to execute. * Also disable before delete. Edited October 19, 2019 by maxarturo Link to comment Share on other sites More sharing options...
antstubell Posted October 19, 2019 Author Share Posted October 19, 2019 My bad. Should have been... ObjectReference Property ObjToActivate1 AutoObjectReference Property ObjToDis1 AutoEvent OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer())ObjToActivate1.Activate(self)ObjToDis1.disable()Self.Delete()EndifEndEvent Sorry maxarturo page didn't load quick enough to see your reply. Of course you're correct and I noticed it just now. EDIT: You forgot Utility.wait(1.0) and 1.0 is quite a long time. I prefer 0.2. Link to comment Share on other sites More sharing options...
maxarturo Posted October 19, 2019 Share Posted October 19, 2019 (edited) Don't mention it, we all make stupid mistakes !.You can't even start to imagine what kept me busy the last 4 days, a completely newbie's mistake !...... @#!*%@#$...... Edit: Yeah.... you see what i mean !...... #@&*!@*#(%&^^^.....* Corrected. Edited October 19, 2019 by maxarturo Link to comment Share on other sites More sharing options...
maxarturo Posted October 19, 2019 Share Posted October 19, 2019 If the script is leaving in the activator that will execute the animation, then the "Wait" should be a little bit bigger than the time needed for the animation to execute. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 19, 2019 Share Posted October 19, 2019 (edited) maxarturo: I am very surprised by your patience with such postings. Thank you.. antstubell wrote: "Can somebody explain why.."; https://www.creationkit.com/index.php?title=Disable_-_ObjectReferenceFunction Disable(bool abFadeOut = False) native Disable(self) ; compiles fine, because SELF will be treated as Bool; https://www.creationkit.com/index.php?title=Delete_-_ObjectReferenceFunction Delete() native Delete(self) ; error: "too many arguments passed to function" ; no argument in native function, SELF cannot be treated as Boolmaybe you should use next code that makes sure you do not use a property which is the same as SELF (persistence circle would occur otherwise) ObjectReference PROPERTY ObjToActivate1 auto EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - ENDIF ;--------------------- gotoState("Done") ; ### STATE ### ObjToActivate1.Activate(self as ObjectReference) Utility.Wait(0.25) ; adjust the waittime, if needed (see previous posting of maxarturo) self.Disable() self.Delete() ENDEVENT ;=============================== state Done ; do not use the activation event anymore ;========= EVENT OnActivate(ObjectReference akActionRef) ENDEVENT ;======= endState Edited October 19, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
maxarturo Posted October 19, 2019 Share Posted October 19, 2019 ReDragon2013 Yeah... i forgot to explain why. Sometimes i'm too tired and i miss a few things here and there... But thanks to you, that's covered !. Sorry antstubell !. Link to comment Share on other sites More sharing options...
antstubell Posted October 19, 2019 Author Share Posted October 19, 2019 Not a problem. Thank you both. Link to comment Share on other sites More sharing options...
Recommended Posts