Jump to content

[LE] need help with weird compiler error


Recommended Posts

so I've been making lots of progress on my Oblivion-style attributes mod and I've started work on the level up menu for them. While it's still a work in progress, I've started encountering a strange compiler error that's blocking my path forward and I really don't know how to describe it
C:\Games\steamapps\common\Skyrim Special Edition\Data\Scripts\Source\tyLESAPlayerScript.psc(154,37): too many arguments passed to function


C:\Games\steamapps\common\Skyrim Special Edition\Data\Scripts\Source\tyLESAPlayerScript.psc(154,6): type mismatch while assigning to a int (cast missing or types unrelated
here's the full code for the script i'm running. Can anyone here tell me what's up and what I'll need to do to fix this and get it to compile?
Scriptname tyLESAPlayerScript extends Actor
race property HighElfRace auto
globalvariable property FavorRewardSmall auto
globalvariable property SpeechVeryEasy auto
globalvariable property tyBaseAttSpe auto
globalvariable property tyBaseAttInt auto
globalvariable property FavorRewardMedium auto
globalvariable property SpeechEasy auto
globalvariable property FavorRewardLarge auto
race property OrcRace auto
globalvariable property tyBaseAttAgi auto
globalvariable property QuestReward04Wow auto
globalvariable property FavorGoldRewardSmall auto
race property DarkElfRace auto
globalvariable property MGR11Reward03 auto
race property RedguardRace auto
globalvariable property strbase auto
globalvariable property tyBaseAttLuk auto
globalvariable property tyModAttSpe auto
race property KhajiitRace auto
globalvariable property QuestReward02Medium auto
globalvariable property tyModAttWil auto
globalvariable property MGR11Reward01 auto
globalvariable property endbase auto
globalvariable property SpeePerverage auto
globalvariable property QuestReward03Large auto
globalvariable property MGR11Reward04 auto
globalvariable property SpeechHard auto
globalvariable property tyBaseAttWil auto
globalvariable property tyModAttEnd auto
race property BretonRace auto
globalvariable property MGR11Reward05 auto
globalvariable property tyModAttPer auto
race property WoodElfRace auto
globalvariable property tyModAttInt auto
race property ImperialRace auto
globalvariable property SpeechVeryHard auto
globalvariable property tyModAttAgi auto
globalvariable property tyBaseAttPer auto
globalvariable property FavorRewardIntimidate auto
race property ArgonianRace auto
globalvariable property tyModAttLuk auto
race property NordRace auto
globalvariable property FavorRewardBribe auto
Actor Property PlayerRef Auto
globalvariable property tyModAttStr auto
globalvariable property MGR11Reward02 auto
globalvariable property QuestReward01Small auto
Bool property MyBool Auto
spell property Healing auto
spell property ConjureFamiliar auto
spell property Fury auto
spell property Flames auto
perk property StatsPerk auto
GlobalVariable property tyPCLevel auto
Message property tyPCLevelUpAttr auto


string strbase = "ShieldPerks"
string endbase = "LastFlattered"
string intbase = "LastBribedIntimidated"
string wilbase = "JumpingBonus"
string agibase = "FavorsPerDay"
string spebase = "DetectLifeRange"
string perbase = "FavorPointsBonus"
string lukbase = "Nighteye"


float lifebonusnew = 0.0
float MagickaBonusNew = 0.0
float StaminaBonusNew = 0.0
float carryweightbonusnew = 0.0
float spdmult
float cwbonus
float cwbase
Float LifeTotalNew 
Float MagickaTotalNew 
Float StaminaTotalNew 
Float CarryWeightTotalNew 
Float LifeLevelBonusNew 
Float MagickaLevelBonusNew 
Float StaminaLevelBonusNew 
Float CarryWeightLevelBonusNew 
Float LifeBaseNew 
Float MagickaBaseNew  
Float StaminaBaseNew 
Float CarryWeightBaseNew 
float wilmodupdate
float strmodupdate
float endmodupdate
float aglmodupdate
float spdmodupdate
float LifeTotalCurrent
float MagickaTotalCurrent
float StaminaTotalCurrent
float carryweighttotalcurrent
float x
float y
float z
float healthbase
float staminabase
float magickabase
float lifebonus
float magbonus
float stambonus
float magickamult
float str
float end
float itn
float wil
float agl
float spd
float prs
float luk
float strmod
float endmod
float itnmod
float wilmod
float aglmod
float spdmod
float prsmod
float lukmod
string playerSex
string playerRace
int AttributesPerLevel = 2


;----------------------------------------------------------------------------------------
; Functions
;----------------------------------------------------------------------------------------
Function ShowAddAttrMenu()
;For attribute cap, if doing permanent racial caps, save the player's race cap for each as a global variable on character creation, then replace "20" with that.


int AttributesRemaining = AttributesPerLevel


while ( AttributesRemaining > 0)


int SelectedAttr = tyPCLevelUpAttr.show(playerref.GetLevel() as int, playerref.getAV(strbase), playerref.getAV(endbase), playerref.getAV(intbase), playerref.getAV(wilbase), playerref.getAV(spebase), playerref.getAV(agibase), playerref.getAV(perbase), playerref.getAV(lukbase), AttributesRemaining)


int amount = 1


if ( SelectedAttr == 0 )
if ( playerref.getAV(strbase) as int < 100 )
;Need to cast GetFactionRank to int
                amount = playerref.getAV(strbase) as int + 1
;Debug test
;Debug.Messagebox("Increasing Agility to " + amount)
                playerref.SetAV(strbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 1 )
if ( playerref.getAV(endbase) as int < 100 )
                amount = playerref.getAV(endbase) as int + 1
                playerref.setAV(endbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 2 )
if ( playerref.getAV(intbase) as int < 100 )
                amount = playerref.getAV(intbase) as int + 1
                playerref.setAV(intbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 3 )
if ( playerref.getAV(wilbase) as int < 100 )
                amount = playerref.getAV(wilbase) as int + 1
                playerref.setAV(wilbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 4 )
if ( playerref.getAV(spebase) as int < 100 )
                amount = playerref.getAV(spebase) as int + 1
                playerref.setAV(spebase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 5 )
if ( playerref.getAV(agibase) as int < 100 )
                amount = playerref.getAV(agibase) as int + 1
                playerref.setAV(agibase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 6 )
if ( playerref.getAV(perbase) as int < 100 )
                amount = playerref.getAV(perbase) as int + 1
                playerref.setAV(perbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


if ( SelectedAttr == 7 )
if ( playerref.getAV(lukbase) as int < 100 )
                amount = playerref.getAV(lukbase) as int + 1
                playerref.setAV(lukbase, amount)
else
                Debug.Messagebox("You cannot increase that attribute any higher.")
                ShowAddAttrMenu()
endif
endif


;One attribute was spent.
        AttributesRemaining -= 1


endwhile


EndFunction
;----------------------------------------------------------------------------------------

 

Link to comment
Share on other sites

EDIT: I double check the script, if you just change

int amount = 1

To

float amount = 1

Everything should work since there a tons of casting this as an Int, seems like it was meant to be a float.

 

---------------------------

 

Well I caught this.

playerref.SetAV(strbase, amount)

Should be:

playerref.SetAV(strbase, amount as float)

You can't use Int for Actor Values, so you need to cast em as floats. See if that fixes everything. https://www.creationkit.com/index.php?title=Actor.SetAV_(Papyrus)

 

Also:

MyActor.SetActorValue()

Is rumored to be quicker for the script engine to process then the short hand.

Edited by smashballsx88
Link to comment
Share on other sites

I

 

EDIT: I double check the script, if you just change

int amount = 1

To

float amount = 1

Everything should work since there a tons of casting this as an Int, seems like it was meant to be a float.

 

---------------------------

 

Well I caught this.

playerref.SetAV(strbase, amount)

Should be:

playerref.SetAV(strbase, amount as float)

You can't use Int for Actor Values, so you need to cast em as floats. See if that fixes everything. https://www.creationkit.com/index.php?title=Actor.SetAV_(Papyrus)

 

Also:

MyActor.SetActorValue()

Is rumored to be quicker for the script engine to process then the short hand.

So wait, i've never even heard of MyActor before. What exactly does it do? is it specifically for the player or something like that?

Link to comment
Share on other sites

MyActor is just a variable I made up, that represents an Actor form. You can use any Actor form for the function ".SetActorValue()". Such as your "playerref" which is an Actor form assigned to the variable "playerref".

 

The player counts as an Actor.

Link to comment
Share on other sites

(1) You have coded this:

String strbase
globalvariable PROPERTY strbase auto

It does not work, because every property and variable have to be different within the script. There exists one exception, but is not relevant for you.

 

(2) native function show() has a limit of nine parameters, you had ten

 

(3) You have to use a ReferenceAlias instead of actor script !!!

 

(4) Do not use so many variables inside the script, its horrible to maintain such a script.

 

(5) I do not know exactly what do you want to do here, but code could be as follow:

 

tyLESAPlayerAliasScript

 

Scriptname tyLESAPlayerAliasScript extends ReferenceAlias
; https://forums.nexusmods.com/index.php?/topic/8965238-need-help-with-weird-compiler-error/

  GlobalVariable PROPERTY tyPCLevel          auto
  GlobalVariable PROPERTY tyModAttStr        auto
  GlobalVariable PROPERTY MGR11Reward02      auto
  GlobalVariable PROPERTY QuestReward01Small auto

  Perk  PROPERTY StatsPerk auto
  Spell PROPERTY Healing auto
  Spell PROPERTY ConjureFamiliar auto
  Spell PROPERTY Fury auto
  Spell PROPERTY Flames auto

  Message PROPERTY tyPCLevelUpAttr auto
  Bool    PROPERTY MyBool          auto

  String playerSex
  String playerRace

float lifebonusnew
float MagickaBonusNew
float StaminaBonusNew
float carryweightbonusnew
float spdmult
float cwbonus
float cwbase
Float LifeTotalNew
Float MagickaTotalNew
Float StaminaTotalNew
Float CarryWeightTotalNew
Float LifeLevelBonusNew
Float MagickaLevelBonusNew
Float StaminaLevelBonusNew
Float CarryWeightLevelBonusNew
Float LifeBaseNew
Float MagickaBaseNew  
Float StaminaBaseNew
Float CarryWeightBaseNew
float wilmodupdate
float strmodupdate
float endmodupdate
float aglmodupdate
float spdmodupdate
float LifeTotalCurrent
float MagickaTotalCurrent
float StaminaTotalCurrent
float carryweighttotalcurrent
float x
float y
float z
float healthbase
float staminabase
float magickabase
float lifebonus
float magbonus
float stambonus
float magickamult
float str
float end
float itn
float wil
float agl
float spd
float prs
float luk
float strmod
float endmod
float itnmod
float wilmod
float aglmod
float spdmod
float prsmod
float lukmod


; -- EVENTs --


; -- FUNCTIONs --

  Int AttributesPerLevel = 2

 ;String strbase = "ShieldPerks"
 ;String endbase = "LastFlattered"
 ;String intbase = "LastBribedIntimidated"
 ;String wilbase = "JumpingBonus"
 ;String spebase = "DetectLifeRange"
 ;String agibase = "FavorsPerDay"
 ;String perbase = "FavorPointsBonus"
 ;String lukbase = "Nighteye"

;-------------------------
FUNCTION ShowAddAttrMenu()
;-------------------------
; For attribute cap, if doing permanent racial caps,
; save the players race cap for each as a global variable on character creation, then replace "20" with that.

    actor player = Game.GetPlayer()

int l = AttributesPerLevel                                                    ; l = AttributesRemaining
    WHILE (l > 0)
        int i0 = player.GetLevel()
        int i1 = player.GetActorValue("ShieldPerks")             ; strbase
        int i2 = player.GetActorValue("LastFlattered")           ; endbase
        int i3 = player.GetActorValue("LastBribedIntimidated")   ; intbase
        int i4 = player.GetActorValue("JumpingBonus")            ; wilbase
        int i5 = player.GetActorValue("DetectLifeRange")         ; spebase
        int i6 = player.GetActorValue("FavorsPerDay")            ; agibase
        int i7 = player.GetActorValue("FavorPointsBonus")        ; perbase
        int i8 = player.GetActorValue("Nighteye")                ; lukbase

        ; https://www.creationkit.com/index.php?title=Show_-_Message        ; i = SelectedAttr

        int i = tyPCLevelUpAttr.show(i0 as Float, i1 as Float, i2 as Float, i3 as Float, \
                                     i4 as Float, i5 as Float, i6 as Float, i7 as Float, i8 as Float)
        bool bOK

        IF     (i == 1)
            bOK = (i1 < 100)                                       ; strbase        strength
            IF ( bOK )
                player.SetActorValue("ShieldPerks", i1 + 1)
            ENDIF

        ELSEIF (i == 2)                                            ; endbase        endurance
            bOK = (i2 < 100)
            IF ( bOK )
                player.SetActorValue("LastFlattered", i2 + 1)
            ENDIF

        ELSEIF (i == 3)                                            ; intbase        intelligence
            bOK = (i3 < 100)
            IF ( bOK )
                player.SetActorValue("LastBribedIntimidated",  i3 + 1)
            ENDIF

        ELSEIF (i == 4)                                            ; wilbase        will
            bOK = (i4 < 100)
            IF ( bOK )
                player.SetActorValue("JumpingBonus", i4 + 1)
            ENDIF

        ELSEIF (i == 5)                                            ; spebase        speed
            bOK = (i5 < 100)
            IF ( bOK )
                player.SetActorValue("DetectLifeRange", i5 + 1)
            ENDIF

        ELSEIF (i == 6)                                            ; agibase        agility
            bOK = (i6 < 100)
            IF ( bOK )
                player.SetActorValue("FavorsPerDay", i6 + 1)
            ENDIF

        ELSEIF (i == 7)                                            ; perbase        personality
            bOK = (i7 < 100)
            IF ( bOK )
                player.SetActorValue("FavorPointsBonus", i7 + 1)
            ENDIF

        ELSEIF (i == 8)                                            ; lukbase        luck
            bOK = (i8 < 100)
            IF ( bOK )
                player.SetActorValue("Nighteye", i8 + 1)
            ENDIF
        ENDIF

        IF (n == -1)
            Debug.Messagebox("You cannot increase that attribute any higher.")
        ENDIF

        l = l - 1        ; attribute was spent
    ENDWHILE
ENDFUNCTION


; *********************************************************************

  Race PROPERTY HighElfRace auto                        ; 1
  globalvariable PROPERTY FavorRewardSmall auto
  globalvariable PROPERTY SpeechVeryEasy auto
  globalvariable PROPERTY tyBaseAttSpe auto
  globalvariable PROPERTY tyBaseAttInt auto
  globalvariable PROPERTY FavorRewardMedium auto
  globalvariable PROPERTY SpeechEasy auto
  globalvariable PROPERTY FavorRewardLarge auto

  Race PROPERTY OrcRace auto                            ; 2
  globalvariable PROPERTY tyBaseAttAgi auto
  globalvariable PROPERTY QuestReward04Wow auto
  globalvariable PROPERTY FavorGoldRewardSmall auto

  Race PROPERTY DarkElfRace auto                        ; 3
  globalvariable PROPERTY MGR11Reward03 auto

  Race PROPERTY RedguardRace auto
  globalvariable PROPERTY strbase auto
  globalvariable PROPERTY tyBaseAttLuk auto
  globalvariable PROPERTY tyModAttSpe auto

  Race PROPERTY KhajiitRace auto                         ; 4
  globalvariable PROPERTY QuestReward02Medium auto
  globalvariable PROPERTY tyModAttWil auto
  globalvariable PROPERTY MGR11Reward01 auto
  globalvariable PROPERTY endbase auto
  globalvariable PROPERTY SpeePerverage auto
  globalvariable PROPERTY QuestReward03Large auto
  globalvariable PROPERTY MGR11Reward04 auto
  globalvariable PROPERTY SpeechHard auto
  globalvariable PROPERTY tyBaseAttWil auto
  globalvariable PROPERTY tyModAttEnd auto

  Race PROPERTY BretonRace auto                          ; 5
  globalvariable PROPERTY MGR11Reward05 auto
  globalvariable PROPERTY tyModAttPer auto

  Race PROPERTY WoodElfRace auto                         ; 6
  globalvariable PROPERTY tyModAttInt auto

  Race PROPERTY ImperialRace auto                        ; 7
  globalvariable PROPERTY SpeechVeryHard auto
  globalvariable PROPERTY tyModAttAgi auto
  globalvariable PROPERTY tyBaseAttPer auto
  globalvariable PROPERTY FavorRewardIntimidate auto

  Race PROPERTY ArgonianRace auto                        ; 8
  globalvariable PROPERTY tyModAttLuk auto

  Race PROPERTY NordRace auto                            ; 9
  globalvariable PROPERTY FavorRewardBribe aut

 


Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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