Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lose damage with a time limit

Comments in 'Plugin Development' started by jigibbs123, Jan 19, 2016.

  1. jigibbs123
    Offline

    jigibbs123 New Member

    Joined:
    Apr 16, 2014
    Posts:
    8
    Minecraft User:
    jigibbs123
    What code is a time limit of losing damage.
  2. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Do you mean something like the poison effect?
  3. jigibbs123
    Offline

    jigibbs123 New Member

    Joined:
    Apr 16, 2014
    Posts:
    8
    Minecraft User:
    jigibbs123
    Yeah the poison effect(sorry for not enough detail)
  4. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    PHP:
    $p->addEffect(Effect::getEffect($poisonID)->setDuration($seconds 20)->setAmplifier($amplifier)->setVisible(false));
    setDuration($seconds * 20), it goes by ticks, and 20 ticks is 1 second. So yeah
    applqpak likes this.
  5. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    PHP:
    // How many minutes the effect will last
    $minutes 1;
    // Amplifier (the higher the amplifier, the higher the damage)
    $damageAmplifier 2;
    // Wether to show or hide particles
    $particles false;
    // Add the effect to a player
    Player::addEffect(Effect::getEffect(Effect::POISON)->setDuration(20 60 $minutes)->setAmplifier($damageAmplifier)->setVisible($particles));
    This will apply the poison effect to a player, poison will slowly damage a player over the duration of the effect. Hopefully this is along the lines of what you're looking for.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    And what is different between the two of your posts? All you two are doing is just to show how we can redundantly store a value into a variable before directly using it, and teaching us that the surprising fact that 60 seconds = 1 minute
  7. jigibbs123
    Offline

    jigibbs123 New Member

    Joined:
    Apr 16, 2014
    Posts:
    8
    Minecraft User:
    jigibbs123
    Ok thanks.

Share This Page

Advertisement