Jump to content

What's wrong with this short script?


Mayfly53

Recommended Posts

Hey guys,

 

I'm a neophyte when it comes to Papyrus, and I'm trying to make a Power which will fix a bug in Dawnguard for my custom race mod, when the bug occurs.

 

I'm not sure how to make a power/ magic effect, but I've made an attempt. Could anyone point me in the right direction with it? It's very short and simple.

 

Scriptname DawnguardDebug extends ObjectReference

Event OnActivate(ObjectReference akActionRef)
player.SetRace(ArgonianVampireBlue)
endEvent

 

This is the Compiler output:

Starting 1 compile threads for 1 files...

Compiling "DawnguardDebug"...

 

C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DawnguardDebug.psc(4,1): variable player is undefined

C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DawnguardDebug.psc(4,16): variable ArgonianVampireBlue is undefined

C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DawnguardDebug.psc(4,8): none is not a known user-defined type

No output generated for DawnguardDebug, compilation failed.

 

It's based on the SetRace function of the Actor script, but I don't think it's right. Also, I know that the (ObjectReference akActionRef) is more geared for interactions with an object in the world, how would I go about making this a magic effect to be applied with a power?

 

The power is set up as a Script effect archetype, with a fire and forget casting type targeting self.

 

Thanks!

Link to comment
Share on other sites

Thank you, that helped.

I still have one error. What do I define my custom race's vampire race as? In the CK, it's ID'd as ArgonianVampireBlue. I've tried entering "ArgonianVampireBlue" and "ArgonianVampireBlueRace". Neither work, what would it be defined as? Or do I have to make a definition myself?

Link to comment
Share on other sites

Okay, so I'm still stymied about defining my custom race in the script. But I also want to ask, since this is going to be a magic effect for a spell/ power, should I use
Event OnActivate(ObjectReference akActionRef)

or

Event OnInit()

?

Link to comment
Share on other sites

Okay, I figured out how to add a property to the script which defines ArgonianVampireBlue as being my custom race's vampire version.

I also changed the script to this:

Scriptname DawnguardDebug extends ObjectReference
{Fixes Race being treated as mortal after transforming back from Vampire Lord}

Event OnInit()
if (Game.GetPlayer().GetRace() !=ArgonianVampireBlue)
	Game.GetPlayer().SetRace(ArgonianVampireBlue)
endif
endEvent
Race Property ArgonianVampireBlue  Auto  

 

It compiled correctly, so hopefully it should work in game.

 

EDIT: The power shows up in-game, but when cast, nothing happens. At all. Any ideas? I've never made a spell/ magic effect/ script before, so I don't know how to approach this.

Edited by Mayfly53
Link to comment
Share on other sites

Since the script is attached to a magic effect, the event OnEffectStart() could work better.

 

 

Scriptname DawnguardDebug extends MagicEffect

Race property ArgonianVampireBlue auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	
	aktarget.SetRace(ArgonianVampireBlue)
	
EndEvent

 

 

Edit: Also, did you check the property is filled correctly?

Edited by Ghaunadaur
Link to comment
Share on other sites

Thanks for your reply. I've tried your script, and the property is filled correctly, but when I test in-game, still nothing happens. I added the healing spell visual/ sound effects to see, and only some of the visual fx show up when activated, none of the sound. That isn't a big deal, but it means something isn't working right. I really don't know what's going wrong though.

Absolutely nothing happens, for if it did and I somehow didn't see it, the change of player character properties would be logged in the console, but it's blank :(

Link to comment
Share on other sites

Sorry, I made a mistake in the script, it should be ActiveMagicEffect, not MagicEffect:

 

 

Scriptname DawnguardDebug extends ActiveMagicEffect

Race property ArgonianVampireBlue auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	if (Game.GetPlayer().GetRace() !=ArgonianVampireBlue)
		aktarget.SetRace(ArgonianVampireBlue)
	endif
EndEvent

Link to comment
Share on other sites

It works now! Thank you very much! Hardly any of the audio/ visual fx are showing up, but still, the desired process is now occurring, and that is what is important. Kudos to you, Ghaunadaur.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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