Jump to content

Help please Scripting noob here.


Recommended Posts

I am new to scripting i'll just say this but I am running into a bit of trouble and any help would be appreciated as its all really new too me and hard to grasp.

 

Here is the code I need to add too.

Event OnKeyDown(Int KeyCode)
	
	If KeyCode == 58
	   PlayerRef.ForceActorValue("SpeedMult", 90.0)  ;        When Caps is held speed changes to 90.0
	EndIf
EndEvent

Event OnKeyUp(Int KeyCode, Float HoldTime)
	
	If KeyCode == 58
	PlayerRef.ForceActorValue("SpeedMult", 200.0) ;           When Key is let go it changes to stored value.
	EndIf
EndEvent

The issue is I need to add to the Event OnKeyup that when it begins I need it to -1 and +1 to my carry weight to workaround the animation issue when SpeedMult is changed.

 

Also if someone would be kind enough to tell me how aliases work ^^

Edited by aareyn
Link to comment
Share on other sites

Not sure if it's just this you're after or I have misunderstood.

Event OnKeyDown(Int KeyCode)
	
	If KeyCode == 58
	   PlayerRef.ForceActorValue("SpeedMult", 90.0)  ;        When Caps is held speed changes to 90.0
           Game.GetPlayer().DamageAV("CarryWeight", -0.001)
	EndIf
EndEvent

Event OnKeyUp(Int KeyCode, Float HoldTime)
	
	If KeyCode == 58
	PlayerRef.ForceActorValue("SpeedMult", 200.0) ;           When Key is let go it changes to stored value.
        Game.GetPlayer().DamageAV("CarryWeight", 0.001)
	EndIf
EndEvent
Link to comment
Share on other sites

I don't think you can damage an actor value by a negative number. I believe you want ModAV instead.

Definitely can for CarryWeight. This is the script I'm using for a sprint and it works

Scriptname AceSprintScript extends activemagiceffect  

Event OnEffectStart(Actor akTarget, Actor akCaster)

	Game.GetPlayer().DamageAV("Stamina", -50.0)
	Game.GetPlayer().DamageAV("CarryWeight", -0.001)

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

	Game.GetPlayer().DamageAV("CarryWeight", 0.001)

EndEvent

Reversed the +/- just now and it still works.

Link to comment
Share on other sites

I believe what lofgren meant was, damageav converts negative values to positive and applies that as damage. So that negative's not adding carry weight, it's only subtracting.

Oh lol. Just tested it and that's correct.

Updated:

Event OnEffectStart(Actor akTarget, Actor akCaster)

	Game.GetPlayer().DamageAV("Stamina", -50.0)
	Game.GetPlayer().Modav("CarryWeight", 0.001)

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

	Game.GetPlayer().Modav("CarryWeight", -0.001)

EndEvent

Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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