jshepler Posted September 9, 2012 Share Posted September 9, 2012 Interesting that GetBaseObject() returns None but self.GetBaseObject() didn't. I would have thought they'd return the exact same thing. GetBaseObject() returns a Form object which is the "root" type of objects like Armor and Weapon. Did you try casting (the 'as' operator) the result of GetBaseObject() to Armor like I did in my last example? Perhaps if you posted what you have. You never mentioned what your script extends. Link to comment Share on other sites More sharing options...
tnt90 Posted September 9, 2012 Author Share Posted September 9, 2012 All three scripts are in the spoiler tag in the 3rd post. The primary script we're dealing with here extends an object reference. Specifically an armor, it is designed such that the same script should be able to go on any armor. Currently you have to tell it via an armor property what the armor is the script is attached to, then from that it uses the keywords to determine the values for the armor. The goal here is to save time and not have to tell each script which armor it is on. I suppose I haven't tried casting the GetBaseObject() command but it would seem that if the raw command returns None then casting that wouldn't do me any better.self.GetBaseObject() very well could have returned None, its been a while since I tested that and I can't remember exactly. Don't really have time at the moment to go back and do it again, have a Java lab to finish up for Tuesday. Link to comment Share on other sites More sharing options...
jshepler Posted September 10, 2012 Share Posted September 10, 2012 Sorry, missed the spoiler tag... I wrote this quickie test script and it worked ScriptName armorTest Extends ObjectReference Armor thisArmor Event OnInit() thisArmor = self.GetBaseObject() as Armor If thisArmor Debug.MessageBox("thisAmor not none") EndIf EndEvent Event OnEquipped(Actor akActor) Debug.MessageBox("equipped") EndEvent I attached the script to a piece of armor (dragonscale boots), when I loaded a save I got "thisArmor not none" message. I had another script create a new instance of the boots and drop it at my feet. I picked it up and equipped it and got the "equipped" message. Link to comment Share on other sites More sharing options...
jshepler Posted September 10, 2012 Share Posted September 10, 2012 I wouldn't think it would, but could skse be interfering somehow? I only mention it as a point of difference - I don't have skse installed and you do. Link to comment Share on other sites More sharing options...
tnt90 Posted September 10, 2012 Author Share Posted September 10, 2012 (edited) Sweet, if you have a moment could you modify that to: ScriptName armorTest Extends ObjectReference Armor thisArmor Event OnInit() thisArmor = self.GetBaseObject() as Armor If thisArmor.haskeywordstring("ArmorBoots") Debug.MessageBox("these are boots") EndIf EndEvent Event OnEquipped(Actor akActor) Debug.MessageBox("equipped") EndEvent If that displays the boot message correctly for the boots you were testing, then the issue is solved. Edited September 10, 2012 by tnt90 Link to comment Share on other sites More sharing options...
jshepler Posted September 10, 2012 Share Posted September 10, 2012 Sure, gimme a few.. HasKeywordString requires skse and I don't have it. Link to comment Share on other sites More sharing options...
tnt90 Posted September 10, 2012 Author Share Posted September 10, 2012 Yeah, if you'd rather not download it, I can test it in a few hours here once I finish this code for class. Link to comment Share on other sites More sharing options...
jshepler Posted September 10, 2012 Share Posted September 10, 2012 Nah, it's fine.. I have it installed on my gaming rig, just hadn't put it on my dev box yet. It worked, got the "these are boots" message. Link to comment Share on other sites More sharing options...
tnt90 Posted September 10, 2012 Author Share Posted September 10, 2012 (edited) Alright, sounds like that does it then. I'll post back here later on when I implement that into the code and report if it all works. Thank you both. Edit: I saw it work twice. Returned the correct keywords. But after trying to get it to work with the rest of the script, nothing. Going to try for another 10 min or so. I think I've had enough coding for one day. Edited September 10, 2012 by tnt90 Link to comment Share on other sites More sharing options...
tnt90 Posted September 10, 2012 Author Share Posted September 10, 2012 Conclusions so far: If I call the self.GetBaeObject() in the OnContainerChange(...) event then it will return the armor successfully when I drop the armor but not when I pick it up.If I call the self.GetBaeObject() in an OnInit() event then adding it via console doesn't return armor correctly. And it doesn't appear to work on preexisting armors. (Note checking condition calls in the OnContainerChange(...) event.) Link to comment Share on other sites More sharing options...
Recommended Posts