User Tag List

Results 1 to 10 of 10

Thread: Need "Item Checking" Script ASAP

  1. #1
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    94.07%

    Exclamation Need "Item Checking" Script ASAP

    Yea, Like the Room Type "Level 9 Entrance" except that this the script makes the room "Check for X Sword" where "X" is:

    The White sword
    The Magic Sword
    The Master Sword

    3 seperate scripts, 1 for each sword, and should work like this:

    You enter the first room of a dungeon and a guy with a string says "You can only advance if you have the proper weapon. Do you hav it?" the script tells the guy to check for the white sword (or one of the other 2) and if you have it, he says "Very well, you are prepared for the challenge ahead, you may pass" and he disappears.

    Or something like that, the basic concept is "Check for X sword:
    -> sword is present ->go to string X -> allow passage
    ->sword not present->go to string Y ->deny passage"

    Or however that translates into scripting lingo, just trying to sound techno-logically advanced.


    Thanks in advance.

  2. #2
    Wizrobe The_Amaster's Avatar
    Join Date
    Dec 2005
    Location
    St. Mystere
    Age
    32
    Posts
    3,803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,811
    Level
    28
    vBActivity - Bars
    Lv. Percent
    26.14%

    Re: Need "Item Checking" Script ASAP

    This would be great for any item. If someone decides to do this, any way the script could have a section where it specifies item class and number. Only I need the same thing, only it checks for Slash and Spin attack. (And yes, I'm making an item that you get when you get slash to act as a marker)

  3. #3
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.97%

    Re: Need "Item Checking" Script ASAP

    Here.

    Code:
    // =====================
    // check_item - This script will
    // execute only if Link has an item
    // specified by the D0 variable of 
    // this FFC.  Refer to std.zh for the
    // list of item numbers.
    // =====================
    ffc script check_item{
       void run( int item ){
            if ( Link->Item[item]){
         
                  // --- insert what you want to happen here ---
    
            } // end of if
       } end of void run
    } end of ffc script

  4. #4
    Wizrobe The_Amaster's Avatar
    Join Date
    Dec 2005
    Location
    St. Mystere
    Age
    32
    Posts
    3,803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,811
    Level
    28
    vBActivity - Bars
    Lv. Percent
    26.14%

    Re: Need "Item Checking" Script ASAP

    Soo..what do we enter in the brackets. Item name, or class and level, or what? And what code would we use to make it a pass or impass thing? I know once L implements the callString(or whatever), we could display messages too.

  5. #5
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    94.07%

    Re: Need "Item Checking" Script ASAP

    Cool, thanks C-Dawg. I will try it out

    EDIT: cant get it to work (I know absolutely NOTHING of scripting)
    this is what it looks like when i go to Tools ->compile Z-script->import->compile!




    // =====================
    // check_item - This script will
    // execute only if Link has an item
    // specified by the D0 variable of
    // this FFC. Refer to std.zh for the
    // list of item numbers.
    // =====================
    ffc script check_item{
    void run( int item ){
    if ( Link->Item[6]){

    // --- NPC 2 Disappears---

    } // end of if
    } end of void run

  6. #6
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.97%

    Re: Need "Item Checking" Script ASAP

    Heh. Let me guess, it compiles but does nothing?

    The line I typed stating: "// --- insert what you want to happen here --" is a filler and a comment. The compiler will ignore anything on a line after "//". You can't actually type in what you want to happen in english. You have to replace the entire line with the code accomplishing what you want.

    I'm not sure what you want to accomplish by the NPC moving away. There isn't a "destroy NPC" command that I'm aware of. So you can either set its hit points to zero, or move it off the screen. This code will do both.

    Code:
    // =====================
    // check_item - This script will
    // execute only if Link has an item
    // specified by the D0 variable of 
    // this FFC.  Refer to std.zh for the
    // list of item numbers.
    // =====================
    ffc script check_item{
       void run( int item ){
            if ( Link->Item[item]){
         
                  npc NPC_to_disappear = Screen->LoadNPC(2); // this will load up 
                                                                                 // npc 2 into a variable
                                                                                 // "NPC_to_dissapear."
                  NPC_to_dissapear->X = 300;                        // moves NPC off of the screen
                  NPC_to_dissapear->HP = 0;                         // sets NPC hp to zero.
            } // end of if
       } end of void run
    } end of ffc script

  7. #7
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    94.07%

    Exclamation Re: Need "Item Checking" Script ASAP

    Just for clarification, These are the steps I will do:

    Copy and paste into a .txt(notepad) file
    Change file extension rom .txt to .z
    Go into ZQuest
    Go to the room I need this script for
    Go to Tools?-> Compile ZScript
    Click import
    Find the file that was a .txt but I changed to .z
    click "Edit"
    in the part that reads "if (link-> item[Item]" I will put "if (link->item[6]"

    thats what I will do, can I do that?

  8. #8
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.97%

    Re: Need "Item Checking" Script ASAP

    Well... why not do this.

    (1) Copy and paste the script into a wordpad file.
    (2) Ensure it says "Link->Item[item]". CAPITALIZATION MATTERS.
    (3) Save as a .z instead of .txt, just as you said.
    (4) Open your quest in Zquest. Go to Tools->Compile, import, choose your script.
    (5) Click the compile button. If there are no errors, the code will compile and you will be presented with a screen where you can set your script to a numbered FFC slot. Set it to the first open slot, remember this number.
    (6) Go to the room on which you would like the script to execute. Make an FFC and place it where you want Link to stand. Now, while you're editing that FFC, select the FFC script slot you chose in step (5) in the lower right box. It's labeled "script," I believe. Lastly, click on "Data" and put the item number you want into D0.

    If it compiles correctly, this should work. Code could have typos, though.

  9. #9
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    94.07%

    Re: Need "Item Checking" Script ASAP

    Did all the steps you said but when I hit "Compile!" I get this message

    Code:
     Pass 1: Parsing   
    Line 2: Syntax Error, Unexpexted Item, Expecting Identifier, 
    on Token Item. 
    Fatal Error P00: Can't open or Parse input file!"
    EDIT: Will do those steps again, but double checking each step of the way, I will edit this post after I try again.

    EDIT2: It finally worked! (Compiling at least) All I had to do was get rid of all those "=" and put the code all on one line! Thanks C-Dawg!

  10. #10
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.97%

    Re: Need "Item Checking" Script ASAP

    Well, the error your getting is because you can't use "item" as a variable name. My bad. Try this:

    Code:
    // =====================
    // check_item - This script will
    // execute only if Link has an item
    // specified by the D0 variable of 
    // this FFC.  Refer to std.zh for the
    // list of item numbers.
    // =====================
    ffc script check_item{
       void run( int item_to_check ){
            if ( Link->Item[item_to_check]){
         
                  npc NPC_to_disappear = Screen->LoadNPC(2); // this will load up 
                                                                                 // npc 2 into a variable
                                                                                 // "NPC_to_dissapear."
                  NPC_to_dissapear->X = 300;                        // moves NPC off of the screen
                  NPC_to_dissapear->HP = 0;                         // sets NPC hp to zero.
            } // end of if
       } end of void run
    } end of ffc script
    The issue is, I think, that "item" is a reserved word in ZScript. It's like "int" or "ffc" in that it is an object type. So you can't use it for other names.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social