User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 31

Thread: I wrote a script!!! but it ain't dun wurk good...

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    I wrote a script!!! but it ain't dun wurk good...

    I'm writing a friggin script!!!! Yep, so anyone wan't to help me?


    Here's what I got:

    Code:
    import "std.zh"
    
    item script Enmity 
    
    {
      void run()
      {              
       if (Link->MaxHP <= 16);
        {
         Quit();
        }
             else if (Link->HP += 360);   
             PlaySound(25); 
             Link->HP -= 16;
             Link->MaxHP -= 16;
        }
    }

    So what i'm trying to do is make a VERY simple item script that:

    1) plays sfx
    2) Refills your life
    3) Removes a heart container

    *Note that I am trying to put the sacrifice heart container last to get rid of those damned else if's*;)

    ---------Got this one---------------------------

    -Okay round 2: (I think i'm getting better....)- still need help with this though....

    Code:
    item script Wand_of_Wonder
    
    {
    void run()
      {
         if(Game->Counter[CR_RUPEES] == 0   // Link has no rupees?...
           playsound(2);
           playsound(2);
           playsound(2);
           playsound(2);
           playsound(2);
           Game->Counter[CR_RUPEES] = 5;  // give him some!
           waitframes(6);
           CreateNPC(105) * NPC_PATRA3 // and create a Patra 3...  fuck yeah
           {
              else if(Game->Counter[CR_PUPEES] >= 1;  // But don't get greedy or...
              waitframe();
              playsound(15);
              Game->Counter[CR_LIFE] = 0;  // Link dies...oopsie!
           }
       }
    }
    Heh, the second one is just for learning purposes...well they're all for learning purposes, but any feedback of what i'm doing wrong would help out ALOT.

    EDIT: I'm learning
    ----------------Got this one as well. thanks pknklfk....hmm-----------------

    Code:
    item script Rod_of_Ouchy
    
    {
    void run()
      {
        if (int HP <= 16)
        {
        Quit()
        }
        else if (ScrnNPC == 0)
        {
        Quit()
        }
          else if (int HP ->16)
            {
            ScrnNPC == 1 (ScrnNPC HP -= 6)
            }
          Link max HP -= 16
        }
      }
    }
    Keep in mind that these are my first scripts ever.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.54%

    Re: I wrote a script!!! but it ain't dun wurk good...

    Couple questions >_>

    Code:
    item script Rod_of_Ouchy
    
    {
    void run()
      {
        if (int HP <= 16)
        {
        Quit()
        }
        else if (ScrnNPC == 0)
        {
        Quit()
        }
          else if (int HP ->16)
            {
            ScrnNPC == 1 (ScrnNPC HP -= 6)
            }
          Link max HP -= 16
        }
      }
    }
    where is ScrnNPC declared? You seem to play around with it a lot, but it doesn't actually exist anywhere.

    "Link" does, but then the compiler would get confused by "max" and "HP" following it.

    Also, == means "equals", = means "set".

    The arrow operator (->) is used only to dereference pointers, not to fill in for the greater than operator (>)

    Every statement (sentence) needs a semicolon (period) at the end.

    Here is a fixed version:

    Code:
    item script Rod_of_Ouchy
    
    {
    void run()
      {
        if (Link->HP <= 16) { //Link has to have a minimum amount of health
          Quit();
        } else if (Screen-NumNPCs() == 0) { //And, there has to be an enemy
          Quit();
        } else { //by this point, we know that link has more than 16 HP and there are enemies on screen
          npc enemy = Screen->LoadNPC(1); //Find the first enemy
          enemy->HP -= 6; //hurt it (maybe even kill it)
    
          Link->HP -= 16;  //subtract one heart, and...
          Link->MaxHP -= 16;//... one heart container.
        }
      } //the Quit() here is implied by the end of the script
    }
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  3. #3
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    Re: I wrote a script!!! but it ain't dun wurk good...

    where is ScrnNPC declared? You seem to play around with it a lot, but it doesn't actually exist anywhere.
    I don't know :shrugs: You know how long it took me to come up with that? I have basically the std.zh and the documentation thread written by DarkDragon to go by.

    "Link" does, but then the compiler would get confused by "max" and "HP" following it.
    Doh! I knew I fucked that up...

    Also, == means "equals", = means "set".
    You've just saved me hours right there.

    The arrow operator (->) is used only to dereference pointers, not to fill in for the greater than operator (>)
    Again, thank you much!

    Alright, i'm gonna rewrite it myself and not just copy it.

    Code:
    item script Rod_of_Ouchy
    
    {
    void run()
      if(link->HP <=16);    // >= means less than or equal!!! yay!
    }
    Quit();
    }
      else if (ScrnNPC == 0); //this line does work...right?
    {
    Quit()
    }
      else;
    {
      npc enemy = Screen->LoadNPC(1);  //i'm a little confused...
      enemy->HP -= 6; // I didn't think it was that simple
      Link->HP -= 16;  //only hurt...not maim.
    }
    }
    } // Why three }}}?
    Thanks alot. I just learned a bunch of stuff. I think I can give the first one onother go now.

    EDIT: Damnit, what's wrong with this. it looks good enough...it compiled but it didn't do anything...crap.
    Code:
    import "std.zh"
    
    
    item script Enmity 
    
    {
      void run()
      {              
       if (Link->MaxHP <= 16){
         Quit();
        } else if (Link->MaxHP > 16) {
             Link->HP += 360;
             Link->HP -= 16;
             Link->MaxHP -= 16;
             playsound(25)
           }
        }
    }
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

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

    Re: I wrote a script!!! but it ain't dun wurk good...

    In your rewrite, remember that Link must be capitalized. (So "Link->HP", not "link->HP")

    I've commented what your code is doing:

    Code:
    import "std.zh"
    
    
    item script Enmity 
    
    {
      void run()
      {              
       if (Link->MaxHP <= 16){   // Checks whether Link's MAXIMUM, not CURRENT
                                          // Hit Points are equal to or less than 16.
         Quit();                        // So, it will quit if Link doesn't have MORE THAN 16
                                          // heart containers.  Fair enough.
        } else if (Link->MaxHP > 16) {  // You don't need another if statement.
                                                  // if Link does not have 16 or less heart
                                                  // containers, he's must have more than 16
                                                  // right?  Just use "else."
             Link->HP += 360;              // This will add 360 to Link's current health
                                                  // irrespective of Link's total hearts.  You
                                                  // will end up having more health than 
                                                  // heart containers.  Won't display, but it
                                                  // will count against enemy hits.  In other
                                                  // words, maximum HP is not a hard cap
                                                  // unless you specifically code it that way.
             Link->HP -= 16;                // This reduces the 360 you just awarded  
                                                  // by 16.  Link ends up gaining 344 HP.
             Link->MaxHP -= 16;          // Goodbye, one heart.
             playsound(25)                  // You want: "Game->PlaySound(25);"
           }
        }
    }

  5. #5
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    Re: I wrote a script!!! but it ain't dun wurk good...

    Stupid, ...stupid.

    Thanks C- , I knew I was off somewhere in there...


    I feel like I understand a little more of this stuff every day.

    ***2CD REVISION*** Haha!
    import "std.zh"

    Code:
    item script Nemesis
    
    {
      void run()
      {              
       if (Link->MaxHP <= 16){
         Game->PlaySound(19);
         Game->PlaySound(9);
         Quit();
         } else {
             Link->HP = Link->MaxHP;
             Link->HP -= 16;
             Link->MaxHP -= 16;
             Game->PlaySound(15);
             Game->PlaySound(23);
             Game->PlaySound(14);
           }
        }
    }
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  6. #6
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.35%
    Achievements It's over 9000!

    Re: I wrote a script!!! but it ain't dun wurk good...

    Heh, pretty nice. So this script would recharge Link's health to full, then subtract an equal one hearts worth of health and maximum health. How dire. :p

    Why not also put Game->Playsound(xx) right before the "Quit();" where it'd play an error message instead of just quitting? It's good to have some sort of output rather than nothing happening. At least you know the script is working that way.


    And what the hell. When wouldn't we need the line: import "std.zh" ?

  7. #7
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    Re: I wrote a script!!! but it ain't dun wurk good...

    Holy Shit! I Just wrote a MFing Script!!!!!!!!!!!!!!!!!!!!!

    And It works!! It friggin works!!!!!! That's awesome...
    Two day's age I was calling ffc "FCC" and now I finished a script and pigs didn't fly out of my ass. who knew.

    Pshh, it was nothing.


    Heh, pretty nice. So this script would recharge Link's health to full, then subtract an equal one hearts worth of health and maximum health. How dire.

    Why not also put Game->Playsound(xx) right before the "Quit();" where it'd play an error message instead of just quitting? It's good to have some sort of output rather than nothing happening. At least you know the script is working that way.


    And what the hell. When wouldn't we need the line: import "std.zh" ?
    Yeah, thanks That's a good idea. Hopefully these will get easier to make without this much hassle. I must of read "std.zh" like 20 times.

    Hey Petoe, monkeys can make scripts...see.

    Hmm...now I gotta actually name it. That could take another day right there. :googly:

    Thank's everybody!
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  8. #8
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.35%
    Achievements It's over 9000!

    Re: I wrote a script!!! but it ain't dun wurk good...

    Heh. Nice stuff, man! Now, perhaps we could even "fancy it up" a little? For example, we could count out how many Heart Containers Link has, and how many of those are filled. We could take the difference, divide by, say, four, (16 Hits per container, so each quarter is four. Though technically the Gold Ring introduces two-segments at a time. x x. ) and we could play the healing sound for every quarter (Or eighth?) that it heals Link. Could be done with a for loop. Not sure if those are in ZScript though.

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

    Re: I wrote a script!!! but it ain't dun wurk good...

    Anything you want to do, you can do in ZScript.

    Anything.*

    Ponder that for a minute, and realize why it's such a good idea to learn to script.

    * = Anything involving arrays or large switch statements will be a mega pain in the ass to do. But it can be done with nested if/else statements.

  10. #10
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,505
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.22%

    Re: I wrote a script!!! but it ain't dun wurk good...

    Yep you can use for loops in ZScript. For loop, While loop, Do Loop (i think never tried it). It seems you guys are picking up scripting pretty quickly.. (now you probley get why everyone always says its not that hard to understand :p )

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