Reikel Posted June 1, 2014 Share Posted June 1, 2014 Hey guys, I've been having issues trying to pull a character's size info from the game for my script. I've been trying to use PlayerRef.GetScale and it complies fine, but whenever I go to test it in game, the value is 0 when I should be expecting one. Anyone know the cause of this? I've attached the script that uses this function. Any help would be appreciated. Link to comment Share on other sites More sharing options...
myztikrice Posted June 1, 2014 Share Posted June 1, 2014 Did you set the player as the playerref property in the creation kit? Link to comment Share on other sites More sharing options...
Reikel Posted June 2, 2014 Author Share Posted June 2, 2014 Did you set the player as the playerref property in the creation kit? I have, but whenever I use auto-fill for the rest of the properties, the information isn't filled in. (assuming nothing is wrong) Most I know is that my program is not initializing at all. I'm going to try to hook it onto an object and see if the programs works then. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 2, 2014 Share Posted June 2, 2014 whenever I use auto-fill for the rest of the properties, the information isn't filled inThis is part of the problem. You need to manually assign those values. Unless the variable name matches a record's ID name, it will not auto-fill. Link to comment Share on other sites More sharing options...
Reikel Posted June 3, 2014 Author Share Posted June 3, 2014 This is part of the problem. You need to manually assign those values. Unless the variable name matches a record's ID name, it will not auto-fill. Would it prevent the entire script from running? Or just the section that uses the properties? Link to comment Share on other sites More sharing options...
fantasy19 Posted June 3, 2014 Share Posted June 3, 2014 it just prevents that variable to use what you want(PlayerRef in your case) if its not filled. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 3, 2014 Share Posted June 3, 2014 PlayerRef seems to be the property that does fill according to the OP. I'll post the OP's script. I know how some people are about not wanting to download any files linked in a forum post. ScriptName zMacroManager extends ActiveMagicEffect Actor Property PlayerRef Auto ObjectReference Property SizeRef Auto GlobalVariable Property HP Auto GlobalVariable Property SPD Auto GlobalVariable Property DMG Auto GlobalVariable Property STAM Auto Spell Property Stagger Auto ;Stored values Float Size Float StoredHP Float StoredDMG Float StoredSPD Float StoredCW Float StoredSTAM int X = 0 int Y = 0 Event OnInit() While X == 0 Size = PlayerRef.GetScale() ;Sets Fame & Infamy to Scale If PlayerRef.GetActorValue("Fame") == 0 PlayerRef.ForceActorValue("Fame" , Size) EndIf If PlayerRef.GetActorValue("Infamy") == 0 PlayerRef.ForceActorValue("Infamy" , Size) EndIf ;Setting HP, Speed, Damage, Carry Weight, & Stamina If HP.GetValue() > 0 StoredHP += HP.GetValue() HP.SetValue(0) EndIf If DMG.GetValue() > 0 StoredDMG += DMG.GetValue() DMG.SetValue(0) EndIf If STAM.GetValue() > 0 StoredSTAM += STAM.GetValue() STAM.SetValue(0) EndIf ;If SPD.GetValue() > 0 ; StoredSPD += SPD.GetValue() ; SPD.SetValue(0) ;EndIf ;Setting condition for player to stagger if bigger than x2 normal size If Size >= 2 PlayerRef.AddSpell(Stagger) EndIf If Size < 2 PlayerRef.RemoveSpell(Stagger) EndIf Utility.Wait(3) ;Uninstaller If PlayerRef.GetActorValue("Fame") == -5 X = 1 PlayerRef.ModActorValue("Health" , -StoredHP) PlayerRef.ModActorValue("Damage" , -StoredDMG) ;PlayerRef.ModActorValue("SpeedMult" , -StoredSPD) PlayerRef.ModActorValue("Stamina" , -StoredSTAM) PlayerRef.SetScale(1) PlayerRef.SetActorValue("Fame" , 0) PlayerRef.SetActorValue("Infamy" , 0) EndIf EndWhile EndEvent In your script to ensure that GetScale is returning what you want. Add a trace line at the top right after the line where you assign the value to the variable Size and then check the log afterwards. Debug.Trace("Player scale is: "+Size) As far as the properties, if you do not assign the values to them they will default to null, none or 0 depending upon the type of property. However, just because it defaults to a value does not mean that they will do their function. I would suspect based on what you have already said, the following two sections currently do nothing or produce errors in your papyrus log;Setting HP, Speed, Damage, Carry Weight, & Stamina;Setting condition for player to stagger if bigger than x2 normal size Link to comment Share on other sites More sharing options...
Reikel Posted June 3, 2014 Author Share Posted June 3, 2014 (edited) I found out the issue. Turns out that the program just wasn't loading after a save due to the event I was using (either playerloadgame or oninit). When I tied the script to a spell, it worked. I just have to find a way to load the mod while keeping my information in tact. Thanks for the help guys. Edited June 3, 2014 by Reikel Link to comment Share on other sites More sharing options...
Recommended Posts