Jump to content

Recommended Posts

Posted

The code below is failing to compile but I honestly don't know why. I see the text in the output compiler but I'm not sure If I'm actually wrong or something is not referencing the right stuff to make me not wrong. 

Script TL:DR I makes it so theres a ap cost Mult for me to affect with spells, perks, etc.

It is a script made in a Magic Effect. I made the Global: ActionPointCostMult

Scriptname APCostInterceptorMagic extends activemagiceffect

GlobalVariable Property ActionPointCostMult Auto
Actor Property PlayerRef Auto Const

Float lastAP = -1.0
Float checkInterval = 0.25

Event OnEffectStart(Actor akTarget, Actor akCaster)
    if akTarget == PlayerRef
        lastAP = PlayerRef.GetActorValue("ActionPoints")
        RegisterForSingleUpdate(checkInterval)
    endif
EndEvent

Event OnUpdate()
    float currentAP = PlayerRef.GetActorValue("ActionPoints")
    float diff = lastAP - currentAP

    if diff > 0.1
        float mult = ActionPointCostMult.GetValue()
        float extraDrain = diff * (mult - 1.0)
        if extraDrain > 0
            PlayerRef.ModActorValue("ActionPoints", -extraDrain)
        endif
    endif

    lastAP = currentAP
    RegisterForSingleUpdate(checkInterval)
EndEvent

*Really funny that Nexus the king of Bethesda modding doesn't have a papyrus script highlighter

Here's the errors:

  Quote

APCostInterceptorMagic.psc(11,27): GetActorValue is not a function or does not exist
APCostInterceptorMagic.psc(11,8): type mismatch while assigning to a float (cast missing or types unrelated)
APCostInterceptorMagic.psc(12,8): RegisterForSingleUpdate is not a function or does not exist
APCostInterceptorMagic.psc(17,32): GetActorValue is not a function or does not exist
APCostInterceptorMagic.psc(17,10): type mismatch while assigning to a float (cast missing or types unrelated)
APCostInterceptorMagic.psc(24,22): ModActorValue is not a function or does not exist
APCostInterceptorMagic.psc(29,4): RegisterForSingleUpdate is not a function or does not exist
APCostInterceptorMagic.psc(16,0): new event onupdate cannot be defined because the script is not flagged as native

Expand  

 

Posted

For Fallout 4 it's just GetValue() (and can be used on any Object Reference, not just Actors), same with ModActorValue() which is now ModValue()

RegisterForSingleUpdate() no longer exists, you can use StartTimer() to achieve the same (and instead of OnUpdate, use OnTimer)

Posted (edited)
  On 6/5/2025 at 3:53 AM, NeinGaming said:

For Fallout 4 it's just GetValue() (and can be used on any Object Reference, not just Actors), same with ModActorValue() which is now ModValue()

RegisterForSingleUpdate() no longer exists, you can use StartTimer() to achieve the same (and instead of OnUpdate, use OnTimer)

Expand  

So yes, my information is completely out of date. That helped me understand quiet a bit
Now it's just telling me something that's pretty obvious that could lead to a problem. Which is that "ActionPoints" is a string and not the actually in game name for that value. which was as simple as just removing the " "

But I also don't think this is the games Value for Action Points in general and so I have to find that now

  On 6/6/2025 at 1:49 PM, RaidersClamoring said:

I recommend this highlighter for VS code, it'll save you much headache :

https://marketplace.visualstudio.com/items?itemName=joelday.papyrus-lang-vscode

Expand  

Huh.... neat, thanks

Edited by Littledohboy15
Posted
  On 6/7/2025 at 6:02 AM, Littledohboy15 said:

So yes, my information is completely out of date. That helped me understand quiet a bit
Now it's just telling me something that's pretty obvious that could lead to a problem. Which is that "ActionPoints" is a string and not the actually in game name for that value. which was as simple as just removing the " "

But I also don't think this is the games Value for Action Points in general and so I have to find that now

Expand  

The name doesn't matter, you have to add it as a property (or use GetFormFromFile).

Say, you add a property that is called "Butterbread" and points to the object that is the AP Actor Value, then you'd use SetValue(Butterbread). The name of the variable doesn't matter at all, only the object (the AV) it points to.

  • Recently Browsing   0 members

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