Jump to content

Constantly receive xp (Script)


Recommended Posts

I'm working on a fitness modification where you constantly can get small amounts of exp while doing push ups.

 

However: While the player receives 5xp every second this effect stops after about ten rounds. Sleeping, travelling doesn't help.

 

 

 

 

So here:s what I did:

The base script looks like this:

Scriptname FTGetExp extends ActiveMagicEffect


ActorValue property Experience auto

Float property xpts = 200.0 auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
Game.GetPlayer().ModValue(Experience, xpts)
EndEvent

 

I then put the script inside a magic effect, the magic effect inside a spell and used the spell inside the water drinking script. The one used for drinking from water fountains, pumps, ect..

 

GlPAzyR.png

 

This script is applied to the push-up matress which is a furniture.

 

 

 

 

So my big question is: Does anyone know how to make a stable experience script that does loop itself if the furniture is activated?

Link to comment
Share on other sites

Hm, that's nice idea. Drinking script has too much of excessive (or was the mod intended for ps4?). And i don't know, if there is any limitation for XP getting rate, and why it stops.

Would do like that (took HC_EncumbranceEffect_CastScript as a base).

 

 

Scriptname PushUpTraining extends ObjectReference

Group Data
spell Property SpellToCast const auto mandatory
{HC_EncumbranceEffect_DamagePlayer}

float Property CastTimerInterval = 5.0 const auto
{how often should we cast the spell on the actor}

 

ActorValue property Experience auto
Float property xpts = 25.0 auto
Sound Property LoopSound Auto Const ; should be looping SNDR

EndGroup

actor actorRef ; var just in case
int iSoundID

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
actorRef = akActionRef
startTimer(CastTimerInterval)
iSoundID = LoopSound.Play(actorRef)
EndIf
EndEvent

Function CastSpellAndStartTimer()
if IsFurnitureInUse()
actorRef.ModValue(Experience, xpts) ; OR Game.RewardPlayerXP(xpts) OR SpellToCast.Cast(actorRef)
startTimer(CastTimerInterval)
endif
EndFunction

Event OnTimer(int aiTimerID)
CastSpellAndStartTimer()
EndEvent

Event OnExitFurniture(ObjectReference akActionRef)
CancelTimer
Sound.StopInstance(iSoundID)
EndEvent



PS. Possibly, i'll steal Exp idea for ps4. For now i have temporary STR bonus awarded after a time period doing push-ups.

Is ModValue(Experience) a safe method of awarding XP actually? Looks too harsh, game should register it somehow i suppose.

Edited by hereami
Link to comment
Share on other sites

ModValue is thread safe as is all the other modxxx things. You run into trouble if you were to try setting the value while getting the value(the value wont change as expected), this is why it's better to use Modxxx.

 

RewardExp might be better if the intent to always receive a specific amount and not care about things like how far you're into the current level, etc. The Experience AV allows for some extra maths.

Edited by Rasikko
Link to comment
Share on other sites

ModValue is thread safe as is all the other modxxx things. You run into trouble if you were to try setting the value while getting the value(the value wont change as expected), this is why it's better to use Modxxx.

 

RewardExp might be better if the intent to always receive a specific amount and not care about things like how far you're into the current level, etc. The Experience AV allows for some extra maths.

Interesting, thanks. I thought about how game reacts to direct edit, does it accumulate silently and then suddenly you get level up after getting legit 1 XP from Reward function? RewardPlayerXP has a parameter abDirect to bypass situational calculations.

PS. Well, if silently, then it may be better for getting small amount frequently.

Edited by hereami
Link to comment
Share on other sites

My take on that parameter is that the passed in XP can be made subject to modifiers provided by perks. If you have perk that multiplies all gained xp by 50%(x1.5), this function will allow the passed in value to be affected by that. So if true, for example, 200 xp is 200xp, and not 300. This just conjecture/head math on my part, I have not done any testing.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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