jman958 Posted October 20, 2011 Share Posted October 20, 2011 I wondering if anyone knew a script that I could put on any object that would cause health damage for as long as the player or an NPC was touching it Link to comment Share on other sites More sharing options...
Lanceor Posted October 21, 2011 Share Posted October 21, 2011 What's your current level of scripting knowledge? I assume you know the basics of creating and adding scripts to items, how to use a quest script if it is more appropriate. OBSE has a ModAttributeValue2 function that makes constant damage easy to do, but without it, you'll need to cast a spell on the player periodically instead. Here is a simple script that, when the item is equipped, will cast a spell on the wearer every 10 seconds: scn MyItemScript short timer Ref Wearer BEGIN GAMEMODE ; Checks what "container" the item is in. set Wearer to GetContainer ; Checks if the "container" has equipped the item, quits the script if not if ( Wearer.GetEquipped MyDamageItem == 0 ) Return endif set Timer to Timer + GetSecondsPassed if ( Timer >= 10 ) InvisibleActivatorRef.MoveTo Wearer InvisibleActivatorRef.Cast DamageTouchSpell Wearer set Timer to 0 endif END As with all scripting, there are many ways to accomplish the same thing and others might suggest something better. Also, the script hasn't been tested in-game so it may have bugs or speling mistakes. Link to comment Share on other sites More sharing options...
fg109 Posted October 21, 2011 Share Posted October 21, 2011 I think what he actually wanted was a script that would damage whoever happens to be touching the object, not just wearing it (if it's a piece of equipment in the first place). The best way to do this is to have the object be an activator with a trigger zone. Unfortunately, I have no idea how to make one, so I can't advise you on that. You would need to put these scripts on the object and an ability though: scn examplescript ref actor Begin OnTrigger set actor to GetActionRef actor.AddSpell SomeConstantDamageAbility End ============================================ scn examplescript2 Begin ScriptEffectUpdate if (GetDistance YourObject > SomeDistance) RemoveSpell SomeConstantDamageAbility enidf End Otherwise, if you don't intend to use an activator, you should put this script on the object: scn examplescript float timer ref me Begin GameMode set timer to timer + GetSecondsPassed if (timer >= 1) set timer to 0 set me to GetSelf SomeActivator.MoveTo me SomeActivator.Cast SomeAreaSpell SomeActivator endif End Link to comment Share on other sites More sharing options...
Recommended Posts