Jump to content

Photo

A few of my scripts...


  • Please log in to reply
4 replies to this topic

#1 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

  • Members
  • Real Name:Matthew
  • Location:Static Void Kingdom

Posted 22 November 2007 - 07:34 PM

Since some of you are having trouble getting my scripts out of my Realm of Mirrors demo...

CODE
import "std.zh"

item script wshieldmsg
{
    void run()
    {
        Screen->Message(13);
    }
}


CODE
// Deep Water- When Link steps on a certain combo without a certain item in his inventory, the combo turns into a Damage Combo. If he does, it becomes normal
// water. Simple. as. that. 4 combos for Water, 4 combos for Dive Warp. No Swim Warp, though. Unless you feel like making more variables. Set this script to
// each screen with the desired combo(s). Best not to use it anywhere else. Why? Well, it wouldn't really make sense. A waste of FFCs.
// Constants/Variables:
// water1-water4- D0 through D3. Control what combos turn into water.
// dive1-dive4- D4 through D7. Will be used for Dive Warp instead of Water.
// level2flippers- What item ID will be used for the Level 2 Flippers. And please, remember to set the item in the Flippers Itemclass. It makes it better.
// damage- How much HP to take off Link if he touches the Deep Water without L-2 Flippers. Default is 8, 1/2 Heart.
// warp1-warp4- Which Dive Warp combo the 4 "dive" variables will turn into. They don't even need to be Dive Warp combos. In case you want more than one Dive
// Warp per screen, or if you've used some other warps. Hey, better safe than sorry. I need to make sure of your ideas! :(

import "std.zh"

const int level2flippers = 248;
const int damage = 8;
const int warp1 = 19;
const int warp2 = 19;
const int warp3 = 19;
const int warp4 = 19;

ffc script deepwater
{
    void run(int water1, int water2, int water3, int water4, int dive1, int dive2, int dive3, int dive4)
    {
        while(true)
        {
            for (int cmbchk = 0; cmbchk < 176; cmbchk++)
            {
                if(Screen->ComboD[cmbchk] == water1 || Screen->ComboD[cmbchk] == water2 || Screen->ComboD[cmbchk] == water3 || Screen->ComboD[cmbchk] == water4)
                {
                    if(!Link->Item[level2flippers])
                    {
                        Screen->ComboS[cmbchk] = 0;
                    }
                    else if(Link->Item[level2flippers])
                    {
                        Screen->ComboT[cmbchk] = 3;
                        Screen->ComboS[cmbchk] = 15;
                    }
                }
                if(Screen->ComboD[cmbchk] == dive1)
                {
                    if(!Link->Item[level2flippers])
                    {
                        Screen->ComboS[cmbchk] = 0;
                    }
                    else if(Link->Item[level2flippers])
                    {
                        Screen->ComboT[cmbchk] = warp1;
                        Screen->ComboS[cmbchk] = 15;
                    }
                }
                if(Screen->ComboD[cmbchk] == dive2)
                {
                    if(!Link->Item[level2flippers])
                    {
                        Screen->ComboS[cmbchk] = 0;
                    }
                    else if(Link->Item[level2flippers])
                    {
                        Screen->ComboT[cmbchk] = warp2;
                        Screen->ComboS[cmbchk] = 15;
                    }
                }
                if(Screen->ComboD[cmbchk] == dive3)
                {
                    if(!Link->Item[level2flippers])
                    {
                        Screen->ComboS[cmbchk] = 0;
                    }
                    else if(Link->Item[level2flippers])
                    {
                        Screen->ComboT[cmbchk] = warp3;
                        Screen->ComboS[cmbchk] = 15;
                    }
                }
                if(Screen->ComboD[cmbchk] == dive4)
                {
                    if(!Link->Item[level2flippers])
                    {
                        Screen->ComboS[cmbchk] = 0;
                    }
                    else if(Link->Item[level2flippers])
                    {
                        Screen->ComboT[cmbchk] = warp4;
                        Screen->ComboS[cmbchk] = 15;
                    }
                }
                int loc = ComboAt(Link->X, Link->Y);
                if(Screen->ComboD[loc] == water1 || Screen->ComboD[loc] == water2 || Screen->ComboD[loc] == water3 || Screen->ComboD[loc] == water4 || Screen->ComboD[loc] == dive1 || Screen->ComboD[loc] == dive2 || Screen->ComboD[loc] == dive3 || Screen->ComboD[loc] == dive4)
                {
                    Link->HP -= damage;
                    Game->PlaySound(19);
                    int stopYUP = Link->Y - 16;
                    int stopYDOWN = Link->Y + 16;
                    int stopXLEFT = Link->X - 16;
                    int stopXRIGHT = Link->X + 16;
                    if(Link->Dir == 1)
                    {
                        while(Link->Y > stopYUP)
                        {
                            Link->Y -= 4;
                            Waitframe();
                        }
                    }
                    else if(Link->Dir == 0)
                    {
                        while(Link->Y < stopYDOWN)
                        {
                            Link->Y += 4;
                            Waitframe();
                        }
                    }
                    else if(Link->Dir == 3)
                    {
                        while(Link->X > stopXLEFT)
                        {
                            Link->X -= 4;
                            Waitframe();
                        }
                    }
                    else if(Link->Dir == 2)
                    {
                        while(Link->X < stopXRIGHT)
                        {
                            Link->X += 4;
                            Waitframe();
                        }
                    }
                }
            }
            Waitframe();
        }
    }
}


(continued next post)

(continued from previous post)

CODE
// Shop- Oracles-style shop, where you must press A to buy the item. There is no confirmation message, though, so only press A if you want the item!
// Constants:
// nerm- Weird name, yes, but... Message to use when you try to buy an item without the required amount of Rupees. "THAT AIN'T ENOUGH TO BUY!"
// boughtmsg- Message to use when you buy something.
// D variables:
// item1- Variable D0. First item you can buy.
// item2- Variable D1. Second item you can buy.
// item3- Variable D2. Third item you can buy.
// item4- Variable D3. Fourth item you can buy.
// price1- Variable D4. Price of item1.
// price2- Variable D5. Price of item2.
// price3- Variable D6. Price of item3.
// price4- Variable D7. Price of item4.

import "std.zh"

const int nerm = 12;
ffc script shop
{
    void run(int item1, int item2, int item3, int item4, int price1, int price2, int price3, int price4) //load up the D variables
    {
        int nobuy = 0;
        int wait = 1;
        while(true) //as long as the script is active, it'll NEVER stop. Yay!
        {
            ffc buy1 = Screen->LoadFFC(31);
            ffc buy2 = Screen->LoadFFC(30);   //we load the 4 FFCs to be used for the shop here...
            ffc buy3 = Screen->LoadFFC(29);
            ffc buy4 = Screen->LoadFFC(28);
            while((Link->X > buy1->X-4 && Link->X < buy1->X+4) && Link->Y == buy1->Y) //continue only if Link is on the FFC
            {
                while(Link->InputA) //only allow buying if you press A
                {
                    if(nobuy == 0 && Game->Counter[1] >= price1 && Link->Dir == 0) //buy only if you're not constantly holding A, if you have enough Rupees, and if you are facing the item.
                    {
                        nobuy = 1;        //helps start the no-buy timer
                        Link->Item[item1] = true; //gives Link the item
                        Game->PlaySound(25);
                        Screen->Message(71);
                        int drainwait = price1; //places the price of the item you just bought into a new variable to be deducted from...we can't deduct from the price variable, or else the price of the item might go down. XD
                        while(drainwait > 0)
                        {
                            Game->Counter[1] -= 1;        //we take away Link's Rupees gradually here...just like with the normal shops.
                            drainwait -= 1; //take away 1 from the deduction variable so it knows how much more to take away
                            Waitframe(); //wait one frame...without this, the script would freeze the player...and that could be dangerous. VERY dangerous indeed...
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price1 && Link->Dir == 0) //check if the player tries to buy an item without enough Rupees
                    {
                        Screen->Message(nerm); //bring up a message to tell the player that he/she needs more Rupees
                        nobuy = 1; //hey, without this, the message will keep repeating! :O
                    }
                    Waitframe();
                }
                if(!Link->InputA)
                {
                    nobuy = 0;
                }
                
                Waitframe();
            }
            while((Link->X > buy2->X-4 && Link->X < buy2->X+4) && Link->Y == buy2->Y)
            {
                while(Link->InputA) //only allow buying if you press A
                {
                    if(nobuy == 0 && Game->Counter[1] >= price2 && Link->Dir == 0) //buy only if you're not constantly holding A, if you have enough Rupees, and if you are facing the item.
                    {
                        nobuy = 1;        //helps start the no-buy timer
                        Link->Item[item2] = true; //gives Link the item
                        Game->PlaySound(25);
                        Screen->Message(13);
                        int drainwait = price2; //places the price of the item you just bought into a new variable to be deducted from...we can't deduct from the price variable, or else the price of the item might go down. XD
                        while(drainwait > 0)
                        {
                            Game->Counter[1] -= 1;        //we take away Link's Rupees gradually here...just like with the normal shops.
                            drainwait -= 1; //take away 1 from the deduction variable so it knows how much more to take away
                            Waitframe(); //wait one frame...without this, the script would freeze the player...and that could be dangerous. VERY dangerous indeed...
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price2 && Link->Dir == 0) //check if the player tries to buy an item without enough Rupees
                    {
                        Screen->Message(nerm); //bring up a message to tell the player that he/she needs more Rupees
                        nobuy = 1; //hey, without this, the message will keep repeating! :O
                    }
                    Waitframe();
                }
                if(!Link->InputA)
                {
                    nobuy = 0;
                }
                
                Waitframe();
            }
            while((Link->X > buy3->X-4 && Link->X < buy3->X+4) && Link->Y == buy3->Y)
            {
                while(Link->InputA) //only allow buying if you press A
                {
                    if(nobuy == 0 && Game->Counter[1] >= price3 && Link->Dir == 0) //buy only if you're not constantly holding A, if you have enough Rupees, and if you are facing the item.
                    {
                        nobuy = 1;        //helps start the no-buy timer
                        Link->Item[item3] = true; //gives Link the item
                        Game->PlaySound(25);
                        Screen->Message(14);
                        int drainwait = price3; //places the price of the item you just bought into a new variable to be deducted from...we can't deduct from the price variable, or else the price of the item might go down. XD
                        while(drainwait > 0)
                        {
                            Game->Counter[1] -= 1;        //we take away Link's Rupees gradually here...just like with the normal shops.
                            drainwait -= 1; //take away 1 from the deduction variable so it knows how much more to take away
                            Waitframe(); //wait one frame...without this, the script would freeze the player...and that could be dangerous. VERY dangerous indeed...
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price3 && Link->Dir == 0) //check if the player tries to buy an item without enough Rupees
                    {
                        Screen->Message(nerm); //bring up a message to tell the player that he/she needs more Rupees
                        nobuy = 1; //hey, without this, the message will keep repeating! :O
                    }
                    Waitframe();
                }
                if(!Link->InputA)
                {
                    nobuy = 0;
                }
                
                Waitframe();
            }
            while((Link->X > buy4->X-4 && Link->X < buy4->X+4) && Link->Y == buy4->Y)
            {
                while(Link->InputA) //only allow buying if you press A
                {
                    if(nobuy == 0 && Game->Counter[1] >= price4 && Link->Dir == 0) //buy only if you're not constantly holding A, if you have enough Rupees, and if you are facing the item.
                    {
                        nobuy = 1;        //helps start the no-buy timer
                        Link->Item[item4] = true; //gives Link the item
                        Game->PlaySound(25);
                        Screen->Message(71);
                        int drainwait = price4; //places the price of the item you just bought into a new variable to be deducted from...we can't deduct from the price variable, or else the price of the item might go down. XD
                        while(drainwait > 0)
                        {
                            Game->Counter[1] -= 1;        //we take away Link's Rupees gradually here...just like with the normal shops.
                            drainwait -= 1; //take away 1 from the deduction variable so it knows how much more to take away
                            Waitframe(); //wait one frame...without this, the script would freeze the player...and that could be dangerous. VERY dangerous indeed...
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price4 && Link->Dir == 0) //check if the player tries to buy an item without enough Rupees
                    {
                        Screen->Message(nerm); //bring up a message to tell the player that he/she needs more Rupees
                        nobuy = 1; //hey, without this, the message will keep repeating! :O
                    }
                    Waitframe();
                }
                if(!Link->InputA)
                {
                    nobuy = 0;
                }
                
                Waitframe();
            }
            Waitframe();
        }
    }
}


CODE
// Locked Dungeon- Just what it says, a Locked Dungeon. Basically, a Lock Block that you can only unlock if you have a certain item...
// Variables:
// dgnlock- Combo ID for the Lock Block that opens the Dungeon. Set the Combo Type to Lock Block!
// key- Item ID for the Key you need to open the dungeon.
// msg- Message to display if you don't have the required Key when you push against the lock.

import "std.zh"

ffc script lockeddungeon
{
    void run(int dgnlock, int key, int msg)
    {
        while(true)
        {
            int lock = Link->Y - 8;
            int loc = ComboAt(Link->X, lock);
            if(Screen->ComboD[loc] == dgnlock)
            {
                if(Link->Dir == 0 && Link->InputUp)
                {
                    if(Link->Item[key] && Game->Counter[5] == 0)
                    {
                        Game->Counter[5] = 1;
                    }
                    else if(!Link->Item[key])
                    {
                        Screen->Message(msg);
                    }
                }
            }
            if(Game->Counter[5] > 0 && Screen->ComboD[loc] != dgnlock)
            {
                Game->Counter[5] = 0;
            }
            Waitframe();
        }
    }
}


There. Now be happy!

#2 Bayta

Bayta

    Follower of Destiny

  • Members
  • Real Name:Robin Evans
  • Location:Suffolk County, NY

Posted 26 November 2007 - 08:22 PM

One question... What is the first one supposed to be used for? It looks like an item script that plays a message. What's the deal with that?

Edit: Wait... Is it supposed to play a message when you hold up the item?

Edited by Beta Link, 26 November 2007 - 08:25 PM.


#3 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

  • Members
  • Real Name:Matthew
  • Location:Static Void Kingdom

Posted 27 November 2007 - 04:04 PM

QUOTE(Beta Link @ Nov 26 2007, 08:22 PM) View Post

One question... What is the first one supposed to be used for? It looks like an item script that plays a message. What's the deal with that?

Edit: Wait... Is it supposed to play a message when you hold up the item?

No duh. icon_razz.gif Yes, it does. I had little room, so I couldn't explain the scripts in details. Please, accept my apologies for that...

First script displays a Message upon picking up an item.
Second script is an update for Deep Water 1. For some odd reason, if you have some Magic, and touch the damage combo, you lose 1/2 heart and some Magic. O_o After that, you lose decreasing amounts, and no Magic. O_o So, it simply moves you back and takes away some hearts...
Third script is an update for Shop Script. See if it works better than before...
Fourth is my Locked Dungeon script. Pretty obvious usage. But it could also be used for other purposes....

#4 Zelda Rocks

Zelda Rocks

    Recipient of Ways

  • Members

Posted 27 November 2007 - 04:36 PM

Ok, I thought that that's what it was, but I wasn't completely sure. All I could tell was that it played a message.

Also, isn't it possible to edit that script so it shows whatever message you want, without, like, 10 billion slightly different versions taking up all of your Script slots?

CODE
import "std.zh"

//this script plays a message string upon
//obtaining the item. Once you attatch
//this script to an item, just place the
//string # into the D0 box in Arguments.

item script itemmessage
{
    void run(int msg#)
    {
        Screen->Message(msg#);
    }
}


I'm still new at ZScript, so if I'm wrong, then, well, I tried. icon_razz.gif

Edit: Arrgh, now I'm getting pissed off. My brother needs to learn to log off when he's done! This is Beta Link, not Zelda Rocks.

Edited by Zelda Rocks, 27 November 2007 - 04:38 PM.


#5 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

  • Members
  • Real Name:Matthew
  • Location:Static Void Kingdom

Posted 27 November 2007 - 06:36 PM

QUOTE(Zelda Rocks @ Nov 27 2007, 04:36 PM) View Post

Ok, I thought that that's what it was, but I wasn't completely sure. All I could tell was that it played a message.

Also, isn't it possible to edit that script so it shows whatever message you want, without, like, 10 billion slightly different versions taking up all of your Script slots?

CODE
import "std.zh"

//this script plays a message string upon
//obtaining the item. Once you attatch
//this script to an item, just place the
//string # into the D0 box in Arguments.

item script itemmessage
{
    void run(int msg#)
    {
        Screen->Message(msg#);
    }
}


I'm still new at ZScript, so if I'm wrong, then, well, I tried. icon_razz.gif

Edit: Arrgh, now I'm getting pissed off. My brother needs to learn to log off when he's done! This is Beta Link, not Zelda Rocks.

Ahahahahaha. Why do you people think I made this for when Item D Variables were made? These scripts were made with 357 in mind, okay? That's ALL I'm gonna use until a full 2.5 comes out. >_> And no, there's not. The Shop script won't let you hold up the item, for some reason, so the background never shows....in 357.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users