Thread: picking flax

Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1 picking flax 
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    258
    Thanks given
    12
    Thanks received
    13
    Rep Power
    57
    okay so i want to make it a perk where if your a member you can get noted flax

    here is my code

    Code:
    			public void execute(CycleEventContainer container) {
    				if (!SkillHandler.checkObject(id, obX, obY, player.getPosition().getZ())) {
    					player.getActionSender().sendMessage("Too late, the plant is gone.");
    					container.stop();
    					return;
    				}
    				player.getActionSender().sendSound(356, 1, 0);
    				player.getInventory().addItem(item);
    				if (item.getId() != 1779 || Misc.random(3) == 0) {
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    			@Override
    			public void stop() {
    				player.setStopPacket(false);
    			}
    		});
    		CycleEventHandler.getInstance().addEvent(player, player.getSkilling(), 2);
    		return true;
    	}
    
    }
    i got it to work with this but it only gives 1 flax then disappears how do i get it to give random amounts like the one above?

    Code:
    				 if(!player.isDonator()) {
    						player.getInventory().addItem(new Item(1779, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				else if(player.isDonator()) {
    					player.getInventory().addItem(new Item(1780, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    Reply With Quote  
     

  2. #2  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Code:
    if (item.getId() != 1779 || Misc.random(3) == 0) {
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    this bit of code makes the flax disappear randomly

    your second bit of code is gonna delete it after 1 every time
    Reply With Quote  
     

  3. #3  
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    258
    Thanks given
    12
    Thanks received
    13
    Rep Power
    57
    Quote Originally Posted by Women View Post
    Code:
    if (item.getId() != 1779 || Misc.random(3) == 0) {
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    this bit of code makes the flax disappear
    okay so how do i get it to where donators get noted flax instead of unnoted?
    Reply With Quote  
     

  4. #4  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Quote Originally Posted by Bubz View Post
    okay so how do i get it to where donators get noted flax instead of unnoted?
    ik how but what have u tried so far?
    Reply With Quote  
     

  5. #5  
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    258
    Thanks given
    12
    Thanks received
    13
    Rep Power
    57
    Quote Originally Posted by Women View Post
    ik how but what have u tried so far?
    Code:
    				 if(!player.isDonator()) {
    						player.getInventory().addItem(new Item(1779, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				else if(player.isDonator()) {
    					player.getInventory().addItem(new Item(1780, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    is what i changed it to but it only gives 1 at a time. so i figured theres a different way to keep it giving multiple for a short time.
    Reply With Quote  
     

  6. #6  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Code:
    new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    so this essentially is gonna delete the flax object, so you need to figure out to make it randomly delete like what we discussed above.

    if you want it to be noted you have to change the ID of the item ur spawning which will be in your addItem(Item) method
    Reply With Quote  
     

  7. #7  
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    258
    Thanks given
    12
    Thanks received
    13
    Rep Power
    57
    Quote Originally Posted by Women View Post
    Code:
    new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    so this essentially is gonna delete the flax object, so you need to figure out to make it randomly delete like what we discussed above.

    if you want it to be noted you have to change the ID of the item ur spawning which will be in your addItem(Item) method
    its this that makes it random

    || Misc.random(3) == 0)

    but im not sure how to make it work with my code.
    Reply With Quote  
     

  8. #8  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    well i want you to figure it out yourself

    Code:
    			public void execute(CycleEventContainer container) {
    				if (!SkillHandler.checkObject(id, obX, obY, player.getPosition().getZ())) {
    					player.getActionSender().sendMessage("Too late, the plant is gone.");
    					container.stop();
    					return;
    				}
    				player.getActionSender().sendSound(356, 1, 0);
    				player.getInventory().addItem(item);
    				if (item.getId() != 1779 || Misc.random(3) == 0) {
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    			@Override
    			public void stop() {
    				player.setStopPacket(false);
    			}
    		});
    		CycleEventHandler.getInstance().addEvent(player, player.getSkilling(), 2);
    		return true;
    	}
    }
    I've colored the important code in that. You need to incorporate what is red into the code below.

    Code:
    if(!player.isDonator()) {
    						player.getInventory().addItem(new Item(1779, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				else if(player.isDonator()) {
    					player.getInventory().addItem(new Item(1780, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    Code:
    player.getInventory().addItem(new Item(1780, 1));
    this creates 1 unnoted flax(ID: 1780)

    noted flax ID will be somewhere around 1780.

    if you join the discord it will be easier to help u
    Reply With Quote  
     

  9. #9  
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    258
    Thanks given
    12
    Thanks received
    13
    Rep Power
    57
    Quote Originally Posted by Women View Post
    well i want you to figure it out yourself

    Code:
    			public void execute(CycleEventContainer container) {
    				if (!SkillHandler.checkObject(id, obX, obY, player.getPosition().getZ())) {
    					player.getActionSender().sendMessage("Too late, the plant is gone.");
    					container.stop();
    					return;
    				}
    				player.getActionSender().sendSound(356, 1, 0);
    				player.getInventory().addItem(item);
    				if (item.getId() != 1779 || Misc.random(3) == 0) {
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    			@Override
    			public void stop() {
    				player.setStopPacket(false);
    			}
    		});
    		CycleEventHandler.getInstance().addEvent(player, player.getSkilling(), 2);
    		return true;
    	}
    }
    I've colored the important code in that. You need to incorporate what is red into the code below.

    Code:
    if(!player.isDonator()) {
    						player.getInventory().addItem(new Item(1779, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				else if(player.isDonator()) {
    					player.getInventory().addItem(new Item(1780, 1));
    					int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    					new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    				}
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    Code:
    player.getInventory().addItem(new Item(1780, 1));
    this creates 1 unnoted flax(ID: 1780)

    noted flax ID will be somewhere around 1780.

    if you join the discord it will be easier to help u
    okay this is what i put
    Code:
    			public void execute(CycleEventContainer container) {
    				if (!SkillHandler.checkObject(id, obX, obY, player.getPosition().getZ())) {
    					player.getActionSender().sendMessage("Too late, the plant is gone.");
    					container.stop();
    					return;
    				}
    				player.getActionSender().sendSound(356, 1, 0);
    				 if(!player.isDonator()) {
    						(item.getId() != 1779 || Misc.random(3) == 0) {
    							int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    							new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    						}
    				 }
    
    				else if(player.isDonator()) {
    					(item.getId() != 1780 || Misc.random(3) == 0) {
    						int face = SkillHandler.getFace(id, obX, obY, player.getPosition().getZ());
    						new GameObject(Constants.EMPTY_OBJECT, obX, obY, player.getPosition().getZ(), face, 10, id, 20);
    					}
    			 }
    				player.getActionSender().sendMessage("You pick a " + plantName + ".");
    				container.stop();
    			}
    			@Override
    			public void stop() {
    				player.setStopPacket(false);
    			}
    		});
    		CycleEventHandler.getInstance().addEvent(player, player.getSkilling(), 2);
    		return true;
    	}
    
    }
    but i get this error in the 2 spots highlighted red.

    syntax error, insert ";" to complete blockstatements
    Reply With Quote  
     

  10. #10  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    lolol you forgot to put 'if'

    you have

    Code:
    (item.getId() != 1779 || Misc.random(3) == 0) {
    needs to be

    Code:
    if (item.getId() != 1779 || Misc.random(3) == 0) {
    Reply With Quote  
     

  11. Thankful user:


Page 1 of 3 123 LastLast

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. [pi] Flax picking
    By inFamous in forum Help
    Replies: 3
    Last Post: 11-10-2011, 01:55 AM
  2. [pi] flax picking
    By Spooky in forum Snippets
    Replies: 17
    Last Post: 01-16-2011, 05:52 AM
  3. Devo flax picking
    By john4593 in forum Snippets
    Replies: 6
    Last Post: 05-08-2010, 10:51 PM
  4. [Shard]Picking Flax
    By Shemhamforash in forum Snippets
    Replies: 7
    Last Post: 12-24-2009, 07:56 PM
  5. Flax picking and spinning
    By pyrofox69 in forum Help
    Replies: 11
    Last Post: 11-05-2008, 01:06 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
  •