Need help with weapon script.

Post » Fri Nov 16, 2012 10:18 pm

Currently I'm trying to write a script where if the player isn't a vampire, they are injured for using a cursed vampire weapon. Here's what I've compiled so far:

scriptName VampireWeaponEnch extends ActiveMagicEffect
{Scripte effect makes it so if player is not vampire, they take damage}



Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

akAggressor = Game.GetPlayer()

if Game.GetPlayer().HasKeyword(ActorTypeUndead)

if akWeapon
Game.GetPlayer().DamageAV("health", 0)
endif

if akProjectile
Game.GetPlayer().DamageAV("health", 0)
endif

if abPowerAttack
Game.GetPlayer().DamageAV("health", 0)
endif

if abSneakAttack
Game.GetPlayer().DamageAV("health", 0)
endif

if abBashAttack
Game.GetPlayer().DamageAV("health", 0)
endif

if abHitBlocked
Game.GetPlayer().DamageAV("health", 0)
endif

else


if akWeapon
Game.GetPlayer().DamageAV("health", 5)
endif

if akProjectile
Game.GetPlayer().DamageAV("health", 0)
endif

if abPowerAttack
Game.GetPlayer().DamageAV("health", 15)
endif

if abSneakAttack
Game.GetPlayer().DamageAV("health", 10)
endif

if abBashAttack
Game.GetPlayer().DamageAV("health", 0)
endif

if abHitBlocked
Game.GetPlayer().DamageAV("health", 0)
endif
endif
EndEvent

Honestly I don't even know if I'm on the right path; if anyone can lend a hand I'd be very appreciative!
User avatar
Gavin boyce
 
Posts: 3436
Joined: Sat Jul 28, 2007 11:19 pm

Post » Fri Nov 16, 2012 7:33 pm

Why do u need to script this?
Cant this be made with Target Conditions?

-Exo
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm

Post » Sat Nov 17, 2012 1:45 am

Actually I hadn't thought of that (I've been so obsessed with trying to understand Papyrus that it didn't occur to me).

But now I have a new problem:

I have two different Magic Effects for the Enchantment. One causes extra damage when the player [HasKeyword - Vampire] == 1. The other causes damage via script when the player [HasKeyword - Vampire] == 0. However I'm not seeing the effects happen in-game. What do I do now?
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Fri Nov 16, 2012 3:05 pm

Still having trouble; target conditions don't seem to be working. Should I be using [HasKeyword] for the condition funtion and should I run on [Player]?

Also is this script correct for self-inflicting damage?

Scriptname VampireEnchantment extends activemagiceffect

Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
actor actorRef = akAggressor as Actor

if akAggressor == Game.GetPlayer()

if akWeapon
(akAggressor as Actor).DamageAV("health", 5)
endif

if akProjectile
(akAggressor as Actor).DamageAV("health", 0)
endif

if abPowerAttack
(akAggressor as Actor).DamageAV("health", 10)
endif

if abSneakAttack
(akAggressor as Actor).DamageAV("health", 10)
endif

if abBashAttack
(akAggressor as Actor).DamageAV("health", 0)
endif

if abHitBlocked
(akAggressor as Actor).DamageAV("health", 0)
endif

endif

EndEvent
User avatar
Kaylee Campbell
 
Posts: 3463
Joined: Mon Mar 05, 2007 11:17 am


Return to V - Skyrim