NameNotPresent Posted June 24, 2016 Share Posted June 24, 2016 I am trying to make a script to disarm an opponents weapon, it is quite tricky. :psyduck: Also I am concerned about this causing save game bloat so I may also need a way to remove the weapon if it is not recovered, but how could I do that if the player is not in the same cell as the weapon? :confused: Link to comment Share on other sites More sharing options...
Surilindur Posted June 24, 2016 Share Posted June 24, 2016 (edited) <snip> Edit: Refer to Maskar's response below. Edited June 24, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
Maskar Posted June 24, 2016 Share Posted June 24, 2016 I really don't recommend using drop as it will cause savegame bloating. Link to comment Share on other sites More sharing options...
lubronbrons Posted June 25, 2016 Share Posted June 25, 2016 post your script here then maybe we can help, fyi this syntax may help to achieve what you need GetInvRefsForItem click to read more about savegame bloat issue, this mod may help to reduce it >>> kuertee Clean Up Link to comment Share on other sites More sharing options...
Oblivionaddicted Posted June 27, 2016 Share Posted June 27, 2016 By "desarming an opponent's weapon" do yo mean unenchanting it? Link to comment Share on other sites More sharing options...
NameNotPresent Posted July 1, 2016 Author Share Posted July 1, 2016 (edited) By "desarming an opponent's weapon" do yo mean unenchanting it?No, I want the weapon to be knocked out of their hands, just like the special bonus from a side power attack. if target.GetFatiguePercentage < .25 ;Chance to disarm target set DisarmChance to GetRandomPercent +1 if DisarmChance <=100 set WeaponOfTarget to target.GetEquippedObject 16 ;get target's weapon Let WeaponOfTargetArray := target.GetInvRefsForItem WeaponOfTarget ForEach TempArray <- WeaponOfTargetArray Let temp := TempArray["value"] if temp.IsEquipped ==1 temp.unequipme temp.DropMe ;temp.MoveToMarker target break endif loop endif endif Here is the disarm part of the script as it stands now. I don't think I am iterating over the array correctly. I know I can iterate over the whole inventory but this is more efficient. When I was iterating over the whole inventory the "MoveToMarker" part crashed the game. There was another method I tried that also crashed the game. Note conditions for the disarm have not been determined, I need to get the disarm working first. What currently happens is the weapon is unequipped but not dropped. Edited July 1, 2016 by NameNotPresent Link to comment Share on other sites More sharing options...
lubronbrons Posted July 1, 2016 Share Posted July 1, 2016 scn testDisarm ref target ref WeaponOfTarget array_var TempArray ref temp ref temp ref rf1 ref rf2 short sh1 float fl1 short removeOne if removeOne Let removeOne := 0 target.RemoveItemNS WeaponOfTarget 1 endif if target.GetFatiguePercentage < .25 ;Chance to disarm target if GetRandomPercent < 30 ;30% disarm chance Let WeaponOfTarget := target.GetEquippedObject 16 ;get targets weapon if WeaponOfTarget ForEach TempArray <- target.GetInvRefsForItem WeaponOfTarget Let temp := *TempArray if temp.IsEquipped Let rf1 := CreateTempRef WeaponOfTarget Let fl1 := temp.GetCurrentHealth rf1.SetCurrentHealth fl1 Let fl1 := temp.GetCurrentCharge rf1.SetCurrentCharge fl1 Let rf2 := target.PlaceAtMe rf1 1 25 0 Let sh1 := target.GetPos z + 25 rf2.SetPos z sh1 Let removeOne := 1 break endif loop endif endif endif Link to comment Share on other sites More sharing options...
Surilindur Posted July 1, 2016 Share Posted July 1, 2016 How does the PlaceAtMe command in the post by lubronbrons compare to the Drop command? Maskar mentioned the Drop command could cause some savegame bloating, but how is PlaceAtMe different from it? Also, if the inventory item is removed, and a new one created, how would that affect persistent references, if a persistent weapon ref is picked up, equipped and disarmed? Or does persistent weapon ref exist as a concept? Just a few questions that popped in mind, out of curiosity. :blush: Link to comment Share on other sites More sharing options...
lubronbrons Posted July 1, 2016 Share Posted July 1, 2016 for savegame bloat issue we can trust kuertee Clean Up mod, at least... :ermm: but, to get a good clean script. preferably you should clean the mess by yourself using syntax Disable and DeleteReference that is the best way to handle and prevent savegame bloat I think. since the PlaceAtMe command is pretty useful anyway, I believe Maskar use some of PlaceAtMe too, but he clean the reference too with Disable and DeleteReference so no problem..... ahh yeah ! I am still wondering why you change your name from Phillipetain to Contratethix ? :) Link to comment Share on other sites More sharing options...
Maskar Posted July 1, 2016 Share Posted July 1, 2016 I wouldn't use PlaceAtMe or Drop for disarming. Sure, you could build in some garbage collecting code, but I don't think it's worth the trouble/risk of bloating. It might be possible to trigger Oblivion's disarm function somehow, although I've never looked into that. Link to comment Share on other sites More sharing options...
Recommended Posts