Jump to content

Scripting Question


Fallina

Recommended Posts

I'm not entirely sure which thread to post this in, hope this is where it goes.

 

I'm getting my feet wet with some scripting, I think. It's possible this can be done without scripting, but I'm running into several snags no matter which approach I take.

 

The premise for what I'm wanting to do is have the player's carry weight increase slightly every 10 levels. After digging through some assets, I decided I would need to create specialized "perks" that would add to the players carry weight. I made a perk with 5 ranks, made it hidden, and linked it to a custom, +10 carry weight ability . Now I need to get it to apply every 10 lvl. I decided a script would probably be necessary to do this. If anyone knows a way to do this -without- a script, please let me know, I'd be more than happy to implement it.

 

So, on to the scripting issues I've encountered. For one, I ran into a snag finding a function that would return specific Perk Ranks. The function HasPerk only returns true/false, not specific ranks. So I reworked the perks to be single rank perks and made 5 individual, similarly named perks with the same purpose, add 10 carry weight. They are: zLUCU1, zLUCU2, zLUCU3, zLUCU4, and zLUCU5.

This is the script as it stands:

 

 

scn zCarryUpSCRIPT
begin GameMode
int zPClvl
set zPClvl to player.GetLevel
;---------------------------lvl 10 Bonus
if zPClvl >= 10
if player.HasPerk zLUCU1 == 0
player.AddPerk zLUCU1
endif
endif
;---------------------------lvl 20 Bonus
if zPClvl >= 20
if player.HasPerk zLUCU2 == 0
player.AddPerk zLUCU2
endif
endif
;---------------------------lvl 30 Bonus
if zPClvl >= 30
if player.HasPerk zLUCU3 == 0
player.AddPerk zLUCU3
endif
endif
;---------------------------lvl 40 Bonus
if zPClvl >= 40
if player.HasPerk zLUCU4 == 0
player.AddPerk zLUCU4
endif
endif
;---------------------------lvl 50 Bonus
if zPClvl >= 50
if player.HasPerk zLUCU5 == 0
player.AddPerk zLUCU5
endif
endif
end
I'm not sure if GetLevel actually works in script or not. I know there are several functions which work in the console, but can't be used in scripting. If anyone has any ideas on why this doesn't seem to be working, or another method to achieve the same ends, let me know.
Link to comment
Share on other sites

Getlevel works fine, and there's nothing I know of to get the perk rank.

Looks ok to me except I would put
int zPClvl

above the gamemode block.

You didn't say what the script is running on? Running the script on a quest would probably be the best.

Link to comment
Share on other sites

Okay. Now I feel silly.... I can't believe I missed that step....................

 

Thank you for reminding me it won't do anything as a Quest script unless it's actually... y'know.... attached to a quest.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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