Jump to content

HELP: How to make equipped weapon damage player/wielder?


Reymas

Recommended Posts

I'm looking for a simple way or script, barring a ton of coding, that would allow me to make a weapon damage the player over time when equipped. It's for a quest mod. I was thinking of attaching the life steal spell to a weapon but instead of occurring on target when hit, I'd want to apply the effect to the player whenever the weapon is equipped. I am not a programmer and have no idea where to even start with something like this. Are there any tutorials that could get me started maybe? Something to do with custom enchantments perhaps? Thanks in advance.

Link to comment
Share on other sites

Why not enchantment?

It should work, I've done it myself.
abdamagehealth/ abdrainhealth.. I think I got it working with "drain health".

It should be also possible to add conditions, for example, is equipped and so. (In combat?)


Edit:
Also, just for clarification, I don't mean the casual drain health effect. There is one which affects user.
As said, I tried it and got it working, but my CK is not on atm and it takes time to load it so I'm not gonna check the effect's name.

Edited by Guest
Link to comment
Share on other sites

Put this script on the weapon. It will do 2 damage to health every 2 seconds. Make sure to auto-fill the script properties.

You can change the "interval" and "magnitude" property values to your taste.

ScriptName _WeaponDamagePlayer extends ObjectReference

Actor Property playerREF auto
Float Property interval = 2.0 auto	; how ofter to apply damage, in seconds
Float Property magnitude = 2.0 auto	; how much damage to apply every interval

Event OnEquipped(Actor akActor)
	if akActor == playerREF
		RegisterForSingleUpdate(2)
	endIF
EndEvent

Event OnUnequipped(Actor akActor)
	if akActor == playerREF
		UnRegisterForUpdate()
	endIf
EndEvent

Event OnUpdate()
	playerREF.ModAV("health", -magnitude)
	if !playerREF.IsDead()	; check that the player is not dead
		RegisterForSingleUpdate(interval)
	endIf
EndEvent
Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...