• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Lava less hp

Status
Not open for further replies.

NeJiIjEn

N

NeJiIjEn

Whats trigger for when a hero that is owned by the assaulters or sumtin walks on lava and hp goes down. I got the Unit Enters region and the Terrain type. But i dont know how to do the -100 hp
 

NeJiIjEn

N

NeJiIjEn

im just seriously stupid enough how not to use that thing. not sure why. but ill just do it.
 
Level 13
Joined
Jun 22, 2004
Messages
783
That is not gonna work properly "Maker" you need to make this multi-instanceable to let it work properly, meaning that it should be applyable to more than 1 units, and with that trigger its not gonna work.

I could make something for you, trigger wise, let me know if you want that, cause it will take an hour or so to make this.

You can also do it with an item I guess, that if a unit enters a region you give it an item (item that heals the units, just alter the number to a negative number in the item editor)
And remove that item when the unit leaves the region again.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Alright, I was just trying to give him something to work on. Anyway I made these two triggers that seem to work pretty well.

  • EnterLava
    • Events
      • Unit - A unit enters Burn <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GroupIndex Equal to 20
        • Then - Actions
          • Set GroupIndex = 0
          • Set LavaGroup[GroupIndex] = (Triggering unit)
        • Else - Actions
          • Set LavaGroup[GroupIndex] = (Triggering unit)
          • Set GroupIndex = (GroupIndex + 1)
      • Trigger - Turn on BurnBaby <gen>
What it does is that it adds the unit that enters the lava region to a unit array and then turns on the trigger that causes damage. When more than 20 have triggered this, the unit slots will be overwritten.You can obviously increase/decrese the amount easily.


  • BurnBaby
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to LoopNumber, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LavaGroup[LavaIndex] Equal to No unit
            • Then - Actions
              • Set LavaIndex = (LavaIndex + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Burn <gen> contains LavaGroup[LavaIndex]) Equal to True
                • Then - Actions
                  • Unit - Set life of LavaGroup[LavaIndex] to ((Life of LavaGroup[LavaIndex]) - 16.00)
                  • Set LavaIndex = (LavaIndex + 1)
                • Else - Actions
                  • Set LavaIndex = (LavaIndex + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Burn <gen>)) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set LavaIndex = 0
          • For each (Integer A) from 1 to LoopNumber, do (Actions)
            • Loop - Actions
              • Set LavaGroup[LavaIndex] = No unit
              • Set LavaIndex = (LavaIndex + 1)
        • Else - Actions
          • Do nothing
      • Set LavaIndex = 0
This trigger does the damage. The trigger goes trough the unit array and checks if the units are in the lava area, and if so, damages them. Then it checks if there are no units in the lava area, and if so, clears the unit array and turns this trigger off.

If you have a better trigger, please let us know. This trigger might not be the most resource-friendly, and I'm not sure if it works 100% correctly because I just briefly tested it.

And what the hell are the trigger tags? =)
 
Level 11
Joined
Jul 12, 2005
Messages
764
OR:
Event - Every 1 sec
Actions-
Pick all units in playable map matching (Terrain type at position of Picked unit is equal to Lava) and do Actions
-Damage picked unit

I know, i know it is leaky and may be laggy but not that long... Or i'll write you a leakless JASS trigger if you want.
 
Level 13
Joined
Jun 22, 2004
Messages
783
well running a trigger every second in a game that could last 30 minutes doesn't sound to me like a good plan.
I would go for a healing well, and just put a negative number in there, and make it's range as big as the lava is.
 
Level 2
Joined
Dec 31, 2006
Messages
16
I think that trigger willz work:
Events:
-Every 1 second of game time
Conditions:
-Unit (crazyguy) is in region (fiery stuff)
Actions:
-Set variable: unit in region (fiery stuff) = (crazyguy)
-Set life of (crazyguy) to life of (crazyguy)-1

Im not sure that this will work because in out of inetrnet and im typing this from a cafeteria so i cant check with the worldeditor. Anyway i hope that the trigger is fine enough and will work...
 
why jass?
its easy in GUI too.
lavaux8.jpg


i post screenshots because the trigger tags arent working.

Tested and works fine!

should be leakless
smileg.gif
 
Level 11
Joined
Jul 12, 2005
Messages
764
Paskovich, can you show JASS solution and explain why it do not lag?
I didn't say that the JASS one will not lag (I guess it won't :D). But triggers written in JASS are much more efficient than their pairs in GUI.
I don't know if you knew JASS, but it's because most GUI functions are not native functions... Hmm, I can't reallly explain it, i hope a JASS expert will help me out.

**EDIT**
Here:
Code:
function IsUnitInLava takes nothing returns boolean
    return GetTerrainType(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit())) == 'Dlav'
endfunction

function DamageUnitInLava takes nothing returns nothing
    call SetUnitState(GetEnumUnit(), UNIT_STATE_LIFE, GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE) - 100)
endfunction

function Trig_LavaDamage_Actions takes nothing returns nothing
    local group g = CreateGroup()
    call GroupEnumUnitsInRect(g, GetPlayableMapRect(), Filter(function IsUnitInLava))
    call ForGroup(g, function DamageUnitInLava)
    call DestroyGroup(g)
    set g = null
endfunction

function InitTrig_LavaDamage takes nothing returns nothing
    set gg_trg_LavaDamage = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_LavaDamage, 1, true)
    call TriggerAddAction(gg_trg_LavaDamage, function Trig_LavaDamage_Actions)
endfunction
 
Last edited:
Level 27
Joined
Sep 24, 2006
Messages
4,979
OR:
Event - Every 1 sec
Actions-
Pick all units in playable map matching (Terrain type at position of Picked unit is equal to Lava) and do Actions
-Damage picked unit

I know, i know it is leaky and may be laggy but not that long... Or i'll write you a leakless JASS trigger if you want.

Yup i have done that before you should let the trigger check the ground/terrain type where the unit is on and damage him if its lava,damaging can be done by WEU or just in WE by setting life or something..easy :p
 
Why do u use TempPoint variable? If your picked unit is from a group there should be more than 1 unit sometime...

It sets TempPoint the position of the picked unit then do action and destroys the variable.
Then it runs again for the next unit which is picked and do the same.
Its like 'For each (Integer A) do 1 - 10 actions'
 
Every 0.1 seconds of game-time

Pick every unit in udg_Group and move (picked unit) to point with polar offset (picked unit(127, (Facing of(picked unit)-180))

this meant that each time unit is, for example issued to go somewhere, wc3 puts that location into memory. and it repeats,repeats,repeats... then, why it lags? becouse location is still stored in memory. If you use udg_TempLoc instead of (position of picked unit), and action

call RemoveLocation(udg_TempoLoc)

after every execution of trigger, that wont lag, if that what i said up is cause of lag.
 
Status
Not open for further replies.
Top