[Papyrus] Spell for clearing locations

Post » Mon Jun 18, 2012 9:23 am

Hey,
I currently try to get used to the new scripting language, so I thought of starting with some simple tasks. I want to create a spell which clears/unclears a location, so you can choose whether the place gets the "cleared" flag on your map or not. I ended up with this:

Scriptname MM_ClearLoc extends ActiveMagicEffect  {Clears or unclears Location on Spell use}Event OnEffectStart(Actor akTarget, Actor akCaster)    if akCaster.GetCurrentLocation().IsCleared()        akCaster.GetCurrentLocation().SetCleared(false)    else        akCaster.GetCurrentLocation().SetCleared()    endifEndEvent

but apparently this doesn't work (actually, nothing happens at all). I think, I set up the magic effect and spell stuff correctly.
so is there anything in here, which does not look kosher?
User avatar
Crystal Clear
 
Posts: 3552
Joined: Wed Aug 09, 2006 4:42 am

Post » Mon Jun 18, 2012 10:01 pm

Looks fine to me, try adding a http://www.creationkit.com/Notification_-_Debug in there to make sure it's running.

Cipscis
User avatar
Nancy RIP
 
Posts: 3519
Joined: Mon Jan 29, 2007 5:42 am

Post » Tue Jun 19, 2012 1:22 am

hm, included some random messageboxes (notification was not displaying many letters...):
Scriptname MM_ClearLoc extends ActiveMagicEffect {Clears or unclears Location on Spell use}Actor casterlocation property fixedloc autoEvent OnEffectStart(Actor akTarget, Actor akCaster)Debug.Messagebox("Caster=" + akCaster + " , current loc=" + akCaster.GetCurrentLocation())caster=akCasterDebug.Messagebox("caster:" + caster + " target:" + akTarget)if caster.GetCurrentLocation().IsCleared()  Debug.Messagebox("is cleared")  caster.GetCurrentLocation().SetCleared(false)else  Debug.Messagebox("is not cleared")  caster.GetCurrentLocation().SetCleared()endifif fixedloc.IsCleared()  fixedloc.SetCleared(false)else  fixedloc.SetCleared()endifEndEvent
every messagebox appears correctly, the only thing which does not work is this setcleared stuff...
I even added a static location. this also doesn't get cleared...
actually I checked some beth scripts, where they write this:
Self.GetCurrentLocation().SetCleared()
which is exactly the same, I have.
I've no clue, whats going wrong :wallbash:
User avatar
Prohibited
 
Posts: 3293
Joined: Tue Jun 12, 2007 6:13 am


Return to V - Skyrim