Jump to content

Scripts not working.


Guest Suited Prawns

Recommended Posts

Guest Suited Prawns

I wrote this script for a mod im making, that basically just adds this mans heart to his corpse after he's been killed.

For some reason though the script wont run( I added a debug message to see if it was working at all). I've tried both OnDeath and Ondying but it dose not change anything :\

Scriptname DorianHeartScript extends Actor
{This script adds dorians heart after his untimely
demise.}

Actor Property keysDorian Auto
MiscObject Property DoriansHeartItem Auto

Event OnDying(Actor akKiller)
if akKIller == game.GetPLayer() 
  self.Additem(DoriansHeartItem,1 )
	debug.trace("ScriptRunning")
 Endif
EndEvent

The script compiles just fine but it dose not do anything ingame.

Hope you guys can get back to me quick and thanks in advance.

 

Link to comment

And, you've attached this to the Actor (probably, but just checking)? Are you (the player, or a "player teammate"/companion) actually the one killing the Actor?

 

I don't see anything wrong with it though.

 

As a note: when I have a more complicated script, I often put a debug.trace() line right after the Event line, to see if the event is occurring, and then one after each if/elseif/else line, and there might even be if's inside of those so I do those too. *Sarcastically*: See how confident I am in my scripting abilities!

Link to comment

Maybe you should use the OnDeath event, rather then OnDying.
i never used any of those, so i'm just guessing.

 

@TDF: Guess how many other modders add an hillarious amount of DebugOuts in their scripts, to shorten on time needed to debug faulty code? ^^

it's less about being not confident in the own code, but due to the fact that the CK simply has no debugger for Papyrus that one could attach.

Link to comment

In one of my older mods, I tried using both OnDying and OnDeath. At least on the Actors I was working with, both worked fine (OnDying triggering slightly earlier, seemingly at the start of the death animation - I'm not sure if that is strictly true - and OnDeath triggering after they have crumpled to the ground - again, I'm not certain whether they are necessarily hooked onto the start/end of the death anim).

Link to comment
Guest Suited Prawns

This one is really strange. I tries using both OnDeath and on Dying,and to see if that was the problem I even wrote another script that uses the OnHit event, detecting if the actor gets hit by the player and then just killing the actor and adding the item but the script still wont run. 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use