ExoArchivist Posted November 14, 2019 Share Posted November 14, 2019 So first off I'm rather new to making custom weapon enchantments/effects, and second off I'm not sure if something like this is even really possible, but I've got an idea for a unique weapon as a quest reward for a little project I'm working on and I'm wondering if it's possible, and if so, how best to go about doing it. Basically I've yet to work out the exact mechanics but we'll use a damage bonus as an example. I'd like, in this instance, for the weapon to do additional damage equal to the number of septims the target NPC has in their inventory. For example the weapon has, say, 40 base damage. The player hits an NPC with 81 septims in their (the NPC's) inventory. Thus the weapon hits for a total of 121 damage. Thanks for any possible help! Link to comment Share on other sites More sharing options...
thumbincubation Posted November 16, 2019 Share Posted November 16, 2019 The Tax Man's Axe? Link to comment Share on other sites More sharing options...
ExoArchivist Posted November 16, 2019 Author Share Posted November 16, 2019 The Tax Man's Axe?A good name for it if nothing else! Link to comment Share on other sites More sharing options...
ReDragon2013 Posted November 17, 2019 Share Posted November 17, 2019 (edited) hmm.. maybe next code is working for you.. keep in mind you need a quest and playerAlias for that.. additional to your special weapon exoaTaxManWeaponScript Scriptname exoaTaxManWeaponScript extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/8146748-custom-weapon-enchantment-scripting-questions/ ReferenceAlias PROPERTY PlayerAlias auto ; fill with alias which has attached "exoaTaxManPlayerAliasScript" ;;Perk PROPERTY myTaxPerk auto ; a new created perk like SilverPerk, see SilverSowrd.psc ; -- EVENTs -- 2 EVENT OnEquipped(Actor akActor) IF (akActor == Game.GetPlayer()) (PlayerAlias as exoaTaxManPlayerAliasScript).myF_StoreDamageModifier(akActor, TRUE) ;;; akActor.AddPerk(myTaxPerk) ENDIF ENDEVENT EVENT OnUnEquipped(Actor akActor) IF (akActor == Game.GetPlayer()) (PlayerAlias as exoaTaxManPlayerAliasScript).myF_StoreDamageModifier(akActor, False) ;;; akActor.RemovePerk(myTaxPerk) ENDIF ENDEVENT exoaTaxManPlayerAliasScript Scriptname exoaTaxManPlayerAliasScript extends ReferenceAlias ; https://forums.nexusmods.com/index.php?/topic/8146748-custom-weapon-enchantment-scripting-questions/ MiscObject PROPERTY Gold001 auto ; use autofill in CK Weapon PROPERTY myWeapon auto ; the weapon baseobject you have created and script from above should be attached Int PROPERTY iDamageModifierTMW auto Hidden Conditional ; an int for using in perk or as multiplier in CK for weapon damage ; -- EVENTs -- EVENT OnInit() self.AddInventoryEventFilter(Gold001 as Form) ENDEVENT EVENT OnPlayerLoadGame() ENDEVENT EVENT OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) IF ( akSourceContainer ) ; only allow chests or valid trading for incoming septimes myF_Action() ENDIF ENDEVENT EVENT OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) myF_Action() ENDEVENT ; -- FUNCTIONs -- 3 ;------------------------------------------ Bool FUNCTION myF_IsWeaponOK(Actor akActor) ;------------------------------------------ IF (akActor.GetEquippedWeapon(TRUE) == myWeapon) Return TRUE ; left hand ENDIF ;--------- IF (akActor.GetEquippedWeapon(False) == myWeapon) Return TRUE ; right hand ENDIF ;--------- Return False ; special weapon not equipped ENDFUNCTION ;-------------------- FUNCTION myF_Action() ;-------------------- actor player = self.GetActorReference() IF myF_IsWeaponOK(player) myF_StoreDamageModifier(player, TRUE) ENDIF ENDFUNCTION ;-------------------------------------------------------- FUNCTION myF_StoreDamageModifier(Actor akActor, Bool bOK) ;-------------------------------------------------------- IF ( !bOK ) IF myF_IsWeaponOK(akActor) ELSE iDamageModifierTMW = 1 RETURN ; - STOP - weapon not equipped ENDIF ; ---------------------- ENDIF int l = akActor.GetLevel() int i = akActor.GetItemCount(Gold001 as Form) IF (l < 10) ; 1..9 i = 1 + (i / 1000) ELSEIF (l < 25) ; 10..24 i = 1 + (i / 10000) ELSEIF (l < 50) ; 25..49 i = 1 + (i / 50000) ELSEIF (l < 75) ; 50..74 i = 1 + (i / 100000) ELSEIF (l < 100) ; 75..99 i = 1 + (i / 500000) ELSE ; >= 100 i = 1 + (i / 1000000) ENDIF IF (i > 100) i = 100 ; maximum allowed ENDIF iDamageModifierTMW = i ENDFUNCTION Edited November 17, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
Recommended Posts