Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] How to haunt and entangle a gold mine?

Discussion in 'World Editor Help Zone' started by stan0033, Jul 6, 2020.

  1. stan0033

    stan0033

    Joined:
    Jun 27, 2010
    Messages:
    1,908
    Resources:
    17
    Models:
    4
    Icons:
    2
    Packs:
    1
    Skins:
    2
    Maps:
    7
    Spells:
    1
    Resources:
    17
    I am making a map where you can choose your race and when you do your units and buildings get created, but i dont know how to haunt instantly a gold mine fast for undead and entangle for night elf.

    Anyone knows?
     
  2. biridius

    biridius

    Joined:
    Apr 3, 2018
    Messages:
    197
    Resources:
    4
    Maps:
    4
    Resources:
    4
    Here's what using the Function list -> Search function of JNGP told me.

    There is a BJ function for blighting/haunting a gold mine

    Code (Text):
    function BlightGoldMineForPlayerBJ takes unit goldMine, player whichPlayer returns unit
        local real    mineX
        local real    mineY
        local integer mineGold
        local unit    newMine

        // Make sure we're replacing a Gold Mine and not some other type of unit.
        if GetUnitTypeId(goldMine) != 'ngol' then
            return null
        endif

        // Save the Gold Mine's properties and remove it.
        set mineX    = GetUnitX(goldMine)
        set mineY    = GetUnitY(goldMine)
        set mineGold = GetResourceAmount(goldMine)
        call RemoveUnit(goldMine)

        // Create a Haunted Gold Mine to replace the Gold Mine.
        set newMine = CreateBlightedGoldmine(whichPlayer, mineX, mineY, bj_UNIT_FACING)
        call SetResourceAmount(newMine, mineGold)
        return newMine
    endfunction
    As for night elves, the "create starting units" code seems to be using this:
    Code (Text):
    call IssueTargetOrder(tree, "entangleinstant", nearestMine)
    Ordering a tree to entangle instantly.
     
  3. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    3,107
    Resources:
    2
    Maps:
    2
    Resources:
    2
    For the haunted goldmine,
    • Neutral Building - Haunt Goldmine 0000 <gen> for Player 1 (Red)
    As for the entangled goldmine,
    • Unit - Replace Goldmine 0001 <gen> with a Entangled Goldmine using The old unit's relative life and mana
     
  4. stan0033

    stan0033

    Joined:
    Jun 27, 2010
    Messages:
    1,908
    Resources:
    17
    Models:
    4
    Icons:
    2
    Packs:
    1
    Skins:
    2
    Maps:
    7
    Spells:
    1
    Resources:
    17
    thansk for the solutions you two. I can replace ofc but it requires more triggering xD