Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Diablo III style Exploding Palm Script


SkyrimModHunter
 Share

Recommended Posts

Hi!  Thank you in advance for any help that you may provide.

 

My goal is to hit a target and apply a magic effect when poisoning an enemy.  If the enemy dies while poisoned, I want them to explode and deal X% of their total health to enemies within Y distance.  Using the creation kits "target conditions" and the below script, I've had some success. 

 

Scriptname yyyDrowOnKillShadowScourge extends ActiveMagicEffect  

Event OnDying(actor akKiller)
Debug.Notification("an enemy has died!")
    if (akKiller == game.getPlayer())
            Debug.Notification("The player has killed something! SUMMON FLAME ATRONACH!")
            Spell_Tier0.cast(akKiller,akTarget = None)
            else
            Debug.Notification("The player did not kill that enemy...")
        endif
EndEvent

Spell Property Spell_Tier0 Auto

 

So far, I've managed to mark the poisoned target with a magic effect and upon death cast a spell.  The only spell that I've successfully cast was "ConjureFlameAtronach" and it only triggers if I kill something while being very close to it (maybe a lenght of space equal to the character's height away)

 

I think the script's weakness is that AkTarget = None.  I don't know how to define AkTarget.  Is there a way to clarify what actor(s) is/are akTarget? 

 

----------------------------------------------------------

 

Finally, if I can get enough help to get the spell firing all of the time, then I'd like to move onto creating the script that will deal damage equal to a percentage of whatever died's max health, to all enemies within Y distance of their dead corpse. 

 

I think it a script similar to this will be needed, but I can't get this one to compile.

 

Scriptname yyyShadowScourgeKillBonusExplosion extends ActiveMagicEffect  

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Debug.Trace("Magic effect was started on " + akTarget)
    Float TargetMaxHealth
    TargetMaxHealth = akTarget.GetAV("health")
    akTarget.DamageActorValue("health", TargetMaxHealth * .25)

endEvent

 

If if I did get it to compile, I fear that the script would only be attempting to damage the dead targets health bar, rather than the health of those around it...  Might anyone have suggestions for this one too?  I'm  reading up on scripting where ever possible, but am still very very ignorant of how just about everything works.

Link to comment
Share on other sites

  • 5 months later...

I've returned back to this spell and have had some success, but am still searching for help.

 

I can now get the game to cast a invisible MarkerX at an actors location if they've died while poisoned.  This MarkerX is then used to trigger an explosion by placing a trap at a specified location.  I think the final piece of the puzzle is to attach a script to the trap that causes the X% of max health damage.  My current problem is that I don't want to attach a script to the game's default trap, but rather I want to duplicate the trap I've been referencing and attach a script to the new trap, so that the origional game's trap remains fully intact.

 

Here's the script that casts the trap ID# 00082E18.

 

Scriptname yyyShadowScourgeExplosionMarker extends ObjectReference  

ObjectReference refPutridExplosion

Event OnInit()
    refPutridExplosion = SELF.PlaceAtMe(Game.GetForm(0x
00082E18))
    RegisterForSingleUpdate(0.5) ;; this adds a .5 second delay
EndEvent

Event OnUpdate()
    refPutridExplosion.Enable()
    refPutridExplosion.damageObject(5.0)
    SELF.Delete() ;; Destructs xMarker
EndEvent

 

When duplicating the trap, I come up with a new ID# of 042D6B15; however, when I swap out 00082E18 for 042D6B15, no explosion happens.  I suspect that the "0x" in front of the 00082E18 is some sort of form list reference that needs to match up with something to do with my mod's install number.  Is that true?  How can I make the new trap work without preventing the script from working no matter what order someone might have it installed (if that is indeed my problem)?

 

    refPutridExplosion = SELF.PlaceAtMe(Game.GetForm(0x042D6B15))  // When I make this change nothing happens.  :unsure:
 

EDIT: After some more diggering, maybe 042D6B15 needs to be placed in game somewhere, before I can call upon it in the above script.  Might that be the case? 

Edited by SkyrimModHunter
Link to comment
Share on other sites

Thank you for the help Schatten; however, I'm a very beginner for scripting.  I typically have to guess and check for hours to get anything to work. 

 

Might you be able to toss together an example script that I could yse as a reference, or point me to a link where I could read up on how to do what you've described above? 

Link to comment
Share on other sites

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

http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Introduction_to_Properties_and_Functions

 

You can use the script you posted. It is perfectly valid (I guess. Never worked with traps, though), just change two things:

 

First you need to add a property. I think there is a property of type trap? Then link it to the duplicated trap you made.

Replace

refPutridExplosion = SELF.PlaceAtMe(Game.GetForm(0x00082E18))

With

refPutridExplosion = SELF.PlaceAtMe(name_of_your_property)

 

And try if it works.

Edited by schatten
Link to comment
Share on other sites

Schatten, you were right on the money.  Here's how I ended up modifying the script to have the game correctly call out the new trap.  I basically learned that if you've got a form ID, you should figure out what kind of property to call it out as in a script, so that you can map to it in the property manager and thereby allow the CK to keep everything straight, without having to define the load order into which the mod will end up getting placed.  Does that sound right?  I'm still trying to learn enough of papyrus to be dangerous, but feel like I'm still on the "Hello World" tutorial.  :sad:

 

Scriptname yyyShadowScourgeExplosionMarker extends ObjectReference  

ObjectReference refPutridExplosion

Event OnInit()
    refPutridExplosion = SELF.PlaceAtMe(yyyShadowScourgeExplosiveGasTrap)
    RegisterForSingleUpdate(0.5) ;; this adds a .5 second delay
EndEvent

Event OnUpdate()
    refPutridExplosion.Enable()
    refPutridExplosion.damageObject(5.0) ;; makes the poison start damaging in the AOE
    SELF.Delete() ;; Destructs xMarker
EndEvent

Activator Property yyyShadowScourgeExplosiveGasTrap Auto

 

 

Now that I'm able to tweak the new trap without worrying about messing up vanilla files, here's the script that I've been working on to try and attach to the new trap.  It's failing horribly.  I can't even get it to compile... any suggestions would be appreciated! 

 

Scriptname yyyShadowScourgePutridExplosionDamage extends ObjectReference  

    int level = Game.GetPlayer().GetLevel()


Event OnTrapHit(ObjectReference akTarget, float afXVel, float afYVel, float afZVel, float afXPos, float afYPos, \
    float afZPos, int aeMaterial, bool abInitialHit, int aeMotionType)

        Float TargetMaxHealth = akTarget.GetAV("MaxHealth")

        if (level >= 60)
            akTarget.DamageActorValue("health", TargetMaxHealth * 1.0)
            Debug.Notification("Explosion dealt 100% of targets max life")
        elseif (level >= 50)
            akTarget.DamageActorValue("health", TargetMaxHealth * .75)
            Debug.Notification("Explosion dealt 75% of targets max life")
        elseif (level >= 40)
            akTarget.DamageActorValue("health", TargetMaxHealth * .50)
            Debug.Notification("Explosion dealt 50% of targets max life")
        elseif (level >= 30)
            akTarget.DamageActorValue("health", TargetMaxHealth * .35)
            Debug.Notification("Explosion dealt 35% of targets max life")
        elseif (level >= 20)
            akTarget.DamageActorValue("health", TargetMaxHealth * .30)
            Debug.Notification("Explosion dealt 30% of targets max life")
        elseif (level >= 0)
            akTarget.DamageActorValue("health", TargetMaxHealth * .25)
            Debug.Notification("Explosion dealt 25% of targets max life")
        else
            Debug.Notification("Putrid Explosion has failed to deal any damage to one of the hit actors!")
        endif

EndEvent

Edited by SkyrimModHunter
Link to comment
Share on other sites

What compilation error?

 

I see on first glance that you didn't cast the objectreference to actor. You do it like this

actor aktargetactor

aktargetactor = akTarget as actor

 

Now you can use getav on aktargetactor

 

I am sure that maxhealth is not an av.

Check here for max values:

http://www.creationkit.com/GetActorValuePercentage_-_Actor

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...