Random Item giver

Results 1 to 19 of 19
  1. #1
    Apprentice pfftmastah is offline
    MemberRank
    Jul 2008 Join Date
    18Posts

    Random Item giver

    any1 besides me see this?

    var itemc = Math.floor(Math.random()*Item.length);
    Math.random() means random
    *item.length means random multiplied by the length of the variable "length"
    Math.floor opens for math equations I believe, im not that familiar with that one but it opens the room for math equations as I've seen
    i dont like itemc and i dont even no if that works so i use

    Code:
    var rand = Math.floor(Math.random() *  itemset.length);


    To all people who think i leeched this... i did NOT leech this. The only thing that was from any other part of code was the


    Code:
    var rand = Math.floor(Math.random() * itemSet.length);
    and that was from... ugh i forgot his name... i think its kippieeej. He PMd me and example of array and random item. So i DIDNT leech this. And kippieej (or w/e his name is) didnt give me this exact code. he just taught me array and random!

    btw see where it says
    Code:
    var itemSet = new Array(itemcode,itemcode,itemcode);
    go ahead and change those codes to watever you want. I placed this in map 0 as a second option to sera. instead of job choice items they get more NX more mesos and 1 of any kind of board except super board. but you can change it around if you want. this should work fine but if it does not post here and ill quickly fix it for you!




    Code:
    // [Coder]Luke of CLMaplestory Coded this!
    
    var itemSet = new Array(1442012,1442013,1442014,1442015,1442016,1442017,1442026,1442027,1442028,1442029,1442030);
    var rand = Math.floor(Math.random() * itemSet.length);
    
    function start() {
        cm.sendYesNo("Hello! I'ill give you a free item at random! Maybe its some kind of board...Well anyway I will warp you to the next map after your selection, and you cant talk to sera either. I will max your skills and reset your stats too though! So choose wisely!")
    }
    function action(mode, type, selection) {
        if (mode > 0){
    	cm.warp(1,0);
    	cm.getChar().maxAllSkills();
    	cm.resetStats();
    	cm.gainNX(250000);
    	cm.gainMeso(100000000);
    	cm.gainItem(itemSet[rand],1);
    	cm.sendOk("Have fun with your board and enjoy!");
        }
        cm.dispose();
    }


  2. #2
    Account Upgraded | Title Enabled! Signalize is offline
    MemberRank
    Nov 2008 Join Date
    USALocation
    363Posts

    Re: Random Item giver


  3. #3
    Infraction Banned Maple1134 is offline
    MemberRank
    Jun 2008 Join Date
    564Posts

    Re: Random Item giver

    I knew a noob would leech it from the help section. Rofl

  4. #4
    Account Upgraded | Title Enabled! aawaiaa is offline
    MemberRank
    Apr 2008 Join Date
    behind your cloLocation
    351Posts

    Re: Random Item giver

    Lol .... just copied the math statment

  5. #5
    Account Upgraded | Title Enabled! shajal is offline
    MemberRank
    Jul 2008 Join Date
    under your bedLocation
    331Posts

    Re: Random Item giver

    even if u did, should have given credits to moogra

  6. #6
    Apprentice pfftmastah is offline
    MemberRank
    Jul 2008 Join Date
    18Posts

    Re: Random Item giver

    First of all i didnt leech this. Second of all why should i give creds to him when i didnt take his o.O. my friend asked me to code it for his server wich i did. LCMS. well we share the server. Btw i made this for charity box in map 0 as a second option to our sera.

  7. #7
    Infraction Banned Maple1134 is offline
    MemberRank
    Jun 2008 Join Date
    564Posts

    Re: Random Item giver

    Quote Originally Posted by pfftmastah View Post
    First of all i didnt leech this. Second of all why should i give creds to him when i didnt take his o.O. my friend asked me to code it for his server wich i did. LCMS. well we share the server. Btw i made this for charity box in map 0 as a second option to our sera.
    Then how come the codes look the exact same.
    Btw, your NPC won't even work on v62 servers.

  8. #8
    Apprentice pfftmastah is offline
    MemberRank
    Jul 2008 Join Date
    18Posts

    Re: Random Item giver

    he taught me the array and random item thing... and it does too work on v62 servers o.O. it works fine for mine. i set it as charity box ID is 9110100. and if you want i can change it around a lil. cuz all you people who think i leeched this!

  9. #9
    Apprentice Verac35 is offline
    MemberRank
    Jun 2008 Join Date
    20Posts

    Re: Random Item giver

    its true, i know pfftmastah, he did NOT leech from that thread, the coder of chickenMS taught it to him, pfftmastah is an excellent coder, he doesnt NEED to leech.

  10. #10
    Infraction Banned XxOsirisxX is offline
    MemberRank
    Jul 2008 Join Date
    2,456Posts

    Re: Random Item giver

    var itemc = Math.floor(Math.random()*Item.length);
    Math.random() means random
    *item.length means random multiplied by the length of the variable "length"
    Math.floor opens for math equations I believe, im not that familiar with that one but it opens the room for math equations as I've seen
    The variable name is item not length.



    You actually copied (not leeched, leech is wrong used) this INDIRECTLY from the help thread.

    It's the same code structure even that it's small piece of code.
    Not really a big deal since this is pretty easy to do..

  11. #11
    Apprentice pfftmastah is offline
    MemberRank
    Jul 2008 Join Date
    18Posts

    Re: Random Item giver

    THANK YOU! I wrote this myself and yeah its a small and easy structure! THANK YOU!!! second person to agree with me! rofl

  12. #12
    Account Upgraded | Title Enabled! Signalize is offline
    MemberRank
    Nov 2008 Join Date
    USALocation
    363Posts

    Re: Random Item giver

    Math.floor opens for math equations I believe, im not that familiar with that one but it opens the room for math equations as I've seen
    Math.floor
    Wow what kind of math are you in? 5th grade? It's a floor function. It doesn't open the room for math equations.

  13. #13
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: Random Item giver

    I'm the only person on this forum that I have ever seen use if mode>0. Everyone else uses mode==1. Bassoe doesn't use if (mode>0) either. Everyone else uses the status++ stuff. Everyone uses the action(1,0,0).
    I can tell this is leeched. Even if it's not, it's not much a release.

    var itemc = Math.floor(Math.random()*Item.length);
    Math.random() means random
    *item.length means random multiplied by the length of the variable "length"
    Math.floor opens for math equations I believe, im not that familiar with that one but it opens the room for math equations as I've seen
    This is funny.

    Also kippieeej doesn't really help you people. If he did, you'd have full MTS and all the other good stuff. I doubt he gave you codes, but it's possible he did. I don't see why he'd waste time teaching people how to code. He obviously didn't get very far.

  14. #14
    Member Thehelper is offline
    MemberRank
    Jan 2009 Join Date
    host-engine.comLocation
    69Posts

    Re: Random Item giver

    nice release

  15. #15
    The almighty chicken kippieeej is offline
    MemberRank
    Apr 2008 Join Date
    1,038Posts

    Re: Random Item giver

    Actually moogra, he kindly PM'ed me and told me that he wanted explanation about arrays
    i just gave him information on arrays and randoms.

    So even though the script is totally him, he did master on how to use randoms and arrays
    I'm proud of you ThreadStarter.

  16. #16
    Infraction Banned MrMysterious is offline
    MemberRank
    Dec 2008 Join Date
    In a treeLocation
    752Posts

    Re: Random Item giver

    var itemc = Math.floor(Math.random()*Item.length);
    Math.random() means random
    *item.length means random multiplied by the length of the variable "length"
    Math.floor opens for math equations I believe, im not that familiar with that one but it opens the room for math equations as I've seen
    Math.random() returns a ranndom value from 0 to 0.99
    item.length is the size of the array. Math.random() * item.length gets you a double value ranged from 0 - (array size - 1)
    Math.floor() returns a value that can never be bigger than the argument. The integer gets rounded down

  17. #17
    Mother effin' clouds SaintsIan is offline
    MemberRank
    Apr 2008 Join Date
    fyrechat.netLocation
    2,809Posts

    Re: Random Item giver

    lol its just a minor tweak T_T stop over reacting.

  18. #18
    Valued Member dragnstar95 is offline
    MemberRank
    Apr 2008 Join Date
    126Posts

    Re: Random Item giver

    What if you want 2 different item sets?

  19. #19
    Xephizion Development Ehab is offline
    MemberRank
    Apr 2008 Join Date
    Somewhere I BelLocation
    1,935Posts

    Re: Random Item giver

    change 1 to 2 i believe



Advertisement