Jump to content

Photo

Need Script: Jump Higher With Specific Item Equipped

code papyrus equip event unequip power ability

  • Please log in to reply
15 replies to this topic

#1
Kyle8497

Kyle8497

    Enthusiast

  • Members
  • PipPip
  • 138 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, 18 May 2014 - 11:46 PM.


#2
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 9,437 posts

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

Spoiler
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, 18 May 2014 - 11:49 PM.


#3
Kyle8497

Kyle8497

    Enthusiast

  • Members
  • PipPip
  • 138 posts

I will try it out as soon as I can, thanks.



#4
Kyle8497

Kyle8497

    Enthusiast

  • Members
  • PipPip
  • 138 posts

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

 

Can you go in depth a little bit more on what you mean by this?



#5
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 9,437 posts

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).



#6
Kyle8497

Kyle8497

    Enthusiast

  • Members
  • PipPip
  • 138 posts

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


#7
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 9,437 posts

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



#8
Kyle8497

Kyle8497

    Enthusiast

  • Members
  • PipPip
  • 138 posts

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, 23 May 2014 - 08:27 PM.


#9
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 9,437 posts

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.



#10
lofgren

lofgren

    Resident poster

  • Premium Member
  • 3,337 posts

Is messing around with the ini settings really necessary? Is the JumpingBonus actor value nonworking?







Also tagged with one or more of these keywords: code, papyrus, equip, event, unequip, power, ability

IPB skins by Skinbox
Page loaded in: 1.155 seconds