Jump to content

Recommended Posts

I remember back in oblivion and fallout I did some thing like this.


Begin gamemode


Get player stamina

If stamina < 30

Player.equipitem xxxx

Else player unequipitem


Then it loops so it keeps going


I know the script is 20000% wrong but can someone point me to the right direction? Im on to something new but my scripting is shit.

Link to comment

Float fPlayerStamina = Game.GetPlayer().GetActorValue("Stamina")

if fPlayerStamina < 30

Game.GetPlayer().EquipItem(<item property>)


Game.GetPlayer().UnequipItem(<item property>)



They say that using property for PlayerRef is more effective than Game.GetPlayer().

Link to comment

Float fPlayerStamina = Game.GetPlayer().GetActorValue("Stamina")

if fPlayerStamina < 30

Game.GetPlayer().EquipItem(<item property>)


Game.GetPlayer().UnequipItem(<item property>)



They say that using property for PlayerRef is more effective than Game.GetPlayer().

Attatch the script to a quest.


Ill try playerref if this works and see which works best.

Game.playerref() ? Or another code when using ref?


Thank you

Link to comment
Guest Plastrader

From what I recall* you use a property like this:

Actor Property PlayerREF Auto


float fPlayerStamina = PlayerREF.GetActorValue("Stamina")
if (fPlayerStamina < 30)
     PlayerREF.EquipItem(<item property>)
    PlayerREF.UnequipItem(<item property>)

Game.stuff is costly so try to use properties where applicable.


I haven't configured my CK, but I'll assist if you need more help.



I think you shouldn't loop this, but trap some event, have a look at:


Event OnTrackedStatsEvent(string asStatFilter, int aiStatValue)
    if (asStatFilter == "Stamina")
        if (aiStatValue < 30)
	    PlayerRef.equipItem(<item property>);
           PlayerREF.uneqipItem(<item property>);


The above would be a bad way of doing things(the if-else statement part)

Is the purpouse of the script to check stamina, and by a certain level equip an item?


*I lost every .psc I've done, my back up routine is, well lets call it NON EXSISTANT!!!

Link to comment

Ok, finally gonna do this once I wake up, ill be sure to poke you wizards when I get stuck, or don't understand it at all lol XD.



Just wondering when this works, the idea I had, I wonder why no one tried it. Well let's hope I get it too work, its a nice surprise like my follower -> player thread.

Link to comment
Guest Plastrader

Please ignore what I wrote above, it's been a while since I dabbled with this...


Does not track "those" stats, but instead skill increase and such.

I can't find any event when the player or any other actor takes damage, lose stamina etc.


Perhaps this can be done by using conditional quest stages, because they(quest stages) can check stamina values.

Or, the option to have a while loop running is the only way.


I'll be back


This is one way of doing it(the loop can be an event "RegisterForSingleUpdate" too, however they're abit dangerous*), but seeing I'm not 100% sure what the purpouse of this script is yet :)

Scriptname Trollolol_StaminaChange extends Quest
;Auto fill this in the properties window
;Reference: PlayerRef('Player')
Actor Property PlayerRef  Auto
bool equipedItem = false
event onInit()
function checkStamina()
		if((PlayerRef.getActorValue("Stamina")<30) && (!equipedItem))
			;or getActorValuePercent()
			debug.notification("Equip some item, maybe store the currently equiped item somewhere");
			;To hinder the script to fire off when stamina is 25, or 23 etc...
		elseIf((PlayerRef.getActorValue("Stamina")>70) && (equipedItem))
			debug.notification("Re-equip item!");
*And so is while-loops in scripts IMHO.
Link to comment


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use