Jump to content

Race Script Face-Palming


sukeban

Recommended Posts

Nevermind, I've solved it. I had to call the function from the BaseActor. Everything working like a champ now. Still, any ways to optimize the script would be appreciated, as I'm sure that any accomplished coder will look at it and o_O.

 

I've been face-palming over and over again trying to get this script to work properly. It's a simple script that runs from a quest at the beginning of the game. It's intended to modify a new character's stats at the beginning of the game, based on gender and race.

 

It's much longer (and, I'm sure, wildly inefficient), but this is what I have been testing and attempting to debug with.

 

When I debug the GetRace (Debug.Messagebox("You are a " + GetRace()) call, it returns "You are a None!" So the call is returning none?

 

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

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 1

Scriptname QF_LoreFriendlyStats_02000D62 Extends Quest Hidden

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0()

;BEGIN CODE

;Lore-Friendly Stats

 

GetIsSex()

If GetIsSex() == 0

Debug.Messagebox("You are a female!")

GetpcisRace()

If GetpcisRace() == OrcRace

Debug.Messagebox("You are a female Orc!")

Game.GetPlayer().ForceActorValue("Carryweight", 100)

Game.GetPlayer().SetActorValue("Health", 180)

Game.GetPlayer().SetActorValue("Stamina", 80)

Game.GetPlayer().SetActorValue("Magicka", 40)

Game.GetPlayer().ForceActorValue("SpeedMult", 85)

Game.GetPlayer().SetActorValue("WeaponSpeedMult", 0.95)

Game.GetPlayer().ForceActorValue("CombatHealthRegenMult", 0.85)

Game.GetPlayer().SetActorValue("CombatStaminaRegenMult", 0.35)

Game.GetPlayer().SetActorValue("CombatMagickaRegenMult", 0.23)

Game.GetPlayer().ForceActorValue("CritChance", 1.0)

Game.GetPlayer().SetActorValue("SpeechcraftMod", 0.0)

ElseIf GetpcisRace() == NordRace

Debug.Messagebox("You are a female Nord!")

Game.GetPlayer().ForceActorValue("Carryweight", 90)

Game.GetPlayer().SetActorValue("Health", 140)

Game.GetPlayer().SetActorValue("Stamina", 120)

Game.GetPlayer().SetActorValue("Magicka", 30)

Game.GetPlayer().ForceActorValue("SpeedMult", 90)

Game.GetPlayer().SetActorValue("WeaponSpeedMult", 1.05)

Game.GetPlayer().SetActorValue("CombatHealthRegenMult", 0.80)

Game.GetPlayer().SetActorValue("CombatStaminaRegenMult", 0.40)

Game.GetPlayer().SetActorValue("CombatMagickaRegenMult", 0.23)

Game.GetPlayer().ForceActorValue("CritChance", 6.0)

Game.GetPlayer().SetActorValue("SpeechcraftMod", 5.0)

Else

Debug.MessageBox("You are a female Argonian!")

Game.GetPlayer().ForceActorValue("Carryweight", 80)

Game.GetPlayer().SetActorValue("Health", 120)

Game.GetPlayer().SetActorValue("Stamina", 100)

Game.GetPlayer().SetActorValue("Magicka", 130)

Game.GetPlayer().ForceActorValue("SpeedMult", 95)

Game.GetPlayer().SetActorValue("WeaponSpeedMult", 1.00)

Game.GetPlayer().SetActorValue("CombatHealthRegenMult", 0.75)

Game.GetPlayer().SetActorValue("CombatStaminaRegenMult", 0.35)

Game.GetPlayer().SetActorValue("CombatMagickaRegenMult", 0.38)

Game.GetPlayer().ForceActorValue("CritChance", 5.0)

Game.GetPlayer().SetActorValue("SpeechcraftMod", -1.0)

EndIf

Else

Debug.Messagebox("You are a male!")

If GetpcisRace() == OrcRace

Debug.Messagebox("You are a male Orc!")

Game.GetPlayer().ForceActorValue("Carryweight", 120)

Game.GetPlayer().SetActorValue("Health", 200)

Game.GetPlayer().SetActorValue("Stamina", 100)

Game.GetPlayer().SetActorValue("Magicka", 20)

Game.GetPlayer().ForceActorValue("SpeedMult", 80)

Game.GetPlayer().SetActorValue("WeaponSpeedMult", 0.90)

Game.GetPlayer().SetActorValue("CombatHealthRegenMult", 0.90)

Game.GetPlayer().SetActorValue("CombatStaminaRegenMult", 0.40)

Game.GetPlayer().SetActorValue("CombatMagickaRegenMult", 0.18)

Game.GetPlayer().ForceActorValue("CritChance", 0.0)

Game.GetPlayer().SetActorValue("SpeechcraftMod", -1.0)

ElseIf GetpcisRace() == NordRace

Debug.Messagebox("You are a male Nord!")

Game.GetPlayer().ForceActorValue("Carryweight", 110)

Game.GetPlayer().SetActorValue("Health", 160)

Game.GetPlayer().SetActorValue("Stamina", 140)

Game.GetPlayer().SetActorValue("Magicka", 10)

Game.GetPlayer().ForceActorValue("SpeedMult", 85)

Game.GetPlayer().SetActorValue("WeaponSpeedMult", 1.00)

Game.GetPlayer().SetActorValue("CombatHealthRegenMult", 0.85)

Game.GetPlayer().SetActorValue("CombatStaminaRegenMult", 0.45)

Game.GetPlayer().SetActorValue("CombatMagickaRegenMult", 0.18)

Game.GetPlayer().ForceActorValue("CritChance", 5.0)

Game.GetPlayer().SetActorValue("SpeechcraftMod", 4.0)

EndIf

EndIf

;END CODE

EndFunction

;END FRAGMENT

 

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

 

Race Property OrcRace Auto

Race Property NordRace Auto

Race Property ArgonianRace Auto

 

int function getissex()

endfunction

 

Race Function GetPCISRace() Native

 

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

 

My issue is that the gender call works correctly, but that using any of the GetRace/GetIsRace/GetPCIsRace functions always return negative when I assign the Race properties in the CK. When they are unassigned, the calls always return positive. It seems that I do not know how this function actually works. I know it's supposed to return "1" if the statement is true, but it seems that there is something fundamentally wrong with how the game is processing what the called race even is.

 

Extra frustrating is the Papyrus fragment, which seem to have their own bizarre rules versus a normal script.

 

If anybody can assist with this, I will be 9999% grateful and will probs erect a statue to you in my hometown :D

Edited by sukeban
Link to comment
Share on other sites

  • Recently Browsing   0 members

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