Jump to content

V. simple spell gone awry


Recommended Posts

Hi,

I'm trying to test something and it involves a spell which is cast when entering a cell. For debugging purposes the two scripts I'm using have been reduced to:

 

 

 

Scriptname dz_location_finder Extends ObjectReference
Event OnCellAttach()

Actor PlayerRef = Game.GetPlayer()

Spell dz_get_location

debug.notification("Casting location spell")

dz_get_location.Cast(PlayerRef,PlayerRef)
EndEvent

 

 

 

 

 

Scriptname WhereAmI Extends MagicEffect
Actor  Property PlayerRef    Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)

;/ ;;find location

Keyword LocTypeHabitation

;ObjectReference PlayerRef = Game.GetPlayer()

Location playerLoc = PlayerRef.GetCurrentLocation()

Bool Habit

;;add to variable

If playerLoc.HasKeyword(LocTypeHabitation)

Habit = True

Else

Habit = False

EndIf /;
debug.notification("Habitation")

EndEvent

 

 

 

I get the first debug notification - "Casting location spell", but no matter what options I choose for the magic effect and the spell in the creation kit; I cannot get the debug notification "Habitation" to fire.

 

The first script is attached to a trigger box just inside the Solitude gate (only because I know that OnCellAttach will work with that).

The second is used to make a magic effect which inturn is used for a spell.

 

I'd dearly loive to know where I'm going wrong here.

 

 

diziet

Link to comment
Share on other sites

Your second script needs to extend ActiveMagicEffect , not MagicEffect.

Wow! :)

Thankyou, didn't realise you could make mistakes there and still compile, so never thought to look!

However. now I can only get the "Habitation" message once every load i.e as soon as the game loads, even if that is into an interior cell that isn't in Solitude. The "Casting location spell" still happens everytime when entering Solitude so I think it's about the options for magic effect and spell in the CK. Any ideas?

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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