• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Fire Trap!

Status
Not open for further replies.
Level 4
Joined
Jun 2, 2012
Messages
747
Hello fellow hivers. I am needing your help again! I want to create a trap... A fire trap! When the unit steps on a lava tileset. It will deal damage each second until the player gets out of the lava tile. How do I do that?
 
Level 11
Joined
Jun 20, 2009
Messages
880
  • Lava Trap
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at TempLoc) Equal to Dungeon - Lava
            • Then - Actions
              • Unit - Cause Archmage 0000 <gen> to damage (Picked unit), dealing 15.00 damage of attack type Spells and damage type Normal
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLoc)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Another option: Create a unit, add inmolation with really small range, add Locust, change it's model to the Lava thing, and place it whenever you want. No trigger needed; but depends if you want small tiles of lava, or huge lava blocks.
 
Level 16
Joined
May 1, 2008
Messages
1,605
I made something like a survival map and had it too, when a unit enters lava, then damage every second and I used this:

JASS:
globals
    integer LAVA_TYPE = 'Dlav' // id for dungeon - lava
    real    LAVA_DAMAGE = 55.
    
    group LS_GROUP = CreateGroup()
    hashtable LS_HASH = InitHashtable()
endglobals

function remove takes nothing returns nothing
    local timer t = GetExpiredTimer()
    call GroupRemoveUnit(LS_GROUP,LoadUnitHandle(LS_HASH,GetHandleId(t),0))
    call DestroyTimer(t)
    set t = null
endfunction

function damage takes nothing returns boolean
    local unit u = GetFilterUnit()
    local timer t = CreateTimer()
    
    if IsUnitInGroup(u,LS_GROUP) == false and GetWidgetLife(u) > 0.405 and GetTerrainType(GetUnitX(u),GetUnitY(u)) == LAVA_TYPE then
        call GroupAddUnit(LS_GROUP,u)
        call UnitDamageTarget(u,u,LAVA_DAMAGE,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
        call SaveUnitHandle(LS_HASH,GetHandleId(t),0,u)
        call TimerStart(t,1.,false,function remove)
    endif
    set u = null
    set t = null
    return false
endfunction

function init takes nothing returns nothing
    local group g = CreateGroup()
    
    call GroupEnumUnitsInRect(g,GetWorldBounds(),Condition(function damage))
    call DestroyGroup(g)
    set g = null
endfunction

function InitTrig_LavaStep takes nothing returns nothing
    local trigger t = CreateTrigger()
    
    call TriggerRegisterTimerEvent(t,0.1,true)
    call TriggerAddAction(t,function init)
    
    set t = null
endfunction

@ Kala: The big problem with your trigger is, that you run it only every second, which means that units can step on lava very short and leave it again without taking any damage.
 
Last edited:
Level 4
Joined
Jun 2, 2012
Messages
747
  • Lava Trap
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at TempLoc) Equal to Dungeon - Lava
            • Then - Actions
              • Unit - Cause Archmage 0000 <gen> to damage (Picked unit), dealing 15.00 damage of attack type Spells and damage type Normal
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLoc)

This is what Im looking for! Thanks!
 
Status
Not open for further replies.
Top