Script enable - tracking what spell hits

Post » Sun May 18, 2014 8:35 am

Greetings.
For the mod I'm working on I'm trying to setup a script that enables a series of items and unlocks a door when a static item is hit by a specific spell. It sounded simple enough in my head, and I've gotten some it done.
Scriptname GAHEnableOnHitFireBreath extends ObjectReference ObjectReference Property GAHSewersXmarkFire AutoEvent OnHitGAHSewersXmarkFire.enable()EndEvent
the enable part was simple enough to get to work, but to get the script to check for a specific spell and unlocking the door (its a load door) for the player to use. I have an idea of how i should get it done but can't seam to find the information i need to make it work. And i have to write within an if/endif statement, along the lines of what i have below.
Scriptname GAHEnableOnHitFireBreath extends ObjectReference ObjectReference Property GAHSewersXmarkFire Auto((a line here with the spell property/name...))Event OnHit((ObjectReference for the spell, i think))  if akAggressor == game.getPlayer()  GAHSewersXmarkFire.enable()endifEndEvent
Would be great if someone could direct me to a wiki site with more info on how i can get this done, or can help me with pointers to make it work
User avatar
Amanda Furtado
 
Posts: 3454
Joined: Fri Dec 15, 2006 4:22 pm

Post » Sun May 18, 2014 12:32 pm

http://www.creationkit.com/OnHit_-_ObjectReference

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

Your spell should be in akSource or akProjectile.
User avatar
Steeeph
 
Posts: 3443
Joined: Wed Apr 04, 2007 8:28 am

Post » Sun May 18, 2014 3:01 am

cheers Mojo
though that was the easy bit, getting the script to check if its hit by a specific spell (ie asigning the akSource) has proven a bit tricky. In short i need the script to only fire if the static iten is hit by the spell "flames"
and some way to block the use of a load door until (either via lock or other means apart from blocking it off) until the script alows the use of the door
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Sat May 17, 2014 9:03 pm

So something probably simple like...

Spell Property Flames AutoEvent OnInit() ;I think this event should work to initially block the door  Self.BlockActivation() ;if you want to use this method to block door accessendEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)  if (akSource as Spell) == Flames	Self.BlockActivation(false) ;or whatever your script is  endIfendEvent

As a suggestion, if you want the door to work on all fire spells, you could probably try something like this instead...

Keyword Property MagicDamageFire AutoEvent OnInit()  Self.BlockActivation()endEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)  if akSource.HasKeyword(MagicDamageFire)	Self.BlockActivation(false)  endIfendEvent
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Sun May 18, 2014 12:35 pm

me and those properties /bonk.gif' class='bbc_emoticon' alt=':bonk:' /> hadent checked my spelling in my property section of my script.
As for the door, wouldent it be simpler to use
DoorRefID.unlock
and simply give my load door a refIDname and lock it so it can only be opened by key but not make the key, and from the script in same section as my enable marker fire that unlock command?
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Sun May 18, 2014 11:15 am

Locking/unlocking the door sounds better. The function is
Lock(false)
http://www.creationkit.com/Lock_-_ObjectReference You can refer to the door as a ObjectReference Property.

Keyword Property MagicDamageFire AutoObjectReference Property DoorRef AutoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	if akSource.HasKeyword(MagicDamageFire)		DoorRef.Lock(false)		Self.Disable() ;disable the fire marker the script is attached to?	endIfendEvent

I suppose you could also ref to the DoorRef has a reference alias through a quest, and then stop the quest when you're done. Using objectreference properties makes objects permanently persistent, although I'm not sure if this is really a problem for something simple like a door http://www.creationkit.com/Persistence_(Papyrus)

Edit - That link is not working due to some weird formatting thing with the forums, just search for persistence in the wiki to find the page if you care about it. Again probably not a big deal.
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Sat May 17, 2014 9:57 pm

resolved, thank you Mojo22
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am


Return to V - Skyrim