Jump to content

Permanent value ?


Recommended Posts

Hello modders

I would like to have a stored athletism skill level, that will increase over time (when the Player succeeds at checks. However, this below doesn't work, everytimes, the experience variable seems to not register, and the XPs do not increase.

I created a global variable in game, and linked the script to it, it still doesn't work.

Or maybe there could be an other way to store this experience value ?

 

Scriptname crom_athletism extends Quest
{This is the basic script for checking and improving running, sprinting and jogging}
globalvariable property FRON_Athletics_experience auto
globalvariable property FRON_Speed_Mult auto

import fron_utility_functions

Event OnInit()
Actor pc = Game.GetPlayer()
RegisterForUpdate(10)
Debug.Notification("Crom Skill System - Athletism - Started")
pc.SetActorValue("SpeedMult",FRON_getRunningBonusFromAtleticsLevel())

EndEvent

Event OnUpdate()

Actor pc = Game.GetPlayer()
pc.SetActorValue("SpeedMult",FRON_getRunningBonusFromAtleticsLevel())
float iPlayersSpeedMult = pc.GetBaseActorValue("SpeedMult")



if (pc.isSprinting())
;Debug.Notification("Player speed mult is "+ iPlayersSpeedMult)
FRON_checkSprinting()
endif



EndEvent

float function FRON_getRunningBonusFromAtleticsLevel()

int skill_bonus = Fron_GetSkillBonus(FRON_Athletics_experience.getValueInt())

if skill_bonus == -3
return 90.0
elseIf skill_bonus == 0
return 100.0
elseIf skill_bonus == 3
return 105.0
elseIf skill_bonus == 6
return 110.0
elseIf skill_bonus == 9
return 115.0
elseIf skill_bonus == 12
return 130.0
endIf
endFunction

function FRON_checkSprinting()

int critical_failure = 5
int failure = 12
int success = 20
int xp_gained

int random = utility.RandomInt(1, :cool:
int tempAthletics = FRON_Athletics_experience.GetValueInt()
int skill_bonus = Fron_GetSkillBonus(FRON_Athletics_experience.GetValueInt())
;int fron_ore_mining_difficulty = ReturnOreTypeDifficulty()

int randomStaminaDamage = utility.RandomInt (5,10)


random *= 2
int total_number_to_check = random + skill_bonus

;--------------------------------------------------
if total_number_to_check <= critical_failure
;echec critique
xp_gained = utility.RandomInt(1,6)*2

debug.notification("Critical Athletics Failure: + " + xp_gained + " Xps.")
game.getplayer().DamageAV("Stamina", randomStaminaDamage * 3 )

;--------------------------------------------------
elseif total_number_to_check > critical_failure && total_number_to_check <= failure
;echec
xp_gained = utility.RandomInt(1,3)*2
debug.notification("Athletics Failure. + " + xp_gained + " Xps.")
game.getplayer().DamageAV("Stamina", randomStaminaDamage * 2 )
;--------------------------------------------------
elseif total_number_to_check > failure && total_number_to_check <= success
;réussite simple
xp_gained = utility.RandomInt(1,6)
debug.notification("Athletics Success. + " + xp_gained + " Xps.")
Game.GetPlayer().RestoreActorValue("Stamina", randomStaminaDamage)
;--------------------------------------------------
else
;réussite critique
xp_gained = utility.RandomInt(1,3)
debug.notification("Athletics Critical Success. + " + xp_gained + " Xps." )
Game.GetPlayer().RestoreActorValue("Stamina", randomStaminaDamage * 2)
endif

tempAthletics = xp_gained + tempAthletics
string AthleticsSkillName = Fron_GetSkillLevelName(tempAthletics)
int Remaining_XP = Fron_GetRemainingNeededXPUntilNextLevel (tempAthletics)
FRON_Athletics_experience.setValue(tempAthletics)
debug.notification("Your new Athletics experience is " + tempAthletics + " XPs. You are a "+AthleticsSkillName+" Athlets. You need "+Remaining_XP+" XPs until next level.")

endfunction

Edited by cromcrom
Link to comment
Share on other sites

  • Recently Browsing   0 members

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