item script RocsFeather{
//Returns true if item button is held on A or B
bool ButtonHeld(itemdata idat){
if(GetEquipmentA()==idat->ID&&Link->InputA)
return true;
if(GetEquipmentB()==idat->ID&&Link->InputB)
return true;
}
void run(int jumpHeight, int decay){
//Don't jump during actions
if(Link->Action!=LA_NONE&&Link->Action!=LA_WALKING)
Quit();
//Check if Link can jump
if(IsSideview()){ //In sideview this checks solidity under him (very basic, will need added hacks with scripts)
if(OnSidePlatform(Link->X, Link->Y))
Link->Jump = jumpHeight;
else
Quit();
}
else{ //In top-down it's as simple as checking Link->Z
if(Link->Z<=0)
Link->Jump = jumpHeight;
else
Quit();
}
//Play the sound and wait until he hits his peak
Game->PlaySound(SFX_JUMP);
while(Link->Jump>0){
//Dampen the jump when the button isn't being held
if(!ButtonHeld(this))
Link->Jump = Max(Link->Jump-decay, 0);
Waitframe();
}
}
}
Simple, somewhat lazy item script.
D0: Starting jump value (I went with 3.2 in testing)
D1: Decay value (I went with 0.32)
When the button isn't being held, Link's jump value gets subtracted by decay, this stops at the peak of Link's jump arc, so it doesn't affect the falling action at all. The higher the decay the more control the player has over where to stop their jump. You can set it to a high number for an instant stop but it'll look choppier as a result.