• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

how can i prevent the tree of life from uprooting to entangle the gold mine

Status
Not open for further replies.

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
So.. basicaly create custom ability based on single target one (best choice would be channel here) and set "targets allowed" to: building, neutral.

Now, create a trigger that responds on casting event.

  • init
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to CustomEntangle
    • Actions
      • Set p = (Position of (Target unit of ability being cast))
      • Unit - Create 1 dummyUnit for (Triggering player) at p facing Default building facing degrees
      • Unit - Add 0.7 Generic expiration timer to (Last created unit)
      • Unit - Add Entangle Gold Mine to (last created unit)
      • Unit - Order (last created unit) to Night Elf - Tree of Life: Entangle (Target unitb of ability being cast)
      • Custom script: call removeLocation(udg_p)
'p' - location variable;
Order action can be found in 'Unit' actions section at 'Issue Order Targetting An Unit' -> from filter select: Night Elf - Tree of Life: Entangle;
you have to create dummy unit to make it looks properly.
dummy unit is one created for dummy-spell purposes, it owns no abilities apart from Invurneability and Locust; should have no collision, no model; no shadow and it's attacks should be disabled. Additionaly it's vision sight and Score-points amount should be reduced/nulled too.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 018
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (==) (Order(unroot))
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Less than (<) 10.00
        • Then - Actions
          • Unit - Pause (Triggering unit)
          • Unit - Unpause (Triggering unit)
          • Custom script: call SimError(GetTriggerPlayer(), "Not enough mana,")
        • Else - Actions
JASS:
library SimError initializer init
//**************************************************************************************************
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       call SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*    
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************

//==================================================================================================
    globals
        private sound error
    endglobals
    //====================================================================================================

    function SimError takes player ForPlayer, string msg returns nothing
        set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
        if (GetLocalPlayer() == ForPlayer) then
            call ClearTextMessages()
            call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
            call StartSound( error )
        endif
    endfunction

    private function init takes nothing returns nothing
         set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
         //call StartSound( error ) //apparently the bug in which you play a sound for the first time
                                    //and it doesn't work is not there anymore in patch 1.22
    endfunction

endlibrary

You don't necessarily need SimError, but it's cool. It requires JNGP.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
To make it require no JNPG you can use vanilla jass version of SimError to make it GUI friendly:
JASS:
function SimError takes player ForPlayer, string msg returns nothing
    set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
        call StartSound(udg_Error)
    endif
endfunction

function InitTrig_SimError takes nothing returns nothing
    set udg_Error=CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
    //call StartSound(udg_Error)
endfunction
Where 'udg_Error is global sound parameter named: 'Error'. Paste this into Map's header (it's small map icon at the top of trigger editor).
Yeah Maker, SimError is cool :p
 
Status
Not open for further replies.
Top