Jump to content

Help with script compiling


SpaceKGreen

Recommended Posts

I hope I'm asking in the right part of the forums...

 

I had an idea of something I wanted to try in Skyrim, and after reading through several similar topics, and finding the commands I wanted in the creation kit wiki and SKSE, I wrote a small script. However, there seems to be a problem with one part that, well, as far as I can tell, shouldn't be having a problem.

 

Scriptname PassPlayWUpdate extends Quest  

import ActorBase
import Game

ActorBase pActorBase = Game.GetPlayer().GetActorBase()
float NewWeight

Event OnStoryIncreaseLevel (int aiNewLevel)
NewWeight = (aiNewLevel * 2)

pActorBase.SetWeight(NewWeight)
EndEvent

 

 

It keeps flubbing on the line "ActorBase pActorBase = Game.GetPlayer().GetActorBase()", with the error " no viable alternative at input 'Game' ". I've read through various vanilla scripts and I'm pretty sure they use the same syntax I used. Knowing me, I'm probably missing something obvious, but this has me stumped. Does anyone know what I'm doing wrong?

Link to comment
Share on other sites

I hope I'm asking in the right part of the forums...

 

I had an idea of something I wanted to try in Skyrim, and after reading through several similar topics, and finding the commands I wanted in the creation kit wiki and SKSE, I wrote a small script. However, there seems to be a problem with one part that, well, as far as I can tell, shouldn't be having a problem.

 

Scriptname PassPlayWUpdate extends Quest  

import ActorBase
import Game

ActorBase pActorBase = Game.GetPlayer().GetActorBase()
float NewWeight

Event OnStoryIncreaseLevel (int aiNewLevel)
NewWeight = (aiNewLevel * 2)

pActorBase.SetWeight(NewWeight)
EndEvent

 

 

It keeps flubbing on the line "ActorBase pActorBase = Game.GetPlayer().GetActorBase()", with the error " no viable alternative at input 'Game' ". I've read through various vanilla scripts and I'm pretty sure they use the same syntax I used. Knowing me, I'm probably missing something obvious, but this has me stumped. Does anyone know what I'm doing wrong?

I think it's because you only need to do Game.GetPlayer() if you don't import game.

Not 100% sure though, for better or for worse I haven't gotten into the habit of using imports.

Link to comment
Share on other sites

No need to import.

 

Scriptname PassPlayWUpdate extends Quest  


float NewWeight

Event OnStoryIncreaseLevel (int aiNewLevel)
	ActorBase pActorBase = Game.GetPlayer().GetActorBase()
	NewWeight = (aiNewLevel * 2)
	pActorBase.SetWeight(NewWeight)
EndEvent
Link to comment
Share on other sites

I ended up looking at another script right after my post and ended up with this:



 

Scriptname PassPlayWUpdate extends Quest

Event OnStoryIncreaseLevel (int aiNewLevel)
float NewWeight = (aiNewLevel * 2)

Game.GetPlayer().GetActorBase().SetWeight(NewWeight)

Game.GetPlayer().QueueNiNodeUpdate()
EndEvent

It compiled just fine, no errors. I think I've found out how to implement it too.  Thanks for the help though!

EDIT: Actually, not having much luck implementing it. Time to experiment!

Edited by SpaceKGreen
Link to comment
Share on other sites

You could save yourself a few moments of parsing by not calling game.getplayer() all the time but rather setup a property such that your script example in the last post would be

 

 

 

Scriptname PassPlayWUpdate extends Quest

Actor Property PlayerRef Auto

Event OnStoryIncreaseLevel(int aiNewLevel)
  float NewWeight = (aiNewLevel * 2)

  PlayerRef.GetActorBase().SetWeight(NewWeight)

  PlayerRef.QueueNiNodeUpdate()
EndEvent

 

PlayerRef will auto-fill with the appropriate reference used by the player.

 

As far as implementing, no clue. not used that particular event before.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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