Assign a specific number to an entity

Discussion in 'Plugin Development' started by jimbo8, Aug 16, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    jimbo8

    Heyho!

    Alright, so, i'm developing a MMO-plugin as i've said a few times already, and i'm currently working on a EXP-system like wynncraft's(note: inspired, not 100% like it). How can i assign, let's say the number 20 to a specific entity, and when i kill it, i can give that number to the player?

    I have never really worked with changing entities behaviour, so i don't know where to start. How does wynncraft do this?

    Thanks, i really appreciate all the help i can get.
     
  2. You could check what kind of entity it is when it gets killed, and have a few if/elseif/else statements to do something with the number you want to be assigned to the entity (if that's what you want, if not, tell me)
     
  3. Offline

    jimbo8

    Datdenkikniet

    The problem is that when you come to a certain area, the levels of the mobs increase. If you are able to kill that mob, you get more EXP.

    Like, in the beginner area there will be zombies in lvl 1. When you kill them, you get little to no EXP. When you get farther, there are zombies in level 20-30, yeah, you get the point.

    I thought about checking for the entitytype, but then it would be no point to have levels on the zombies.
     
  4. Offline

    Marten Mooij

    jimbo8 Just use MetaData?
    Code:
    object.setMetadata("name", new FixedMetadataValue(main, "Name"));
     
  5. jimbo8 in that case, you could create a new class (for instance called EXPEntity), which doesn't extend anything. Just make it have two fields: an UUID, to verify its the correct mob, and an int/double for the amount of EXP. Store all of the created EXPentities in an ArrayList, and when a mob is killed, loop through the arraylist. If there is a mob with the same UUID, do something with its number
     
  6. Offline

    jimbo8

    Marten Mooij

    How would i be able to set spawn points for specific mobs and give them the meta on start without having a big messy code? What i thought of was to save the location of the mobs in a SQL-database, give each one of them a unique name and ID, and spawn them every now and then.

    Also, how can i show the amount of levels above the entity head, like Wynncraft does?

    Thanks :)
     
  7. Offline

    jimbo8

    ...a shameful little bump
     
Thread Status:
Not open for further replies.

Share This Page