Jump to content

Reading Script Variables


Liudeius

Recommended Posts

Edit: I suppose a better title would be "How do I make a timer?"

 

Sorry if it's an easy solution, I've checked a few guides and can't figure it out.

 

I'm trying to use a script as a timer, changing a global value to 0 on activation (specifically, a shout timer separate from the standard one), registering for a single update, and changing the value back to 1, with the timed action having a condition (in the spell category for the shout) of GetGlobalValue = 1.

 

However, it doesn't work.

I presume the issue has something to do with connecting variables to objects, since my papyrus log often says something about not being able to use SetValue on a none object, but that's just something I don't understand at all.

Why, if I can just type /show Variable to check the variable's value, do I have to do some convoluted thing with objects for the game to read it?

 

An expanded explanation of exactly what I'm doing:

 

My intention it to make my own shout timers so multiple shout types can be used in a row, each on their own cool down.

 

My current script:

ScriptName UseWul extends Form

GlobalVariable Property AllowWul auto;Global variable tried as both a short and float, initial value 1.

Event OnInit()
	AllowWul.SetValue(0)
	RegisterForSingleUpdate(5)
endEvent

Event OnUpdate()
	AllowWul.SetValue(1)
endEvent 

My esp changes:

Magic Effect- 2F7B9 VoiceSprintEffect1

Added in VMAD section the UseWul script, Version 5, format 2, count 1, attached object AllowWul to the script with Creation kit.

 

Shout - 2F7BA WhirlwindSprint

Changed recovery time to 0 (to allow my own timer to effect it)

 

Spell - 2F7BE VoiceWhirlwindSprint1

Added, under effects>conitions

Equal to

Comparison 1

GetGlobalValue

AllowWul

Run on Subject

 

I've been using both TES5Edit and Creation Kit.

 

With this set up, I can use the shout endlessly with the only delay being the animation. The value of AllowWul does not seem to change (I have noticed it change once either from 1 to 0 or 0 to 1, but it does not change beyond that, and even if it is 0, I can still use the shout)

I am returned the error :

 

[05/02/2013 - 08:20:05PM] error: Unable to bind script UseWul to Active effect 1 on (00000014) because their base types do not match
[05/02/2013 - 08:20:30PM] error: Unable to bind script UseWul to Active effect 1 on (00000014) because their base types do not match
I have also changed the heading to "ScriptName UseWul extends ActiveMagicEffect" for
error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type
stack:
[None].UseWul.RegisterForSingleUpdate() - "<native>" Line ?
[None].UseWul.OnInit() - "UseWul.psc" Line 7

 

 

Any help, either making this method work or using a simpler method, is greatly appreciated.

Edited by Liudeius
Link to comment
Share on other sites

error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type

 

stack:

[None].UseWul.RegisterForSingleUpdate() - "<native>" Line ?

[None].UseWul.OnInit() - "UseWul.psc" Line 7

 

This would be because Oninit() for magic effects is run at game start (Which is why it's pointing to a none self) not each time it's applied you would want to use:

 

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

Instead of OnInit()

 

So something like this:

ScriptName UseWul extends ActiveMagicEffect

GlobalVariable Property AllowWul auto;Global variable tried as both a short and float, initial value 1.

Event OnEffectStart(Actor akTarget, Actor akCaster)
	AllowWul.SetValue(0)
	RegisterForSingleUpdate(5)
EndEvent

Event OnUpdate()	
        AllowWul.SetValue(1)
EndEvent

 

Should work.

Edited by BotOwned
Link to comment
Share on other sites

  • Recently Browsing   0 members

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