Jump to content

I need help moving an actor value to a global variable


true4evr

Recommended Posts

Plain and simple, all I need is to set the value of an actor value I made to a global variable I also made for a mod I'm trying to build. This is basically what I had in a script before I rage quit:


Scriptname PlayerMods:AVtoGlobalDodge extends GlobalVariable Hidden


ActorValue Property DodgeChance Auto


GlobalVariable Property DodgePercent Auto


Game.GetPlayer().GetValue(DodgeChance)


DodgePercent.SetValue("DodgeValue")


for which I get the error:



Papyrus Compiler Version 2.8.0.4 for Fallout 4

Copyright © ZeniMax Media. All rights reserved.

Starting 1 compile threads for 1 files...

Compiling "PlayerMods:AVtoGlobalDodge"...

Buzz:\buzzz\buzzzz\AppData\Local\Temp\PapyrusTemp\PlayerMods\AVtoGlobalDodge.psc(7,4): no viable alternative at input '.'

No output generated for PlayerMods:AVtoGlobalDodge, compilation failed.


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

Failed on PlayerMods:AVtoGlobalDodge



As you can probably tell, I'm building up a mod that will allow players to set up a dodge build like those seen in Payday 2. It will work pretty much identically like Unstoppable, but will stack with other perks and aids that will boost your dodge stat. It's all set up to affect an actor value which will in turn boost one's dodge capabilities. The problem is that in order for it to work the number used for determining dodge must be drawn from a global variable so that is what I need a script for(I think). If this one problem were solved then most assuredly the stars would align and the streets would be littered with gold and pet unicorns who also poop gold and I would be very grateful to the script MASTER who toils away precious seconds to help this blatant scrub.


In other words, thanks in advance!

Link to comment
Share on other sites

Well there's a lot of options that a script could be run "allways", in a scripting quest por example wich you can trigger from SM Event Node.

 

As far as i know there's not a single perk wich triggers a script, they add properties to the player for say something but not scripts (as far as i know idk if you can do so)

 

But i think that you have not clear where to add the script and that's the problem, investigate further how this can be triggered it could be for example in the player npc or as i said in a quest. Another example, the survival mode is a Quest Script.

Link to comment
Share on other sites

The only requirement for this perk is that it's on. I could attach the script to the You're SPECIAL! book and have it activate under the condition HasBeenRead = true. The thing is, I just can't seem to compile a script that properly gives the DodgePercent global variable the value that the DodgeChance actor value has.

Link to comment
Share on other sites

Let's analize the script then

1   Scriptname PlayerMods:AVtoGlobalDodge extends GlobalVariable Hidden
2
3   ActorValue Property DodgeChance Auto
4
5   GlobalVariable Property DodgePercent Auto
6
7   Game.GetPlayer().GetValue(DodgeChance)
8
9   DodgePercent.SetValue("DodgeValue")
10

for which I get the error:

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "PlayerMods:AVtoGlobalDodge"...
Buzz:\buzzz\buzzzz\AppData\Local\Temp\PapyrusTemp\PlayerMods\AVtoGlobalDodge.psc(7,4): no viable alternative at input '.'
No output generated for PlayerMods:AVtoGlobalDodge, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on PlayerMods:AVtoGlobalDodge




Here you're getting the error in line 7; getplayer() returns an actor as you can see in the CK wiki so you can't use a function of ActorValue class you have to use one of the Actor Scripting

And follow the tail of how to access to that value and that's why i told you that you're not sure where to add the script because you maybe need to inherit form an alias_actor in a quest script.

 

 

EDIT:

Maybe you can use the function Get value percentage from ObjectReference and use it somehow...

 

EDIT:

nap or use GetBaseValue idk, you will have to investigate but take care about what classes you're calling and wich functs you can use from them

Edited by KataPUMB
Link to comment
Share on other sites

Did it (more or less).

Scriptname PlayerMods:AVtoGlobalDodge extends Actor Hidden

ActorValue Property DodgeChance Auto

GlobalVariable Property DodgePercent Auto

Float Dodge

Function DodgeCalc()
	Dodge = game.GetPlayer().GetValue(DodgeChance)
	DodgePercent.SetValue(Dodge)
EndFunction

It's attached to the playerperk. Now to see if it works in game.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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