palingard Posted September 5, 2016 Share Posted September 5, 2016 I was going to placetheitem at a marker in sky haven temple, SetItemHealthPercent, then move the item to the players inventory. I feel like it would be more immersive and lore friendly. That would also work I assume? thanks for your help!Might work. not a bad idea, let me know if it works as I might adjust my own script that I am working for personal crafting staff. Keep in mind that you will need to at least cast the form as an objectreference to call the function. Also, just thought, be careful if you are planning to use the "moveto" function as there is a warning in the wiki about it. given the distance you plan to move it, that shouldn't be a problem. Link to comment Share on other sites More sharing options...
irswat Posted September 5, 2016 Author Share Posted September 5, 2016 (edited) OK I found a table in sky haven temple. It's BaseId is 00024CB9, its FormID is 0006F223. I want to use placeatme: ObjectReference Property FangBlade Auto FangBlade = 0006F223.PlaceAtMe(weaponRef, 1) I guess I don't use the BaseID or FormID. Could anyone lend insight into what is meant by TargetMarker? ; Place a two new boxes at the target markerObjectReference oneOfTheBoxes = TargetMarker.PlaceAtMe(BoxBase, 2) Edited September 5, 2016 by irswat Link to comment Share on other sites More sharing options...
palingard Posted September 5, 2016 Share Posted September 5, 2016 I have never (not that says much) called a function using a FormID, but given that works and that weaponRef is cast as a Form, that looks right. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 5, 2016 Share Posted September 5, 2016 No. You cannot use form IDs directly in script. You must pass the object into a variable. Option #1Make a new property on your script and fill it with that item. ObjectReference Property myTable Auto {assign CommonTable01 refID 0006F223 from cell 000161EB SkyHavenTemple } ;later in the script use myTable.PlaceAtMe(weaponRef, 1)Option #2Use GetFormFromFile and obtain the desired form ObjectReference myTable = Game.GetFormFromFile(0x0006F223,"Skyrim.esm") as ObjectReference myTable.PlaceAtMe(weaponRef, 1) Option 2 is preferred when working with objects from other mods without making that mod a parent master to yours. Option 1 is preferred when the plugins is already a parent of your mod. Link to comment Share on other sites More sharing options...
palingard Posted September 5, 2016 Share Posted September 5, 2016 Read up on placeatme some more to see why someone would use DropObject instead. Placeatme creates a copy of the Item. it doesn't actually move the current item from inventory. So, using this will create a duplicate of the weapon, which you would then temper, leaving the original untouched. Since it is very clearly stated that it cannot be an objectreference, I think it makes a copy of the base, which means this method will only create a single temper, ever. You can possibly get around this by tracking the number of tempers separately. it won't work for my purposes as I am comparing existing temper to determine if I can improve each time. Link to comment Share on other sites More sharing options...
irswat Posted September 5, 2016 Author Share Posted September 5, 2016 thanks for the quick reply! Link to comment Share on other sites More sharing options...
irswat Posted September 5, 2016 Author Share Posted September 5, 2016 (edited) Read up on placeatme some more to see why someone would use DropObject instead. Placeatme creates a copy of the Item. it doesn't actually move the current item from inventory. So, using this will create a duplicate of the weapon, which you would then temper, leaving the original untouched. Since it is very clearly stated that it cannot be an objectreference, I think it makes a copy of the base, which means this method will only create a single temper, ever. You can possibly get around this by tracking the number of tempers separately. it won't work for my purposes as I am comparing existing temper to determine if I can improve each time.that's fine, because what I'm doing, I think, is making a copy of the original item and storing it as WeaponRef, Placing the copy on the table, tempering it, removing the original item from the inventory, adding the copy to inventory and then equipping the copy. Didn't work. Need to play with this some more. Weapon property adventurerdawnfang auto Weapon property tsasciduskblade auto ObjectReference property weaponRef auto Function GetKillLevel(Bool bIdentity) if (KillLevel==KillLevel As Int) && (DawnfangKillCount<=72) tempering=KillLevel*0.1 TemperWeapon(tempering,adventurerdawnfang,bIdentity,EquipHand) endif endFunction ;function modified from http://www.creationkit.com/index.php?title=SetItemHealthPercent_-_ObjectReference Function TemperWeapon(float btempering, ObjectReference weaponRef, bool WeapRef, int EH) FangBladeSpawn.PlaceAtMe(weaponRef, 1) weaponRef.SetItemHealthPercent(1 +btempering) Debug.Notification(weaponRef.GetName() + " tempering level" + (1 + btempering)) if (btempering==0.1) TemperedLevel="Fine " elseif (btempering==0.2) TemperedLevel="Superior " elseif (btempering==0.3) TemperedLevel="Exquisite " elseif (btempering==0.4) TemperedLevel="Flawless " elseif (btempering==0.5) TemperedLevel="Epic " elseif (btempering==0.6) TemperedLevel="Legendary " endif if (WeapRef==1) ;1=dawnfang 2=duskfang PlayerRef.RemoveItem(adventurerdawnfang) PlayerRef.AddItem(weaponRef,1,false) PlayerRef.EquipItemEx(weaponRef,EH,false,true) Debug.Notification(TemperedLevel + weaponRef.GetName() + " has been added!") else PlayerRef.RemoveItem(tsasciduskblade) PlayerRef.AddItem(weaponRef,1,false) PlayerRef.EquipItemEx(weaponRef,EH,false,true) Debug.Notification(TemperedLevel + weaponRef.GetName() + " has been added!") endif EndFunction problem is something is not working with the variable weaponRef. at 12 kills the blade gets taken, and it says the correct tempering level "1.1", but no weapon is added to the players inventory, and is thus not equipped. Then it says "Fine has been added!" SetItemHealthPercent is an ObjectReference function and weaponRef is declared as a ObjectReference, but when I pass it by reference to TemperWeapon() I'm passing it as a form, do you think that might be why it's not working? Edited September 5, 2016 by irswat Link to comment Share on other sites More sharing options...
palingard Posted September 5, 2016 Share Posted September 5, 2016 I think I see your problem. placeatme returns the objectreference of the object placed. In your script, weaponRef is still pointing to the original item that was in inventory. You need to do soemthing like weaponref2 = FangBladespawn.placeatme(weaponref, 1) ; and change the casting for weaponRef to be Form weaponRef in the parameters Then perform the remaining script lines on weaponref2, rather than weaponRef. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 5, 2016 Share Posted September 5, 2016 SetItemHealthPercent is an ObjectReference function and weaponRef is declared as a ObjectReference, but when I pass it by reference to TemperWeapon() I'm passing it as a form, do you think that might be why it's not working?Yes. You need to pass a specific instance. That's why palingard said he had to drop the one that the player was holding. Also, you are using a bool with GetKillLevel that you pass on into TemperWeapon which you then use to compare to an Int value and your comment refers to values of 1 and 2. Bools can resolve to 0 or 1, but I never know which is true or false so I prefer to stick with the true/false values. At any rate, made some tweaks to your snippet above. Double check it first. Since it wasn't your entire script there is room for error. Weapon property adventurerdawnfang auto Weapon property tsasciduskblade auto ObjectReference property FangBladeSpawn auto Function GetKillLevel(Bool bIdentity) if (KillLevel==KillLevel As Int) && (DawnfangKillCount<=72) tempering=KillLevel*0.1 If bIdentity == true TemperWeapon(tempering,adventurerdawnfang,bIdentity,EquipHand) else TemperWeapon(tempering,tsasciduskblade,bIdentity,EquipHand) EndIf endif endFunction ;function modified from http://www.creationkit.com/index.php?title=SetItemHealthPercent_-_ObjectReference Function TemperWeapon(float btempering, Form myWeapon, bool WeapRef, int EH) ObjectReference weaponRef = FangBladeSpawn.PlaceAtMe(myWeapon, 1) weaponRef.SetItemHealthPercent(1 +btempering) Debug.Notification(weaponRef.GetBaseObject().GetName() + " tempering level" + (1 + btempering)) if (btempering==0.1) TemperedLevel="Fine " elseif (btempering==0.2) TemperedLevel="Superior " elseif (btempering==0.3) TemperedLevel="Exquisite " elseif (btempering==0.4) TemperedLevel="Flawless " elseif (btempering==0.5) TemperedLevel="Epic " elseif (btempering==0.6) TemperedLevel="Legendary " endif if (WeapRef== true) ;true=dawnfang false=duskfang PlayerRef.RemoveItem(adventurerdawnfang) PlayerRef.AddItem(weaponRef,1,false) PlayerRef.EquipItemEx(weaponRef,EH,false,true) Debug.Notification(TemperedLevel + weaponRef.GetBaseObject().GetName() + " has been added!") else PlayerRef.RemoveItem(tsasciduskblade) PlayerRef.AddItem(weaponRef,1,false) PlayerRef.EquipItemEx(weaponRef,EH,false,true) Debug.Notification(TemperedLevel + weaponRef.GetBaseObject().GetName() + " has been added!") endif EndFunction >< got ninja'd but hey there are some other tweaks that may be of help. Link to comment Share on other sites More sharing options...
irswat Posted September 5, 2016 Author Share Posted September 5, 2016 (edited) thanks. This is the last piece to the puzzle so all three of you will definitely get mad props from me for the scripting help in the credits.blessings of the Divine. Edited September 5, 2016 by irswat Link to comment Share on other sites More sharing options...
Recommended Posts