Jump to content

How do I set Global Variables from script?


Halstrom

Recommended Posts

Anyone know how to get the SquareRoot function to work, the CK doesn't recognise it.

 

iMoveDist = sqr(4.0)

 

The error : sqr is not a function or does not exist.

 

Also abs and pow do the same too :tongue:

 

It's Math.sqrt(4.0). You have to call those as part of the Math script.

 

https://www.creationkit.com/fallout4/index.php?title=Sqrt_-_Math

https://www.creationkit.com/fallout4/index.php?title=Math_Script

Link to comment
Share on other sites

Next question :smile:

 

Is there an equivalent to IsMoving, I want to detect if the player is moving. I have IsRunning and IsSprinting, but there's no IsWalking.

 

There's an IsMoving option, actually. It's an available condition on magic effects, so use a magic effect and a script that just sets a variable flag.

 

The base game seems to be doing exactly that in the SetMovingFlag.psc script:

Scriptname SetMovingFlag extends activemagiceffect

ActorValue Property IsMoving Auto Const

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Actor thisActor = akTarget
	thisActor.SetValue(IsMoving, 1)
EndEvent

Offhand, I don't know exactly where this attaches. But it's setting IsMoving as an AV. I'd start by doing a check for an AV called "IsMoving", and barring that, then tracking down where exactly this script attaches. The property being fed in will tell you the exact AV. But I'm guessing it's probably IsMoving.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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