Thread: [718] Temporary Object.

Results 1 to 6 of 6
  1. #1 [718] Temporary Object. 
    Registered Member Sentimental's Avatar
    Join Date
    Apr 2011
    Posts
    308
    Thanks given
    120
    Thanks received
    35
    Rep Power
    3
    Would it be possible to make a TimerTask spawn/delete a temporary object?

    and if so, how would I go about doing this? I've got the timer set up already, but I've ran into the object not spawning and exception errors.

    If you're able to help I'll thank and rep.
    Reply With Quote  
     

  2. #2  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    There is a method specifically for this in World.java. If not, refer to skills i.e. stumps in woodcutting
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Donator

    Sir Lethal's Avatar
    Join Date
    Mar 2008
    Posts
    2,286
    Thanks given
    9
    Thanks received
    74
    Rep Power
    426
    Quote Originally Posted by Zeref View Post
    There is a method specifically for this in World.java. If not, refer to skills i.e. stumps in woodcutting
    Code:
           public static void sendObject() {
                    CoresManager.fastExecutor.schedule(new TimerTask() {
                                    int timer = 300; //5 mins.
                                    @Override
                                    public void run() {
                                    if (timer == 240) {//4 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 180) {//3 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 90) {//2 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 30) {//1 min
                                    World.sendWorldMessage("<col=33CC33></col>", false);
                                    getObject();
                                    World.spawnTemporaryObject(new WorldObject(1, 10, 1, location), 30, false);
                                    } if (timer == 1) {//reset - 0minutes
                        World.sendWorldMessage("<col=FF0000></col>", false);
                                timer = 300;
                                    }
                                    if (timer > 0) {
                                    timer--;
                                    }
                            }
              }, 0L, 1000L);
    }
    Code:
    Exception in thread "Fast Executor" java.lang.NullPointerException
            at com.rs.game.WorldObject.<init>(WorldObject.java:14)
            at com.rs.game.minigames.ObjectFile$1.run(ObjectFile.java:77)
            at java.util.TimerThread.mainLoop(Unknown Source)
            at java.util.TimerThread.run(Unknown Source)
    Reply With Quote  
     

  5. #4  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    Quote Originally Posted by Sir Lethal View Post
    Code:
           public static void sendObject() {
                    CoresManager.fastExecutor.schedule(new TimerTask() {
                                    int timer = 300; //5 mins.
                                    @Override
                                    public void run() {
                                    if (timer == 240) {//4 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 180) {//3 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 90) {//2 mins
                                    World.sendWorldMessage("<col=FFFF00></col>", false);
                                    } if (timer == 30) {//1 min
                                    World.sendWorldMessage("<col=33CC33></col>", false);
                                    getObject();
                                    World.spawnTemporaryObject(new WorldObject(1, 10, 1, location), 30, false);
                                    } if (timer == 1) {//reset - 0minutes
                        World.sendWorldMessage("<col=FF0000></col>", false);
                                timer = 300;
                                    }
                                    if (timer > 0) {
                                    timer--;
                                    }
                            }
              }, 0L, 1000L);
    }
    Code:
    Exception in thread "Fast Executor" java.lang.NullPointerException
            at com.rs.game.WorldObject.<init>(WorldObject.java:14)
            at com.rs.game.minigames.ObjectFile$1.run(ObjectFile.java:77)
            at java.util.TimerThread.mainLoop(Unknown Source)
            at java.util.TimerThread.run(Unknown Source)
    What?
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  6. #5  
    Registered Member Sentimental's Avatar
    Join Date
    Apr 2011
    Posts
    308
    Thanks given
    120
    Thanks received
    35
    Rep Power
    3
    Quote Originally Posted by Zeref View Post
    What?
    It's the error he's getting whenever it's trying to spawn the object, it doesn't spawn it as well.
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Apr 2009
    Posts
    99
    Thanks given
    3
    Thanks received
    3
    Rep Power
    11
    Try increasing the timer from 30 to 3000.. it doesn't go by seconds, goes by milliseconds.. Probably why're you're getting that error, not 100% sure though

    World.spawnTemporaryObject(new WorldObject(1, 10, 1, location), 3000, false);
    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. [Matrix/718] Custom object spawns
    By Linus in forum Configuration
    Replies: 17
    Last Post: 07-20-2017, 05:14 PM
  2. [MATRIX][718] Moving objects to new home
    By netchip in forum Help
    Replies: 10
    Last Post: 03-25-2013, 11:51 PM
  3. 718 Construction Objects
    By CloudIn Real in forum Help
    Replies: 29
    Last Post: 10-30-2012, 03:53 PM
  4. Temporary Object Spawn
    By Owner_Zack in forum Help
    Replies: 0
    Last Post: 08-05-2012, 06:08 AM
  5. [tut]Adding temporary objects[tut]
    By Echo` in forum Tutorials
    Replies: 7
    Last Post: 10-18-2009, 01:33 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
  •