1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Hcf DTR

Discussion in 'Development' started by xjohannaxx, Oct 24, 2018.

  1. xjohannaxx

    xjohannaxx Silverfish

    Messages:
    16
    Can you help me
    How could i do this, I'm new to pocketmine.

    Here's how it would work. You would calculate how much DTR a faction gets by dividing its players by 2, for example, a 15 man faction would get a maximum of 7.5 DTR. That means when 8 people die, the faction goes raidable.

    When a faction is raidable, enemy factions can edit terrain, open chests, kill mobs, etc on there claimed land.

    DTR regenerates slowly, so if a faction got to 1 DTR, they could safely wait it out and they would get back up to their max DTR. A faction that goes raidable could do this too, but when they go raidable, there is a "DTR Freeze" where they stop regenerating, this should last about 2.5 hours.
     
    Last edited: Oct 24, 2018
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    so you just explained what you wanted:
    when player dies, subtract 1 from their DTR, if it's < 0 disable anti raid
    every so often, you will have a task to add 1 to their DTR, and stop if DTR is > fac's member / 2 OR if they are under a dtr freeze which can be compared using time() > frozenfor
    when a faction goes < 0 dtr, set it on dtr freeze with time() + 2.5hr

    which part of it you dont understand? and need me to help with you on?
     
  3. xjohannaxx

    xjohannaxx Silverfish

    Messages:
    16
    I don't know how to do it... I need a code or something pls
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    for which part of it?
    part 1 there's a player death event i am pretty sure
    part 2 use task for these
    part 3 that can be added onto player death event where you subtracted the DTR
     
    corytortoise likes this.
  5. xjohannaxx

    xjohannaxx Silverfish

    Messages:
    16
    How would i make it add dtr and subtract?
    and how would i make it regen
     
  6. Angel

    Angel Spider Jockey

    Messages:
    44
    GitHub:
    aimjel
    By learning basic math using PHP.
     
  7. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I'd suggest begin by assembling the "parts" you'll need for your "machine". I'd start with the easy stuff, like a DTR system. Begin by planning how that needs to be stored. YAML, JSON, SQLite? You decide. Create the functions to initialize and save DTR values, then the functions to add, subtract, etc. Then later on, you can just use those functions easily. Other parts include a method of checking whether an area is owned by a faction, and then whether that faction has enough DTR to be raided, etc. Just run that when you handle events for players breaking blocks, opening chests, etc. to determine whether to let the event run or to cancel it.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.