Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1 [718] Shooting Stars Distraction & Diversion (Incomplete) 
    Registered Member Planet112's Avatar
    Join Date
    Feb 2013
    Age
    26
    Posts
    64
    Thanks given
    9
    Thanks received
    14
    Rep Power
    14
    I haven't seen this around, so I decided to give it a try. This is the best I could come up with. If you know any way improve this snippet and wouldn't mind sharing, please do. Any information you can provide will help me improve.



    Here is a list of things that I don't know how to do / what this snippet is lacking:

    Spoiler for Missing Features:

    Not Fixed / Fixed

    Stars are supposed to land in a certain area, at a certain location within that area. I don't know how code something which will first choose a random area, and then proceed to choose a random location within that area. Because of my lack of knowing how to do so, the star just lands at a random location within ANY area.

    Each star size has a set amount of stardust to be mined, before it degrades into a smaller size. For example, star size X contains Y stardust. When Y stardust is mined from the size X star, the star goes from size X to size Z. Instead of this, the star that crashes just stays at its randomly selected size until the star is removed.

    I know how to create dialogue for a telescope - which when used is supposed to give the player an estimate of when the next star will be landing - but I don't exactly know HOW to refer to the timer so that the telescope can actually give an estimate. Also, the estimate is supposed to be more or less accurate depending on the telescope being used - a direct correlation to the player's Construction level. Since I haven't yet heard of or seen a server with the Construction skill developed that extensively, I would base the accuracy of the estimation on the player's Ranged level - for obvious reasons.

    I don't know how to make the star sprite NPC spawn once a size 1 star has been mined away.

    You will need to create dialogue that gives the player a reward from the star sprite, based on how much stardust the player has mined.

    I know how to set a stardust limit/cap (it's supposed to be 200), but I don't know how to have the amount of stardust the player has mined reset daily.

    I don't have the legitimate star landing sites. Most if not all of my locations are custom. If you want the real locations, refer to the link below.

    For more information, head over to this article: [Only registered and activated users can see links. ]


    Here's what I managed to create, before I started getting to aspects that I have no idea how to code. Hope this comes in handy as a basis for somebody out there.


    Spoiler for Save as ShootingStars.java:

    Code:
    package com.rs.game.player.content;
    
    import java.util.concurrent.TimeUnit;
    
    import java.util.TimerTask;
    import java.util.Date;
    import com.rs.cores.CoresManager;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.utils.Utils;
    
    public final class ShootingStars {
    
    public static boolean CRASHEDSTAR = false;
    public static boolean EARLY_BIRD_XP = false;
    
    public WorldTile getWorldTile(int mapX, int mapY) {
    	return new WorldTile(mapX, mapY, 0);
    }
    
    private static final WorldTile[] LOCATION =  { //Credit to Joshreynolds123 of Rune-server for getting these spots.
    	new WorldTile(2941, 3279, 0),//crafting guild mining area
    	new WorldTile(3027, 3350, 0),//behind falador east bank
    	new WorldTile(2974, 3237, 0),//rimmington mining site
    	new WorldTile(2925, 3339, 0),//falador mining site
    	new WorldTile(2736, 3223, 0),//karamja north-western mining site(horseshoe mine)
    	new WorldTile(2742, 3144, 0),//brimhaven mining site
    	new WorldTile(2822, 3239, 0),//south crandor mining site
    	new WorldTile(2846, 3037, 0),//karamja mine central
    	new WorldTile(2825, 2997, 0),//shilo village northwestern mine
    	new WorldTile(2727, 3683, 0),//keldagrim entrance
    	new WorldTile(2393, 3814, 0),//jatizso mine
    	new WorldTile(2138, 3939, 0),//miscellania
    	new WorldTile(2378, 3833, 0),//central fremennik isles mining site (runite mine) //more to do
    	new WorldTile(2705, 3334, 0),//legends guild mining site
    	new WorldTile(2605, 3229, 0),//monastery
    	new WorldTile(2588, 3479, 0),//coal truck coal mines
    	new WorldTile(2605, 3088, 0),//yanille bank
    	new WorldTile(2628, 3134, 0),//fight arena south
    	new WorldTile(3285, 3182, 0),//alkharid warriors palace
    	new WorldTile(3297, 3297, 0),//alkharid scorpion mine
    	new WorldTile(3340, 3268, 0),//duel arena
    	new WorldTile(3457, 3139, 0),//ruins of uzer mining site
    	new WorldTile(3319, 2871, 0),//vultures small mine
    	new WorldTile(3431, 2885, 0),//nardah bank area
    	new WorldTile(3170, 2912, 0),//sandstone and granite quarry
    	new WorldTile(3293, 3353, 0),//south east varrock mining site
    	new WorldTile(3234, 3157, 0),//lumbridge swamp mining site
    	new WorldTile(3170, 3364, 0),//south-west varrock mining site (champions guild)
    	new WorldTile(3258, 3409, 0),//arburys rune-shop/behind varrock small bank
    	new WorldTile(3502, 3218, 0),//burgh de rott
    	new WorldTile(3508, 3486, 0),//canifis bank
    	new WorldTile(3690, 2970, 0),//mos le'harmless bank
    	new WorldTile(2540, 3439, 0),//tree gnome stronghold
    	new WorldTile(2329, 3163, 0),//lleyta
    	new WorldTile(2336, 3634, 0),//piscatoris mining colony
    	new WorldTile(3109, 3566, 0),//low level wilderness mining site
    	new WorldTile(3024, 3599, 0),//medium level wilderness mining site
    	new WorldTile(3190, 3706, 0),//graveyard of shadows - wilderness
    	new WorldTile(3037, 3799, 0),//level 46 south lava maze wilderness
    	new WorldTile(3061, 3888, 0),//lava maze north mining site
    	new WorldTile(3048, 3949, 0),//pirates hideout lvl 61 wilderness
    	new WorldTile(3086, 3964, 0)//magic arena wilderness
    	};
    	
    private static final int[] STAR_SIZE = {
    		38660, 
    		38661, 
    		38662, 
    		38663,
    		38664, 
    		38665, 
    		38666, 
    		38667,
    		38668
    };
    
    private static enum CrashedStar { //The stars wouldn't spawn using the normal method, so I took this concept from the Living Rock Caverns.
    	STAR(new WorldObject(STAR_SIZE[Utils.random(STAR_SIZE.length)], 10, 0, LOCATION[Utils.random(LOCATION.length)]));
    	
    	private CrashedStar(WorldObject star) {
    		this.star = star;
    	}
    	
    	private WorldObject star;
    	
    }
    
    private ShootingStars() {
    	
    }
    
    private static void respawnStar(final CrashedStar star) {
    	World.spawnObject(star.star, false);
    	CoresManager.slowExecutor.schedule(new Runnable() {
    
    		@Override
    		public void run() {
    			removeStar(star);
    		}
    	}, 30, TimeUnit.MINUTES);
    }
    
    private static void removeStar(final CrashedStar star) {
    	World.destroySpawnedObject(star.star, false);
    	CoresManager.slowExecutor.schedule(new Runnable() {
    		@Override
    		public void run() {
    			respawnStar(star);
    		}
    		
    	}, 90, TimeUnit.MINUTES);
    }
    
    public static void init() {
    	for(CrashedStar star : CrashedStar.values())
    		respawnStar(star);
    }
    	
    public static void ShootingStar() {
    	
    				CoresManager.fastExecutor.schedule(new TimerTask() {
    					int timer = 7200;
    				
    				@Override
    				public void run() {
    					if (timer <= 600) {
    					if (Utils.getRandom(200) == 1) {
    					if (CRASHEDSTAR == false) {
    						World.sendWorldMessage("<img=5><col=ff6600>News: A shooting star has crashed!", false);
    						CRASHEDSTAR = true;
    						init();
    							}
    						}
    					}
    					if (timer == 1) {
    					timer = 7200;
    					CRASHEDSTAR = false;
    					EARLY_BIRD_XP = false;
    					}
    					if (timer > 0) {
    						timer--;
    					}
    				}
    			}, 0L, 1000L);
    		}
    	}



    Spoiler for World.java:


    Code:
    import com.rs.game.player.content.ShootingStars;
    Look for:
    Code:
    public static final void init() {
    Put this under it:
    Code:
    ShootingStars.ShootingStar();



    Spoiler for ObjectHandler.java:


    Code:
    import com.rs.game.player.content.ShootingStars;
    Look for:
    Code:
    else if (id == 67970)
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.Red_Sandstone));
    Put this under it:
    Code:
    	else if (id == 38668)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S1_Star));
    				else if (id == 38667)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S2_Star));
    				else if (id == 38666)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S3_Star));
    				else if (id == 38665)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S4_Star));
    				else if (id == 38664)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S5_Star));
    				else if (id == 38663)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S6_Star));
    				else if (id == 38662)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S7_Star));
    				else if (id == 38661)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S8_Star));
    				else if (id == 38660)
    					if (ShootingStars.EARLY_BIRD_XP == false) {
    						player.getSkills().addXp(Skills.MINING, player.getSkills().getLevel(Skills.MINING) * 75);
    						ShootingStars.EARLY_BIRD_XP = true;
    						player.getDialogueManager().startDialogue("CrashedStar");
    						} else
    					player.getActionManager().setAction(new Mining(object, RockDefinitions.S9_Star));



    Spoiler for Mining.java:

    Note: These XP rates aren't the same as RuneScape. Change them at will.

    Code:
    S1_Star(10, 15, 13727, 10, 1, -1, -1, -1), 
    S2_Star(20, 30, 13727, 15, 5, -1, -1, -1),
    S3_Star(30, 50, 13727, 35, 5, -1, -1, -1), 
    S4_Star(40, 75, 13727, 55, 15, -1, -1, -1), 
    S5_Star(50, 105, 13727, 75, 20, -1, -1, -1), 
    S6_Star(60, 135, 13727, 90, 20, -1, -1, -1), 
    S7_Star(70, 175, 13727, 105, 25, -1, -1, -1), 
    S8_Star(80, 220, 13727, 115, 25, -1, -1, -1),
    S9_Star(90, 270, 13727, 125, 30, -1, -1, -1);



    Spoiler for Dialogue:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.player.Skills;
    import com.rs.Settings;
    
    public final class CrashedStar extends Dialogue {
    
    	@Override
    	public void start() {
    		sendDialogue(
    				"Congratulations, you were the first to find this star!",
    				"You receive "+(player.getSkills().getLevel(Skills.MINING) * 75) * Settings.XP_RATE+" Mining XP as a reward."); //Legit RuneScape message
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			end();
    		}
    
    	}
    	
    	@Override
    	public void finish() {
    		// TODO Auto-generated method stub
    
    	}
    
    }
    Code:
    Class<Dialogue> value61 = (Class<Dialogue>) Class //You may have to change the value
    					.forName(CrashedStar.class.getCanonicalName());
    			handledDialogues.put("CrashedStar", value61);
    Reply With Quote  
     


  2. #2  
    Exoria
    Aksel's Avatar
    Join Date
    Jan 2012
    Age
    25
    Posts
    1,449
    Thanks given
    238
    Thanks received
    498
    Rep Power
    56
    looks pretty neat. i bet the r-s community could tweak this to perfection if everyone would stop arguing
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Registered Member Planet112's Avatar
    Join Date
    Feb 2013
    Age
    26
    Posts
    64
    Thanks given
    9
    Thanks received
    14
    Rep Power
    14
    Quote Originally Posted by Aksel View Post
    looks pretty neat. i bet the r-s community could tweak this to perfection if everyone would stop arguing
    Indeed.
    Reply With Quote  
     

  5. #4  
    The Emperor of the Sands

    Azir's Avatar
    Join Date
    Nov 2008
    Posts
    2,468
    Thanks given
    8
    Thanks received
    487
    Rep Power
    117
    Good job on this, ill take it an improve on it


    Reply With Quote  
     

  6. #5  
    Registered Member Taylor Moon's Avatar
    Join Date
    Aug 2012
    Posts
    2,568
    Thanks given
    625
    Thanks received
    1,301
    Rep Power
    66
    Conventions...:L So many conventions lacking

    EDIT: You're also neglecting to include a lot of mandatory features in order to make this content even considered complete.
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Jun 2012
    Posts
    18
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Kμsh View Post
    Conventions...:L So many conventions lacking
    where is yours?
    here is a message to you,
    Quote Originally Posted by Aksel View Post
    looks pretty neat. i bet the r-s community could tweak this to perfection if everyone would stop arguing
    Reply With Quote  
     

  8. #7  
    Registered Member Taylor Moon's Avatar
    Join Date
    Aug 2012
    Posts
    2,568
    Thanks given
    625
    Thanks received
    1,301
    Rep Power
    66
    Quote Originally Posted by jaklarz View Post
    where is yours?
    here is a message to you,
    So....Mind telling me what inhalants you've done lately?
    Reply With Quote  
     

  9. #8  
    Exoria
    Aksel's Avatar
    Join Date
    Jan 2012
    Age
    25
    Posts
    1,449
    Thanks given
    238
    Thanks received
    498
    Rep Power
    56
    Quote Originally Posted by Kμsh View Post
    Conventions...:L So many conventions lacking

    EDIT: You're also neglecting to include a lot of mandatory features in order to make this content even considered complete.
    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)
    Reply With Quote  
     

  10. Thankful users:


  11. #9  
    Registered Member Taylor Moon's Avatar
    Join Date
    Aug 2012
    Posts
    2,568
    Thanks given
    625
    Thanks received
    1,301
    Rep Power
    66
    Quote Originally Posted by Aksel View Post
    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)

    Thread: [718] Shooting Stars Distraction & Diversion (Incomplete)
    My point...Why release incomplete content? Derp.
    Reply With Quote  
     

  12. #10  
    Registered Member Planet112's Avatar
    Join Date
    Feb 2013
    Age
    26
    Posts
    64
    Thanks given
    9
    Thanks received
    14
    Rep Power
    14
    Quote Originally Posted by Kμsh View Post
    My point...Why release incomplete content? Derp.

    From Scu11 in regards to the Snippets subforum guidelines:
    This code does not necessarily have to work, but must bare some resemblance and helpfulness to progression within 503+ Rs2-Servers/Rs2-Clients.

    This is incomplete, but it bears some resemblance and helpfulness towards progression. I've released this seeking assistance to improve the code, because I don't know how myself.
    Reply With Quote  
     

  13. Thankful user:


Page 1 of 4 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. Shooting star's models
    By Azir in forum Models
    Replies: 1
    Last Post: 03-24-2013, 12:03 AM
  2. Shooting Stars
    By Jay Gatsby in forum Help
    Replies: 1
    Last Post: 02-17-2013, 08:23 PM
  3. Shooting Star
    By Jay Gatsby in forum Requests
    Replies: 0
    Last Post: 02-17-2013, 07:49 PM
  4. Replies: 0
    Last Post: 02-10-2013, 01:41 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
  •