Jump to content

Photo

Fire/Ice Arrow Script


  • Please log in to reply
19 replies to this topic

#16 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 14 March 2009 - 09:11 PM

Alright I'm done harassing Joe..for now that is! icon_heh.gif


Now the meat:
I finished your script and introduced a few. new. never. seen. before.awesome. features! omfgwhatdoesthatdo!? Four words : Quartic - Vertex - Dimensional - Bannana. !!! ...Just kidding. =\

Actually what I've introduced into ZScript are : Singular and Tiered F***ing Activation of tehFlags, or SATFAT for short. icon_razz.gif (..Not kidding this time.. ! ) I hereby unconditionally give permission to use/change/modify any/all code I create past/present/future on the one condition that this by referred to as the 'SATFAT' system. icon_slycool.gif lol.

There is weird bug I'm working out atm, but the Tiered part will be available via FFC script shortly.



OK, now that I am done butchering the English language, here is the code:

CODE
// Fill these in with the start and ending ID of the tiles used by the custom weapon sprites!!
// Example:  CIT98 = 3400; CIT98E = 3407; //Thus the animation for this weapon would be 8-frames starting at tile #3400.
// Got it? Good.

const int CIT98 = 0; const int CIT98E = 0;
const int CIT99 = 0; const int CIT99E = 0;
const int CIT100 = 0; const int CIT100E = 0;
const int CIT101 = 0; const int CIT101E = 0;
const int CIT102 = 0; const int CIT102E = 0;

//CustomItemFlagTestCollisionDetectionWorkaround!:P
void doCIFTCDW(){
    int x; int y;
    lweapon lw_sprite;
    int lw_num = Screen->NumLWeapons();

    for(int l = lw_num; l>0; l--)
    {
        lw_sprite = Screen->LoadLWeapon(l);
        x = lw_sprite->X; y = lw_sprite->Y;
        if((lw_sprite->Tile>=CIT98&&lw_sprite->Tile<=CIT98E&&Screen->ComboF[ComboAt(x+8,y+8)]==98)||
        (lw_sprite->Tile>=CIT99&&lw_sprite->Tile<=CIT99E&&Screen->ComboF[ComboAt(x+8,y+8)]==99)||
        (lw_sprite->Tile>=CIT100&&lw_sprite->Tile<=CIT100E&&Screen->ComboF[ComboAt(x+8,y+8)]==100)||
        (lw_sprite->Tile>=CIT101&&lw_sprite->Tile<=CIT101E&&Screen->ComboF[ComboAt(x+8,y+8)]==101)||
        (lw_sprite->Tile>=CIT102&&lw_sprite->Tile<=CIT102E&&Screen->ComboF[ComboAt(x+8,y+8)]==102)){
            doCISP(x,y); return; }
    }
}

//CustomItemSwapProcedure!:P
void doCISP(int x, int y){
    int target = ComboAt(x+8,y+8);
    Screen->ComboF[target] = 5;
    lweapon lw_sprite = Screen->CreateLWeapon(8);
    lw_sprite->X=x;lw_sprite->Y=y;
    Waitframe();if(lw_sprite->isValid())lw_sprite->DeadState = 0;
    return;
}




global script slot2
{
    void run()
    {
        
        while(true)
        {

            doCIFTCDW(); //Put this line in your global loop if you have another script!
            Waitframe();
            
        }
    }
}


Alestance, if you have any questions just ask away. I think the comment cleared up the confusion. Also, If you would like them to behave like normal zc flags, then I'll throw together a plug in for that.

Have fun!

#17 Joe123

Joe123

    Retired

  • Members

Posted 15 March 2009 - 04:24 AM

Ah, you're creating an lweapon and the flag for that lweapon.
I had thought about doing that once, but actually I found it easier just to put a trigger combo under Link's feet.

Then again,
CODE
void SecretTrigger(){
    Screen->State[ST_SECRET] = true;
    Link->PitWarp(Game->GetCurDMap(),Game->GetCurDMapScreen());
}

Looks fine to me.

Have you tested your code?

#18 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 15 March 2009 - 06:35 AM

QUOTE(Joe123 @ Mar 15 2009, 02:24 AM) View Post

Ah, you're creating an lweapon and the flag for that lweapon.
I had thought about doing that once, but actually I found it easier just to put a trigger combo under Link's feet.

Then again,
CODE
void SecretTrigger(){
    Screen->State[ST_SECRET] = true;
    Link->PitWarp(Game->GetCurDMap(),Game->GetCurDMapScreen());
}

Looks fine to me.

Have you tested your code?


Unfortunately that code doesn't work so well. Just load up 1st quest with that script and you'll see that it's quite annoying.

Plus there is now a new feature with the way I did it. Still working out the kinks, but singular tiered custom flags is pretty neat. You could make some nasty puzzles with it!

..Speaking of which, A minor update:


CODE

// Fill these in with the start and ending ID of the tiles used by the custom weapon sprites!!
// Example:  CIT98 = 3400; CIT98E = 3407; //Thus the animation for this weapon would be 8-frames starting at tile #3400.
// Got it? Good.

const int CIT98 = 0; const int CIT98E = 0;
const int CIT99 = 0; const int CIT99E = 0;
const int CIT100 = 0; const int CIT100E = 0;
const int CIT101 = 0; const int CIT101E = 0;
const int CIT102 = 0; const int CIT102E = 0;

const int SATFATFFC = 32;

//CustomItemFlagTestCollisionDetectionWorkaround!:P
void doCIFTCDW(){
    int x; int y;
    lweapon lw_sprite;
    int lw_num = Screen->NumLWeapons();

    for(int l = lw_num; l>0; l--)
    {
        lw_sprite = Screen->LoadLWeapon(l);
        x = lw_sprite->X; y = lw_sprite->Y;
        if(lw_sprite->Tile>=CIT98&&lw_sprite->Tile<=CIT98E&&Screen->ComboF[ComboAt(x+8,y+8)]==98)
            { doCISP(x,y,98); return; }
        if(lw_sprite->Tile>=CIT99&&lw_sprite->Tile<=CIT99E&&Screen->ComboF[ComboAt(x+8,y+8)]==99)
            { doCISP(x,y,99); return; }
        if(lw_sprite->Tile>=CIT100&&lw_sprite->Tile<=CIT100E&&Screen->ComboF[ComboAt(x+8,y+8)]==100)
            { doCISP(x,y,100); return; }
        if(lw_sprite->Tile>=CIT101&&lw_sprite->Tile<=CIT101E&&Screen->ComboF[ComboAt(x+8,y+8)]==101)
            { doCISP(x,y,101); return; }
        if(lw_sprite->Tile>=CIT102&&lw_sprite->Tile<=CIT102E&&Screen->ComboF[ComboAt(x+8,y+8)]==102)
            { doCISP(x,y,102); return; }
    }
}

//CustomItemSwapProcedure!:P
void doCISP(int x, int y, int flag){
    lweapon lw_sprite;
    int target = ComboAt(x+8,y+8);
    if(flag==98){ Screen->ComboF[target] = 5; lw_sprite = Screen->CreateLWeapon(8);} //arrow
    if(flag==99){ Screen->ComboF[target] = 68; lw_sprite = Screen->CreateLWeapon(3);} //brang
    if(flag==100){ Screen->ComboF[target] = 76; lw_sprite = Screen->CreateLWeapon(12);} //wand
    if(flag==101){ Screen->ComboF[target] = 77; lw_sprite = Screen->CreateLWeapon(16);} //refmagic
    if(flag==102){ Screen->ComboF[target] = 78; lw_sprite = Screen->CreateLWeapon(17);} //reffireball
    lw_sprite->X=x;lw_sprite->Y=y;
    Waitframe();if(lw_sprite->isValid())lw_sprite->DeadState = 0;
    ffc F = Screen->LoadFFC(SATFATFFC);
    Screen->D[7]=flag;
    F->X=x;F->Y=y;
    return;
}


ffc script SATFAT{
    void run(int t98, int t99, int t100, int t101, int t102){
        while(true)
        {
            Waitframe();
            if(Screen->D[7]>0)
            {
                Waitframes(2);
                if(Screen->D[7]==98)Screen->ComboF[ComboAt(this->X+8,this->Y+8)]=t98;
                if(Screen->D[7]==99)Screen->ComboF[ComboAt(this->X+8,this->Y+8)]=t99;
                if(Screen->D[7]==100)Screen->ComboF[ComboAt(this->X+8,this->Y+8)]=t100;
                if(Screen->D[7]==101)Screen->ComboF[ComboAt(this->X+8,this->Y+8)]=t101;
                if(Screen->D[7]==102)Screen->ComboF[ComboAt(this->X+8,this->Y+8)]=t102;
                Screen->D[7]=0;
            }
        }
    }
}


global script slot2
{
    void run()
    {
        
        while(true)
        {

            doCIFTCDW(); //Put this line in your global loop if you have another script!
            Waitframe();
            
        }
    }
}


Tested. Compiles and works fine. Not finished with it though.



#19 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 18 March 2009 - 11:37 AM

Just wondering if it's working for you or not is all...

#20 Alestance

Alestance

    Saint Alestance - Eliminator of the ZGP format

  • Members
  • Real Name:Lonk
  • Location:Pennsylvania

Posted 18 March 2009 - 01:04 PM

I haven't gotten the chance to test it. What build did you make it for and would it be compatible with the latest linux build?


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users