Jump to content

Photo

Item-3: Desctruction Machine


  • Please log in to reply
20 replies to this topic

#16 Kite

Kite

  • Members

Posted 15 February 2007 - 12:17 PM

Oh! You edited the script when I wasn't looking. I didn't see the magic additions. icon_redface.gif

I might fix my version later today to add that. I know it's seeming rather frustrating that I keep thrusting code at you (your code works, after all. All I'm doing is changing the processes a bit. I'm not trying to show you up or anything, as it's still your script), but I like doing stuff like this and there are not that many opportunities to do so here.

If you get too annoyed with me, just tell me to shut up and leave it alone.

#17 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

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

Posted 15 February 2007 - 12:25 PM

QUOTE(Nick @ Feb 15 2007, 12:17 PM) View Post

Oh! You edited the script when I wasn't looking. I didn't see the magic additions. icon_redface.gif

I might fix my version later today to add that. I know it's seeming rather frustrating that I keep thrusting code at you (your code works, after all. All I'm doing is changing the processes a bit. I'm not trying to show you up or anything, as it's still your script), but I like doing stuff like this and there are not that many opportunities to do so here.

If you get too annoyed with me, just tell me to shut up and leave it alone.

Yeah. I told you I figured out my problem. icon_razz.gif All those "Quit()"s for each if/else statement didn't help. XD

No, it's okay! Shorter code is fine as long as it has the same end result as my code. icon_wink.gif But seriously, I don't get how a ZScript could (or should) make a quest's file size larger. ....You know, I think an external file for storing compiled ZScripts would make a quest's filesize smaller, BUT.... Would anyone REALLY want to send those files with their quests? icon_razz.gif

#18 SpikeReynolds

SpikeReynolds

    Ironically bald furry

  • Members
  • Real Name:Spens
  • Location:Grand Rapids, Michigan

Posted 15 February 2007 - 03:42 PM

THANK YOU!!!
If you can make guys in the editor. Holy Finger, you gave me an idea.

#19 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

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

Posted 15 February 2007 - 03:43 PM

QUOTE(Daiv @ Feb 15 2007, 03:42 PM) View Post

THANK YOU!!!
If you can make guys in the editor. Holy Finger, you gave me an idea.

What is it?

#20 Snarwin

Snarwin

    Still Lazy After All These Years

  • Members
  • Real Name:Paul
  • Location:New York

Posted 15 February 2007 - 07:22 PM

I'm pretty sure you don't need all of those if statements.

CODE
// Destruction Machine- This item randomly kills one enemy in the current room.

item script Killer
{
    int RandNum = 0;
    int RandNPC = 0;
    int Magic = 192;

void run()
{
    if (Link->MP >= Magic)
    {
        int ScrnNPC = Screen->NumNPCs();

        if (ScrnNPC == 0)
        {
            Quit();
        }
        else if (ScrnNPC >= 1 && ScrnNPC <= 10)
        {
            RandNum =  1+ Rand(ScrnNPC);
            npc RandNPC = Screen->LoadNPC (RandNum);
            RandNPC->HP = 0;
        }
    Link->MP = Link->MP - Magic;
    }
}
}

Also, I changed if(Link->MP == Magic) to if(Link->MP >= Magic), which makes more sense.

And no, I am not going to test this for you.

#21 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

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

Posted 15 February 2007 - 07:31 PM

QUOTE(Snarwin @ Feb 15 2007, 07:22 PM) View Post

I'm pretty sure you don't need all of those if statements.

CODE
// Destruction Machine- This item randomly kills one enemy in the current room.

item script Killer
{
    int RandNum = 0;
    int RandNPC = 0;
    int Magic = 192;

void run()
{
    if (Link->MP >= Magic)
    {
        int ScrnNPC = Screen->NumNPCs();

        if (ScrnNPC == 0)
        {
            Quit();
        }
        else if (ScrnNPC >= 1 && ScrnNPC <= 10)
        {
            RandNum =  1+ Rand(ScrnNPC);
            npc RandNPC = Screen->LoadNPC (RandNum);
            RandNPC->HP = 0;
        }
    Link->MP = Link->MP - Magic;
    }
}
}

Also, I changed if(Link->MP == Magic) to if(Link->MP >= Magic), which makes more sense.

And no, I am not going to test this for you.

Whoops, you're right. XD But, uh.... That looks similar to something I tested a while ago. Wanna know the result? IT DID NOTHING. Oh well. Can't hurt to try this, right? But seriously, all those "if-else" statements ARE needed until a way to make it work in less code is found. icon_razz.gif

Edit: :O It... It didn't work!

Edited by Matthew, 15 February 2007 - 07:33 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users