Thread: [PI] Random

Results 1 to 4 of 4
  1. #1 [PI] Random 
    Registered Member
    Join Date
    Apr 2011
    Posts
    146
    Thanks given
    7
    Thanks received
    1
    Rep Power
    1
    How do I make when you click a object it gives you a random amount of cash between 1 and 5? Will it also woke for tokens when I kill npc?
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    actionHandler,

    Code:
    case OBJID:
    c.getItems().addItem(995, 1+Misc.random(5));
    break;
    I'm not sure what you meant regarding the last question.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2011
    Posts
    146
    Thanks given
    7
    Thanks received
    1
    Rep Power
    1
    Code:
    if (npcs[i].npcType == 1) {
    					c.Points += 100+Misc.random(500);
    				}
    Would that work? And does it mean it's between 100 and 500?
    Reply With Quote  
     

  4. #4  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by runehawk655 View Post
    Code:
    if (npcs[i].npcType == 1) {
    					c.Points += 100+Misc.random(500);
    				}
    Would that work? And does it mean it's between 100 and 500?
    Code:
    if (npcs[i].npcType >= 1) { //Any npc's with an Id greater than or = 1
    					c.Points += 100+Misc.random(500); //You get 100 points plus a possible 500 so you COULD get between 101 - 600;
    				}
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. random
    By Luke in forum Showcase
    Replies: 1
    Last Post: 12-15-2009, 12:03 AM
  2. Random
    By denjer in forum Help
    Replies: 1
    Last Post: 12-12-2009, 10:17 PM
  3. Random
    By ojontrial in forum Showcase
    Replies: 2
    Last Post: 06-15-2009, 02:33 AM
  4. Random
    By Lt Skyliner4 in forum Tutorials
    Replies: 19
    Last Post: 06-02-2008, 02:00 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •