Affecting Monster Starting Health

Discussion in 'Plugin Development' started by Taien, Jun 16, 2011.

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

    Taien

    Code:
    public void onCreatureSpawn(CreatureSpawnEvent event)
        {
            if (event.getCreatureType() == CreatureType.SLIME)
            {
                Slime spawnee = (Slime)event.getEntity();
                spawnee.setHealth(spawnee.getHealth() * 2);
            }
        }
    I'm trying to double the initial health of slimes, but the spawning of a slime is not getting caught by my onCreatureSpawn. Could someone suggest me a recourse? I'm thinking I'm not pulling this right...
     
  2. Offline

    jeffadkins51

    .. Is this your whole method ? You need to call this to start it up. Otherwise its just a random method which will do nothing. So on your 'start' method implement this to that. Or add a command to trigger this.
    So
    Code:
    if(command.equalsIgnoreCase("on"){
    public void onCreatureSpawn(CreatureSpawnEvent event)
        {
            if (event.getCreatureType() == CreatureType.SLIME)
            {
                Slime spawnee = (Slime)event.getEntity();
                spawnee.setHealth(spawnee.getHealth() * 2);
            }
        }
     
  3. Offline

    Shamebot

    That's an event. If he registered it the right way he doesn't need to call it himself, in fact that doesn't make sense.
    And what is your code supposed to do? How can you declare a method within an if block?
     
    jeffadkins51 likes this.
  4. Offline

    jeffadkins51

    OH my bad i was completely not paying attention hahaha. Sorry about that. Was just thinking about commands there for awhile. (Running on no sleep an hours of work)
     
Thread Status:
Not open for further replies.

Share This Page