TheWanderer001 Posted July 2, 2021 Share Posted July 2, 2021 (edited) Anyone with a thought as to what might be going wrong? I have a global 'Raven' in a script, it is toggled between 0 and 1 (or rather it should be) and yes the properties are set.Raven.SetValue(1) seems to do nothing... but if I console 'Set Raven to 1' that works and everything proceeds as expected.the script then resets the globle Raven.SetValue(0) and that seems to be working. I tried with Raven.SetValue(1.00) and Raven = Raven.GetValueInt() + 1 and various other combinations but it seems nothing will set the value to one. I'm checking this with debug.notification( Raven.getvalueInt() ) on the next line but this always returns 0 Edited July 2, 2021 by TheWanderer001 Link to comment Share on other sites More sharing options...
TheWanderer001 Posted July 2, 2021 Author Share Posted July 2, 2021 (edited) Okay I've spent far to long trying to get setvalue() to work and have given up on its use :sad: I now have a quest which I'm resetting in order to get the toggle I want... it works but is a convoluted way to go about it :Dsetvalue() should just work !!! Edited July 2, 2021 by TheWanderer001 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 2, 2021 Share Posted July 2, 2021 SetValue does indeed work. The number one cause of SetValue not appearing to work is timing. Seeing the code that you were trying to use would have been helpful for anyone wishing to assist. But it seems that you have moved on at this point. Link to comment Share on other sites More sharing options...
TheWanderer001 Posted July 2, 2021 Author Share Posted July 2, 2021 HI Ishara.... yes I know setvalue() works I have used in the same script and others for other globals and they all work...I thought about timing and tried to set up a loop to trap that... but is just kept running and the value was never set... the code was/is about as simple as it gets... Event OnEquipped(Actor akActor) If (akActor.IsSneaking()) Raven.setvalue(1) Endif Endevent Link to comment Share on other sites More sharing options...
scorrp10 Posted July 2, 2021 Share Posted July 2, 2021 You sure that actually does get called?I suppose you have Papyrus debug logging on. Try adding something likeDebug.Trace(Self + akActor + " : setting Raven to 1") right before Raven.SetValue(1) Link to comment Share on other sites More sharing options...
TheWanderer001 Posted July 2, 2021 Author Share Posted July 2, 2021 while trying to get it to work... with all sorts of alternate code as well... I had debug code directly before and after the setvalue() and yes it was called when it was suppose too be. But the value would never get set to '1' Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 2, 2021 Share Posted July 2, 2021 Some things in papyrus will not run on objects when they are inside of a container. It is possible that SetValue might be one of them. You could flip the script as it were and have a reference alias pointing to the actor doing the equipping. A script on the alias would use the OnObjectEquipped event and set the value when the equipped object is the correct thing. Link to comment Share on other sites More sharing options...
TheWanderer001 Posted July 2, 2021 Author Share Posted July 2, 2021 That could have something to do with it but it's not an object inside a container.The item the script is being run on is a misc item so never actually equipped. and the setvalue() is being run for a global var. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 2, 2021 Share Posted July 2, 2021 Then the next questions: Did you assign the global variable to the property on that script?Are you testing on a new game or save that has not seen that instance of the object? Link to comment Share on other sites More sharing options...
Recommended Posts