Increasing damage taken?

Discussion in 'Plugin Development' started by Eos, Jul 24, 2015.

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

    Eos

    How would I increase the damage taken on the EntityDamageEvent hook.
    I tried the following but it looks like it doesn't work.
    Code:
    player.setLastDamage( player.getLastDamage() * 3 );
     
  2. Offline

    Dllmnd12

    Wouldn't that depend on the weapon?
     
  3. Offline

    Nic2555

    I don't quite understand your problem, why would you set the last damage, i would use
    Code:
    player.setDamage(player.getLastDamage() * 3);
    instead, so it will change the damage given by the player or the entity to the new value, which is the last damage taken times 3.
    Hope it work.

    -Nic
     
  4. Offline

    Eos

    EntityDamageEvent
    doesn't have .setDamage()
     
  5. Offline

    Nic2555

    well in this case you have to cast the entity into a player or a livingEntity, then use setDamage() or setHealt()
     
  6. Offline

    DoggyCode™

    @Eos It does:
    Code:
    @EventHandler
            public void onDamage(EntityDamageEvent event) {
                if(event.getEntity() instanceof Player) {
                    Player p = (Player)event.getEntity();
                    event.setDamage(p.getLastDamage() * 3);
                    return;
                }
            }
    [​IMG]
     
  7. Offline

    Eos

    My code was being weird as shit for some odd reason but thanks.
     
  8. Offline

    DoggyCode™

    @Eos Ok, lol. Np :)
     
Thread Status:
Not open for further replies.

Share This Page