Jump to content

Photo

Inverted stomp boots

jumping attack item equipment

  • Please log in to reply
25 replies to this topic

#16 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 October 2014 - 02:24 PM

You're trying to compile this as a ZScript, right? Or are you trying to import it as a ZASM script?

 

You need to go to Quest->Scripts->Compile ZScript, or press "Y".



#17 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 13 October 2014 - 03:43 PM

the std error appears to be because my buffer already has it called for. I removed it from your amendment and the script compiles, But must be merged with the existing global. 


Edited by King Aquamentus, 13 October 2014 - 04:23 PM.


#18 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 October 2014 - 05:59 PM

Weird. That doesn't sound like the errors I get from re-importing a header.

 

Do you know how to merge global scripts? All you gotta do is put the int lastY = Link->Y before your while(true) loop and the stuff inside it all together inside your merged while(true) loop.



#19 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 14 October 2014 - 04:02 PM

I did that, but the resulting combination is causing my jumping to not work. The scripts I have replace the sword "A" with an always-equipped roc's feather. Instead, I'm shooting off Super Missiles. :( There's leftover data for an unimplemented Gravity Suit in here too which I need to clean out, so I'm really not sure where exactly the problem lies. 

I'm posting this, its basically the contents of my buffer. I don't know if it will help any, but I figure it can't hurt.

 


import "std.zh"

int jumpvel = 5;
int spacejumpitem = 52;
int jumpsound = 45;
bool addX = false;
int GravSuit = 145;
const int I_SHORYUKEN = 148;
const int SHORYUKEN_DAMAGE = 6;
 
bool allowSword = false;
 
bool isStanding(){
    int x;
    for(x=Link->X; x<=Link->X+16; x+= 8){
        if(x==Link->X+16) x--;
        if(Screen->isSolid(x, Link->Y+16)) return(true);
    }
    return(false);
}
 
bool SolidAbove(){
    int x;
    for(x=Link->X+2; x<=Link->X+14; x+=4){
        if(x==Link->X+14) x--;
        if(Screen->isSolid(x, Link->Y+0)) return(true);
    }
    return(false);
}
 
 
int scrolltile = 31264;
 
int SaveX;
int SaveY;
int SaveS;
int SaveM;
bool WasOnLadder = false;
 
bool HookGrab(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT && Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y)] == CT_HSGRAB ||
 
Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X,
 
HSCheck->Y+15)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y+15)] == CT_HSGRAB){
            return(true);
        }
    }
    return(false);
}
 
bool OnLadder()
{
    if(ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) ||
 
ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1)){
        return(true);
    }
    return(false);
}
 
bool OnLadderDown()
{
    if(!ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) && !ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) &&
 
(ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1))){
        return(true);
    }
    return(false);
}
 
bool isLSolidHorz(int y)
{
    int x;
    for(x=Link->X; x<=Link->X+16; x+= 8)
    {
        if(x==Link->X+16) x--;
        if(Screen->isSolid(x, y)) return(true);
    }
    return(false);
}
 
bool isFiringHS(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT){
            return(true);
        }
    }
    return(false);
}
 
bool isJumping(){
    if((GetEquipmentA() == I_ROCSFEATHER && Link->InputA == true) || (GetEquipmentB() == I_ROCSFEATHER &&
 
Link->InputB == true) || Link->Jump > 1){
        return(true);
    }
    return(false);
}
 
bool aboutToScroll(){
    if(Link->Y<=1 && Link->InputUp) return true;
    else if(Link->Y>=159 && Link->InputDown) return true;
    else if(Link->X<=1 && Link->InputLeft) return true;
    else if(Link->X>=239 && Link->InputRight) return true;
    else return false;
}
 
void GravSuit(){
int neg;
if(!Link->Item[GravSuit]) return;
if(Screen->ComboT[ComboAt(Link->X+2,Link->Y+9)]!=CT_WALKSLOW &&
Screen->ComboT[ComboAt(Link->X+2,Link->Y+14)]!=CT_WALKSLOW && 
Screen->ComboT[ComboAt(Link->X+13,Link->Y+9)]!=CT_WALKSLOW &&
Screen->ComboT[ComboAt(Link->X+13,Link->Y+14)]!=CT_WALKSLOW) return;
if(Link->InputLeft) neg=-1;
else if(Link->InputRight) neg=1;
else return;
if(addX && !Screen->isSolid(Link->X+(neg/2-.5)+8+8*neg, Link->Y+ 8) &&
!Screen->isSolid(Link->X+(neg/2-.5)+8+8*neg, Link->Y+15))Link->X+=neg;
addX=!addX;
}
 
 
 
 
global script Slot2
{
   void run()
   {
int lastY = Link->Y;
    while(true)
{
   if(Link->Item[I_SHORYUKEN] && IsSideview())
            {
                if(Link->Y < lastY)
                {
                    for(int i = 1; i < Screen->NumNPCs(); i++)
                    {
                        npc enem = Screen->LoadNPC(i);
                        if(LinkCollision(enem))
                        {
                            lweapon weap = CreateLWeaponAt(LW_FIRESPARKLE, enem->X, enem->Y);
                            weap->DrawXOffset = -999;
                            break;
                        }
                    }
                }
                lastY = Link->Y;
            }    
    Game->Counter[CR_SCRIPT2] = Game->Counter[CR_MAGIC];
    Game->Counter[CR_SCRIPT3] = Game->Counter[CR_LIFE];
 
    if(allowSword){
Link->InputA=true;
allowSword=false;
}
else{
Link->InputA=false;
if(Link->PressA && !SolidAbove() &&
(isStanding() || Link->Item[92])){
Link->Jump=jumpvel;
Game->PlaySound(45);
}
}
 
GravSuit();
 
        if(Game->GetCurDMapScreen()!=SaveS || Game->GetCurDMap()!=SaveM){
            Link->Invisible=false;
            while(Link->Action==LA_SCROLLING){ //Waitframes(49);
                if(OnLadder() == true && HookGrab() == false && isJumping() == false){
                    Waitdraw();
                    Link->Dir=DIR_DOWN;
                }
                Waitframe();
            }
            SaveX=Link->X;
            SaveY=Link->Y;
        }
        if(OnLadder() == true && HookGrab() == false && isJumping() == false){
            if(WasOnLadder == false){
                Link->Jump = 1;
                if(OnLadderDown()){
                    Link->Y++;
                    SaveY = Link->Y;
                }
            }
            else{
                Link->Jump = 0;
            }
            if(!isFiringHS()){
                if(Link->InputUp == true && !isLSolidHorz(Link->Y+7)){
                    SaveY--;
                }
                else if(Link->InputDown == true && !isLSolidHorz(Link->Y+16)){
                    SaveY++;
                }
                if(Link->InputLeft == true && !Screen->isSolid(Link->X-1, Link->Y+ 8) &&
 
!Screen->isSolid(Link->X-1, Link->Y+15)){
                    SaveX--;
                }
                else if(Link->InputRight == true && !Screen->isSolid(Link->X+16, Link->Y+ 8) &&
 
!Screen->isSolid(Link->X+16, Link->Y+15)){
                    SaveX++;
                }
            }
            Link->X = SaveX;
            Link->Y = SaveY;
            WasOnLadder = true;
            SaveS=Game->GetCurDMapScreen();
            SaveM=Game->GetCurDMap();
            if(!aboutToScroll()){
                Waitdraw();
                Link->Dir=DIR_DOWN;
            }
            else{
                Link->Invisible=true;
                Screen->FastTile(3, Link->X, Link->Y, scrolltile, 6, 128);
            }
        }
        else{
            if(WasOnLadder == true){
                Link->Jump = 0;
                WasOnLadder = false;
            }
            SaveX = Link->X;
            SaveY = Link->Y;
        }
        SaveS=Game->GetCurDMapScreen();
        SaveM=Game->GetCurDMap();
        Waitframe();
    }
    }
}
 
item script Roc{
    void run(){
        if(OnLadder() == true){
            Link->Jump = 3;
        }
    }
}
 
item script NewScrollTile{
    void run(int newtile){
        scrolltile = newtile;
    }
}
import "6_ItemPickupMessage.z"
import "hardjumpupgrade.z"
item script SwordItem{
void run(){
allowSword=true;
}
}
 

 


Edited by King Aquamentus, 16 October 2014 - 05:36 PM.


#20 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 15 November 2014 - 04:32 PM

MoscowModder, would it be possible for this to be classified as "script weapon" as seen in enemy defense flags? 



#21 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 15 November 2014 - 04:54 PM

Sure. Make sure nothing else uses the weapon ID LW_SHORYUKEN (set it to SCRIPT1 by default), because this will delete weapons of that ID (just so they don't get stuck, invisible, in the air).

 

Script


#22 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 15 November 2014 - 08:29 PM

Won't that create a persistent blob of LW_SHORYUKEN as long as Link is moving upward? It's a narrow window, but could potentially result in some enemy not touching Link to get hurt by the Shoryuken if I'm reading it right. Tangential question: is it possible to detect when Link is using the stomp boots to hurt an enemy?



#23 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 15 November 2014 - 08:48 PM

First question: It only creates them while Link is touching an enemy and rising. They should in theory vanish the very next frame. The new else{} block cleans up any that don't vanish.



#24 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 15 November 2014 - 09:21 PM

I thought lweapons don't vanish when touching an enemy that's in its invulnerability frames. That means your script creates a bunch of them while Link is on top of the enemy, but only the first one hurts the enemy and poofs. The rest will stick around and won't be cleared until Link stops rising.



#25 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 15 November 2014 - 10:25 PM

That is true. I guess it's up to KA whether that's a problem or not.

 

If it is, then I can reconfigure it to make a single LWeapon follow Link.



#26 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 15 November 2014 - 10:42 PM

I don't think that's too bad. and Screw Attack is the only real scripted weapon. Other weapons involve scripting but they are just mods of or in some way change how existing weapons are used. 

From the testing I've done, it seems to work alright. I can make enemies vulnerable to this only if I want, so that's a big boon. Also I can finally plop this down in its place in Norfair

Thanks a lot, Moscow. Sorry this took so long to get back on (had to get some help putting it in.) 


Edited by King Aquamentus, 15 November 2014 - 10:46 PM.




Also tagged with one or more of these keywords: jumping, attack, item, equipment

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users