Jump to content

Photo

Item that floats.


  • Please log in to reply
22 replies to this topic

#1 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 27 April 2010 - 06:59 PM

Make it so the item can only be gotten if link is in the air like in links awakening.

... I had another but I forgot.. so maybe ask about that later..

#2 Joe123

Joe123

    Retired

  • Members

Posted 28 April 2010 - 03:57 AM

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        if(perm == 0) return;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Waitframe();
        }
        SetScreenDBit(d,perm,true);
    }
}


Works as 'More than one Item per Screen' from the database does, but there is now an extra argument on the end which control it's 'Z' coordinate on the screen.

#3 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 28 April 2010 - 11:46 AM

QUOTE(Joe123 @ Apr 28 2010, 04:57 AM) View Post

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        if(perm == 0) return;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Waitframe();
        }
        SetScreenDBit(d,perm,true);
    }
}


Works as 'More than one Item per Screen' from the database does, but there is now an extra argument on the end which control it's 'Z' coordinate on the screen.


ok and the Do - D1 arguments and such is same as that script?

Thanks

and the other was a script that changes Links tile set to a swimming one, As in links awakening there are a few screens where he is underwater.. so if I could just change the tiles he is using to swimming ones.. other wise I maybe able to use a hidden item that is disabled on every Dmap but one for underwater areas and be like a "ring" and simply changes him to the correct tiles( But this would less flexible). (I just thought up that solution I didn't test it though)


#4 Joe123

Joe123

    Retired

  • Members

Posted 28 April 2010 - 12:33 PM

Everything else is the same, but the argument after all of the other ones in the database's explanation adjusts the item's Z height.

Yeah, the ring method should work.

#5 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 28 April 2010 - 12:46 PM

QUOTE(Joe123 @ Apr 28 2010, 01:33 PM) View Post

Everything else is the same, but the argument after all of the other ones in the database's explanation adjusts the item's Z height.

Yeah, the ring method should work.


I still able to pick it up off the ground even with D6 set to 99 (and D7 on 10 tried after the other just in case it was that but d1-5 are used on the other)

#6 Joe123

Joe123

    Retired

  • Members

Posted 28 April 2010 - 12:48 PM

You did get the script from this thread and not from the database one, right?

#7 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 28 April 2010 - 01:24 PM

yep

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d,

int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        if(perm == 0) return;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Waitframe();
        }
        SetScreenDBit(d,perm,true);
    }
}

that.

Edited by caprontos, 28 April 2010 - 01:24 PM.


#8 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 28 April 2010 - 09:08 PM

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()) { i->Z = z; i->Jump = 0; }
        if(perm == 0) return;
        while(i->isValid()) Waitframe();
        SetScreenDBit(d,perm,true);
    }
}

See if that works. I merely moved the isValid pointer before the second return function, which should work. I think your earlier script would've worked as well, if the integer perm was not equal to zero, maybe. icon_razz.gif But, I've taken such a long break, I gotta get warmed up to scripting again! SoulSilver held my attention for longer than I expected! lol

Edited by AgentLym, 28 April 2010 - 09:09 PM.


#9 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 28 April 2010 - 09:27 PM

QUOTE(AgentLym @ Apr 28 2010, 10:08 PM) View Post

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()) { i->Z = z; i->Jump = 0; }
        if(perm == 0) return;
        while(i->isValid()) Waitframe();
        SetScreenDBit(d,perm,true);
    }
}

See if that works. I merely moved the isValid pointer before the second return function, which should work. I think your earlier script would've worked as well, if the integer perm was not equal to zero, maybe. icon_razz.gif But, I've taken such a long break, I gotta get warmed up to scripting again! SoulSilver held my attention for longer than I expected! lol


It seems to freeze the game when I enter the screen... (using D6, at value 1 2 and 0)

#10 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 28 April 2010 - 10:04 PM

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        if(i->isValid()) {i->Z = z; i->Jump = 0;}
        if(perm == 0) return;
        while(i->isValid()) Waitframe();
        SetScreenDBit(d,perm,true);
    }
}

Ah, right, I should've seen that. When the item is created, the engine will constantly place the item at Z height, not allowing anything else to work. Try the code again.

Edited by AgentLym, 28 April 2010 - 10:14 PM.


#11 Joe123

Joe123

    Retired

  • Members

Posted 29 April 2010 - 02:14 AM

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Waitframe();
        }
       if(perm != 0) SetScreenDBit(d,perm,true);
    }
}

Oh, it only worked properly for temporary items. Should be ok now.

#12 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 29 April 2010 - 01:35 PM

QUOTE(Joe123 @ Apr 29 2010, 03:14 AM) View Post

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Waitframe();
        }
       if(perm != 0) SetScreenDBit(d,perm,true);
    }
}

Oh, it only worked properly for temporary items. Should be ok now.


that works and for referance

if on your rocs feather your Height modifier is "2" it needs to be at height "32" to get it (I assume *1 height modifier is equal to 16 pixels*)


Thanks again (also link still appears above it.. I tried putting it on a different layers but doesn't work, if it can't be helped that's fine.)

Edited by caprontos, 29 April 2010 - 02:23 PM.


#13 Joe123

Joe123

    Retired

  • Members

Posted 29 April 2010 - 01:46 PM

No, 1 doesn't equal 16 don't say that! 1 height modifier is equal to 16 pixels worth of jump is not the same as 1 equals 16!
CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Screen->DrawTile(3,i->X,i->Y+2,i->Tile,1,1,i->CSet,-1,-1,-1,1,0,0,true,128);
            Waitframe();
        }
       if(perm != 0) SetScreenDBit(d,perm,true);
    }
}


That should put the graphic on layer 3.

#14 caprontos

caprontos

    Recipient of Ways

  • Members

Posted 29 April 2010 - 02:22 PM

QUOTE(Joe123 @ Apr 29 2010, 02:46 PM) View Post

No, 1 doesn't equal 16 don't say that! 1 height modifier is equal to 16 pixels worth of jump is not the same as 1 equals 16!
CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Screen->DrawTile(3,i->X,i->Y+2,i->Tile,1,1,i->CSet,-1,-1,-1,1,0,0,true,128);
            Waitframe();
        }
       if(perm != 0) SetScreenDBit(d,perm,true);
    }
}


That should put the graphic on layer 3.

Sorry, I meant that icon_razz.gif but can see how it could confuse some one.. I'll edited it out..(case someone else uses this )


and.. one more problem (sorry..) its drawing two of the item (one is on layer three and hte other is not and the one thats not is 2 tiles above the tile you jump from and the other is directly above

Is it because of the
"item i = CreateItemAt(itm,this->X,this->Y);"
and
"Screen->DrawTile(3,i->X,i->Y+2,i->Tile,1,1,i->CSet,-1,-1,-1,1,0,0,true,128);" being in there? so its doing both? (I'm not really sure if I know what they mean I'm guessing..)

#15 Joe123

Joe123

    Retired

  • Members

Posted 29 April 2010 - 02:26 PM

Well you'd hope that no-one'd get confused by it, it's just wrong.

CODE
ffc script SpawnItem{
    void run(int itm, int dly, int enemies, int holdup, int perm, int d, int z){
        if(enemies != 0) dly = 4;
        Waitframes(dly);
        if(perm > 0 && GetScreenDBit(d,perm)) return;
        while(enemies != 0 && Screen->NumNPCs() > 0) Waitframe();
        item i = CreateItemAt(itm,this->X,this->Y);
        if(holdup) i->Pickup |= IP_HOLDUP;
        while(i->isValid()){
            i->Z = z; i->Jump = 0;
            Screen->DrawTile(3,i->X,i->Y+2-i->Z,i->Tile,1,1,i->CSet,-1,-1,-1,1,0,0,true,128);
            Waitframe();
        }
       if(perm != 0) SetScreenDBit(d,perm,true);
    }
}


Drawing two sprites is intentional, I just got one of the in the wrong place. Try that, it might be one or two pixels out but I think it's right.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users