Jump to content

Photo

Casting spell on player without object refrence

spell cast

  • Please log in to reply
4 replies to this topic

#1
WildWitch

WildWitch

    Enthusiast

  • Members
  • PipPip
  • 171 posts

Hiya Im writing a script that applies a blessing to a player when they release a soul from a soulgem via a spell. I want to make it so that greater, common, lesser, petty soulgems cause the player to recieve a blessing. Heres what I have so far

 

Scriptname zzz_ReleaseWhiteSoulScript extends activemagiceffect  
 
SoulGem Property SoulGemGrand  Auto
SoulGem Property SoulGemGreater  Auto
SoulGem Property SoulGemCommon  Auto
SoulGem Property SoulGemLesser  Auto
SoulGem Property SoulGemPetty  Auto
MiscObject Property SoulGemShards  Auto
Sound Property FailureSFX  Auto
message property failureMSG auto
message property SuccedGrandMSG auto
message property SuccedGreaterMSG auto
message property SuccedCommonMSG auto
message property SuccedLesserMSG auto
message property SuccedPettyMSG auto
Spell property BlessingGreater auto
Spell property BlessingCommon auto
Spell property BlessingLesser auto
Spell property BlessingPetty auto

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    objectReference caster = akCaster
    if caster.getItemCount(SoulGemGrand) >= 1
        caster.removeItem(SoulGemGrand, 1, TRUE)
        Game.GetPlayer().ModActorValue("magicka", 2)
        caster.addItem(SoulGemShards, 2, FALSE)
        SuccedGrandMSG.show()
    elseif caster.getItemCount(SoulGemGreter) >= 1
        caster.removeItem(SoulGemGreater, 1, TRUE)

-->
        caster.addItem(SoulGemShards, 2, FALSE)
        SuccedGreaterMSG.show()
    elseif caster.getItemCount(SoulGemCommon) >= 1
        caster.removeItem(SoulGemCommon, 1, TRUE)
--->
        caster.addItem(SoulGemShards, 2, FALSE)
        SuccedCommonMSG.show()
    elseif caster.getItemCount(SoulGemLesser) >= 1
        caster.removeItem(SoulGemLesser, 1, TRUE)
--->
        caster.addItem(SoulGemShards, 2, FALSE)
        SuccedLesserMSG.show()
    elseif caster.getItemCount(SoulGemPetty) >= 1
        caster.removeItem(SoulGemPetty, 1, TRUE)
--->
        caster.addItem(SoulGemShards, 2, FALSE)
        SuccedPettyMSG.show()
    else
        FailureSFX.play(caster)
        failureMSG.show()
    endif
endEVENT

 

As you can see there are gaps where the spell cast function should be as I have no idea how to do it.



#2
lofgren

lofgren

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,107 posts

Make the spells cast on self and have the player cast them. That is the way that shrines do it.



#3
WildWitch

WildWitch

    Enthusiast

  • Members
  • PipPip
  • 171 posts

Make the spells cast on self and have the player cast them. That is the way that shrines do it.

So I just need to put in (blessing Name).cast(playerRef, playerRef) ?



#4
lofgren

lofgren

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,107 posts

Based on the script you have here, it could be (Blessing Name).Cast(akCaster)



#5
WildWitch

WildWitch

    Enthusiast

  • Members
  • PipPip
  • 171 posts

Ok thanks I got it to work :)







Also tagged with one or more of these keywords: spell, cast

Page loaded in: 1.130 seconds