Jump to content

Need Help With Script


HeirOfTheSeptims

Recommended Posts

I need some help with a script I'm making for a new spell. The script is:

 

Scriptname aaaMetiorScript extends activemagiceffect

import utility

import game

 

Float Property HeightRef Auto

 

Activator Property ActivatorRef Auto

 

SPELL Property SpellRef Auto

 

Actor TargetActorRef

Activator ActivatorRef

 

Event OnEffectStart(TargetActorRef, PlayerActorRef)

 

Float PosX = TargetActorRef.GetPositionX()

Float PosY = TargetActorRef.GetPositionY()

Float PosZ = TargetActorRef.GetPositionZ() + HeightRef

 

TargetActorRef.PlaceAtMe(ActivatorRef) ;place activator in world at Target

Utility.Wait(0.1)

ActivatorRef.SetPosition(PosX,PosY,PosZ) ;set activator new positon to above target

Utility.Wait(0.5)

SpellRef.RemoteCast(ActivatorRef,PlayerActorRef,TargetActorRef) ;from activator, hit target, blame player

Utility.Wait(1.0)

ActivatorRef.Disable()

ActivatorRef.Delete()

EndEvent

 

 

and I get an output of:

 

Starting 1 compile threads for 1 files...

Compiling "aaaMetiorScript"...

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaaMetiorScript.psc(14,34): extraneous input ',' expecting ID

No output generated for aaaMetiorScript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on aaaMetiorScript

 

For some reason it doesn't like the coma between TargetActorRef and PlayerActorRef, when I try removing it the error goes away, but (predictably) it thinks I'm trying to define PlayerActorRef again. Does anybody know whats actually wrong?

(I don't know how good my script actually is, I'm fairly new to the whole scripting thing)

Edited by HeirOfTheSeptems
Link to comment
Share on other sites

Event OnEffectStart(Actor TargetActorRef, Actor PlayerActorRef)

When declaring an Event or Function you'll need to include the types of the parameters in its signature otherwise papyrus won't know what type each parameter should be. Currently the compiler is assuming TargetActorRef is the type of the parameter and so it is expecting the ID to come after, which it's not so it's throwing that error.

 

There's no real use for the:

Actor  TargetActorRef

Declaration currently, unless you intend to use it outside the Event in which case you would need a different identifier for it or the parameter. Leaving it in would make the variable ambiguous (Since you've already declared it), I don't remember if the compiler throws an error for that or not.

Edited by Arocide
Link to comment
Share on other sites

Scriptname aaaMetiorScript extends activemagiceffect

import utility

import game

 

Float Property HeightRef Auto

 

Activator Property ActivatorRef Auto

 

SPELL Property SpellRef Auto

 

Activator ActivatorRef

 

Event OnEffectStart(Actor TargetActorRef, Actor PlayerActorRef)

 

Float PosX = TargetActorRef.GetPositionX()

Float PosY = TargetActorRef.GetPositionY()

Float PosZ = TargetActorRef.GetPositionZ() + HeightRef

 

TargetActorRef.PlaceAtMe(ActivatorRef) ;place activator in world at Target

Utility.Wait(0.1)

ActivatorRef.SetPosition(PosX,PosY,PosZ) ;set activator new positon to above target

Utility.Wait(0.5)

SpellRef.RemoteCast(ActivatorRef,PlayerActorRef,TargetActorRef) ;from activator, hit target, blame player

Utility.Wait(1.0)

ActivatorRef.Disable()

ActivatorRef.Delete()

EndEvent

 

Now it gives me even more errors :sad:

 

Starting 1 compile threads for 1 files...

Compiling "aaaMetiorScript"...

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaaMetiorScript.psc(21,16): SetPosition is not a function or does not exist

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaaMetiorScript.psc(23,12): type mismatch on parameter 1 (did you forget a cast?)

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaaMetiorScript.psc(25,14): Disable is not a function or does not exist

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaaMetiorScript.psc(26,14): Delete is not a function or does not exist

No output generated for aaaMetiorScript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on aaaMetiorScript

 

that change causes it to stop recognizing a whole bunch of commands

Edited by HeirOfTheSeptems
Link to comment
Share on other sites

that change causes it to stop recognizing a whole bunch of commands

 

It never recognised them in the first place :laugh:.

The original error masked the rest there was no point in the compiler continuing since it knew it was already invalid.

 

The problem now is that an Activator is not a ObjectReference, an Activator is a Form. You'll need to change its type to ObjectReference and link the property to the ObjectReference of the Activator you want to perform the functions on, or use a second Variable to point to the Activator Form so you can place it and then assign the PlaceAtMe functions return value to a ObjectReference variable and use that instead.

 

You've also declared ActivatorRef twice in the script (once as a property and again as a field).

Edited by Arocide
Link to comment
Share on other sites

  • Recently Browsing   0 members

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