Mailamea Posted October 10, 2014 Share Posted October 10, 2014 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
aqqh Posted October 10, 2014 Share Posted October 10, 2014 Float fPlayerStamina = Game.GetPlayer().GetActorValue("Stamina") if fPlayerStamina < 30 Game.GetPlayer().EquipItem(<item property>) Else Game.GetPlayer().UnequipItem(<item property>) endif They say that using property for PlayerRef is more effective than Game.GetPlayer(). Link to comment
Mailamea Posted October 10, 2014 Author Share Posted October 10, 2014 Float fPlayerStamina = Game.GetPlayer().GetActorValue("Stamina") if fPlayerStamina < 30 Game.GetPlayer().EquipItem(<item property>) Else Game.GetPlayer().UnequipItem(<item property>) endif 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 Posted October 11, 2014 Share Posted October 11, 2014 From what I recall* you use a property like this: Actor Property PlayerREF Auto then float fPlayerStamina = PlayerREF.GetActorValue("Stamina") if (fPlayerStamina < 30) PlayerREF.EquipItem(<item property>) else PlayerREF.UnequipItem(<item property>) endif 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. [edit] I think you shouldn't loop this, but trap some event, have a look at: http://www.creationkit.com/OnTrackedStatsEvent_-_Form Event OnTrackedStatsEvent(string asStatFilter, int aiStatValue) if (asStatFilter == "Stamina") if (aiStatValue < 30) PlayerRef.equipItem(<item property>); else PlayerREF.uneqipItem(<item property>); endif endif endEvent [edit2] 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
Mailamea Posted October 12, 2014 Author Share Posted October 12, 2014 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 Posted October 12, 2014 Share Posted October 12, 2014 Please ignore what I wrote above, it's been a while since I dabbled with this... OnTrackedStatsEvent 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 [edit] 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 ;cell:(any) ;Reference: PlayerRef('Player') Actor Property PlayerRef Auto bool equipedItem = false event onInit() checkStamina() endEvent function checkStamina() while(!PlayerRef.isDead()) Utility.wait(0.2) 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... equipedItem=true elseIf((PlayerRef.getActorValue("Stamina")>70) && (equipedItem)) debug.notification("Re-equip item!"); equipedItem=false endIf endWhile endFunction *And so is while-loops in scripts IMHO. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.