Jump to content

Need Script: Jump Higher With Specific Item Equipped


Kyle8497

Recommended Posts

I'll just cut to the chase, I need a script where when I equip a certain item, my jump height will increase to a specific value. Then, when I remove the item my jump height will return to default.



This is what I have just from exploring the internet, trying to put things together. It's probably completely broken.



Scriptname JumpHeightIncreaseSpaceJumpEquip extends activemagiceffect  

ObjectReference Property SpaceJumpBoots Auto

Event OnObjectEquipped(Form akBaseRef, ObjectReference akActionRef)
if Armor == SpaceJumpBoots
Game.GetPlayer().setgs fjumpheightmin 1000
endIf
endEvent

Event OnObjectUnequipped(Form akObjectRef, ObjectReference akActionRef)
if Amor == SpaceJumpBoots
Game.GetPlayer().setgs fjumpheightmin 76
endif
Endevent


Thanks. Credits will be give to whoever creates the script.


Edited by Kyle8497
Link to comment
Share on other sites

Try this. It needs to go on the player alias on a start game enabled quest. It also requires SKSE.

 

You will need to test compilation as well as performance

ScriptName JumpHeightIncreaseSpaceJumpEquip Extends ReferenceAlias 
 
Armor Property SpaceJumpBoots Auto
Float Property NewJumpHeight Auto
Float OldJumpHeight
Float CurrentJumpHeight

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	If akBaseObject == SpaceJumpBoots
		OldJumpHeight = Game.GetGameSettingFloat("fJumpHeightMin")
		Game.SetGameSettingFloat("fJumpHeightMin",NewJumpHeight)
		CurrentJumpHeight = NewJumpHeight
	EndIf
endEvent
 
Event OnObjectUnequipped(Form akObjectRef, ObjectReference akActionRef)
	If akObjectRef == SpaceJumpBoots
		Game.SetGameSettingFloat("fJumpHeightMin",OldJumpHeight)
		CurrentJumpHeight = OldJumpHeight
	EndIf
EndEvent

Event OnPlayerLoadGame()
	If CurrentJumpHeight <= 0
		Game.SetGameSettingFloat("fJumpHeightMin",CurrentJumpHeight)
	EndIf
EndEvent 

 

EDIT: Needed to add a check in the OnPlayerLoadGame event else it would have set the jump height to 0 whenever a new game session was started.

Edited by IsharaMeradin
Link to comment
Share on other sites

Read the Set Up a Reference Alias section on the Dynamically Attaching Scripts tutorial. That explains how to set up a quest with a reference alias for the player. Once that is done, you would apply the script to this alias.

 

In order to compile the script, SKSE needs to be fully installed including the PSC files (if you followed Gopher's video it should all be set up as needed).

Link to comment
Share on other sites

IsharaMeradin, I can't just attach the script to the boots themselves? And how do I compile for SKSE? Just normally through the CK?

 

By the way, when I tried to compile your script, it compiled successfully. Although, I changed a few things around in the code because I though I needed to, and I also set the properties for the SpaceJumpBoots and the NewJumpHeight. Can you please review it? It still complied successfully with the changes I made. Also, it doesn't work in game, I assume that's because I need to make a 'player alias'.

 

 

ScriptName JumpHeightIncreaseSpaceJumpEquip Extends ReferenceAlias 
 
Armor Property SpaceJumpBoots Auto
Float Property NewJumpHeight Auto
Float OldJumpHeight
Float CurrentJumpHeight
 
Event OnObjectEquipped(Form akBaseObject, ObjectReference akActionRef)
If akBaseObject == SpaceJumpBoots
OldJumpHeight = Game.GetGameSettingFloat("fJumpHeightMin")
Game.SetGameSettingFloat("fJumpHeightMin",NewJumpHeight)
CurrentJumpHeight = NewJumpHeight
EndIf
endEvent
 
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akActionRef)
If akBaseObject == SpaceJumpBoots
Game.SetGameSettingFloat("fJumpHeightMin",OldJumpHeight)
CurrentJumpHeight = OldJumpHeight
EndIf
EndEvent
 
Event OnPlayerLoadGame()
If CurrentJumpHeight <= 0
Game.SetGameSettingFloat("fJumpHeightMin",CurrentJumpHeight)
EndIf
EndEvent
Link to comment
Share on other sites

The reason I said it should be put on the player alias is that the INI setting change is not persistent. It has to be reset on game load. The only event that can catch that is OnPlayerLoadGame which is only triggered by the player.

 

Also change this line... I must not have been thinking clearly at the time...

If CurrentJumpHeight <= 0

to

If CurrentJumpHeight > 0

Link to comment
Share on other sites

I changed a few things around to make it compile successfully but it still doesn't work in game. Check out the new script:

 

Scriptname SpaceJumpBootsHigherJump extends ReferenceAlias  
 
ReferenceAlias Property Player  Auto  
 
Bool Property SpaceJumpBoots  Auto  
 
Float Property NewJumpHeight  Auto  
 
Float OldJumpHeight
 
Float CurrentJumpHeight
 
Event OnObjectEquipped(Form akBaseObject, ObjectReference akActionRef)
If akBaseObject == SpaceJumpBoots
OldJumpHeight = Game.GetGameSettingFloat("fJumpHeightMin")
Game.SetGameSettingFloat("fJumpHeightMin",NewJumpHeight)
CurrentJumpHeight = NewJumpHeight
EndIf
EndEvent
 
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akActionRef)
If akBaseObject == SpaceJumpBoots
Game.SetGameSettingFloat("fJumpHeightMin",OldJumpHeight)
CurrentJumpHeight = OldJumpHeight
EndIf
EndEvent
 
Function OnPlayerLoadGame()
If CurrentJumpHeight > 0
Game.SetGameSettingFloat("fJumpHeightMin",CurrentJumpHeight)
EndIf
EndFunction
Edited by Kyle8497
Link to comment
Share on other sites

Bool Property SpaceJumpBoots Auto <-- this is wrong

 

Armor Property SpaceJumpBoots Auto <-- needs to be this

 

If akBaseObject == SpaceJumpBoots <-- both lines of this

 

If akBaseObject as Armor == SpaceJumpBoots <-- adjusted to this -- my fault, I forgot to put that in originally.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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