• 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.

E.D.T (v1.0)

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Observation

Before unloading this resource, read ALL of the information on the same.
If this resource be used by you (in any way, be as tutorial, map, spell...), be appreciated for the work occurring me credits.


Function of this resource

It is a simple example of detecting trees collected (for workers as: Ghoul,Peasant,Peon and Wisp) through GUI/Triggers. With this example, you can manufacture sorceries, maps and other things that leave his/her imagination.


Example

In the example that I created, it is a simple sorcery that it destroys trees, but, anything he impedes of doing what well to understand with the detected trees. See the complete function of this sorcery and their respective triggers to proceed:

Function of the sorcery

He/she donate with that the area among in combustion and tremor, Caster burns and it explode the selected area punishing their terrestrial opponents in the immune the magic.
Besides, this sorcery destroys trees.

Area of Effect: 300.
Cast range: 500

Caused damage: 130/245/320.

CoolDown: None/null
Manacost: None/null


Triggers

[trigger=Setup]Flame Shock Setup
Events
Map initialization
Conditions
Actions
-------- -------------------------------------------- --------
-------- Ability: --------
Set FS_Ay = Flame Shock
-------- Attack type: --------
Set FS_Type_Attack = Spells
-------- Damage type: --------
Set FS_Type_Damage = Fire
-------- AoE ( Area of Effect): --------
Set FS_AoE[1] = 300.00
Set FS_AoE[2] = 300.00
Set FS_AoE[3] = 300.00
-------- Damage caused by spell (Flame Shock): --------
Set FS_Damage[1] = 130.00
Set FS_Damage[2] = 245.00
Set FS_Damage[3] = 320.00
-------- -------------------------------------------- --------
-------- Position in that Dummy will be created: --------
Set FS_Loc = (Center of (Playable map area))
-------- I can use this point varaivel in this trigger why ANY unit will work this spell in less than 0 seconds. --------
-------- -------------------------------------------- --------
-------- Create responsible Dummy for detecting trees: --------
Unit - Create 1 Dummy for Neutral Passive at FS_Loc facing Default building facing degrees
-------- Add the harvest ability for Dummy: --------
Unit - Add Harvest (Gold and Lumber) to (Last created unit)
-------- -------------------------------------------- --------
-------- Who is Dummy? --------
Set FS_Dummy = (Last created unit)
-------- -------------------------------------------- --------
-------- Remove the location created to avoid mistakes and to improve the acting of this spell: --------
Custom script: call RemoveLocation (udg_FS_Loc)
-------- -------------------------------------------- --------
-------- Reduce the leg provoked by this Trigger with the following action: --------
Custom script: call DestroyTrigger (GetTriggeringTrigger())
-------- -------------------------------------------- --------
[/trigger]

[trigger=Cast]Flame Shock Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to FS_Ay
Actions
-------- This trigger is a simple example of how to detect trees collected for hard-working units (like Ghoul, Peasant, Peon and Wisp). --------
-------- -------------------------------------------- --------
-------- Unit that activated this spell: --------
Set FS_Caster = (Triggering unit)
-------- Level of the ability worked by FS_Caster: --------
Set FS_Level = (Level of FS_Ay for FS_Caster)
-------- Position of the selected land and affected for the sorcery: --------
Set FS_Loc = (Target point of ability being cast)
-------- -------------------------------------------- --------
-------- Special effects begin here --------
Special Effect - Create a special effect at FS_Loc using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at FS_Loc using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
Special Effect - Destroy (Last created special effect)
-------- Special effects finish here --------
-------- -------------------------------------------- --------
-------- Example of how to detect trees: --------
Destructible - Pick every destructible within FS_AoE[FS_Level] of FS_Loc and do (Actions)
Loop - Actions
-------- -------------------------------------------- --------
-------- Order that Dummy (the unit configured in Trigger Flame Shock Setup) to do the harvest in the destructible catch: --------
Unit - Order FS_Dummy to Harvest (Picked destructible)
-------- -------------------------------------------- --------
-------- The destructible is verified that it will be made the harvest is really a tree: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of FS_Dummy) Equal to (Order(harvest))
((Picked destructible) is alive) Equal to True
Then - Actions
-------- If the conditions above are true, it means that the destructible is really a tree why the ability crop works only with destructible trees. --------
-------- Therefore, in this spell (Flame Shock), any tree around of the selected area it is destroyed: --------
Destructible - Kill (Picked destructible)
-------- This spell destroys trees, but, anything stops him/it of doing him/it that well to understand with the trees. --------
Else - Actions
-------- In case the conditions above are false, it indicates that Dummy cannot make the crop in this destructible one why this is not a tree. Finally, nothing is not made in this section. --------
-------- -------------------------------------------- --------
-------- Order that Dummy stops with the action that was him/her ordered (Harvest): --------
Unit - Order FS_Dummy to Stop
-------- -------------------------------------------- --------
-------- -------------------------------------------- --------
Custom script: set bj_wantDestroyGroup = true
-------- I determine the group of units to be diffuse: --------
Set FS_Group = (Units within FS_AoE[FS_Level] of FS_Loc matching (((Matching unit) belongs to an enemy of (Owner of FS_Caster)) Equal to True))
-------- Catch the units of this group: --------
Unit Group - Pick every unit in FS_Group and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is Magic Immune) Equal to False
((Picked unit) is A flying unit) Equal to False
((Picked unit) is alive) Equal to True
Then - Actions
-------- Punishing the terrestrial unit in the affected area for this spell: --------
Unit - Cause FS_Caster to damage (Picked unit), dealing FS_Damage[FS_Level] damage of attack type FS_Type_Attack and damage type FS_Type_Damage
Else - Actions
-------- In case the conditions above are false, in other terms, the unit in this area is immune the magic, it is flying or it is dead, it is not necessary to punish these. --------
-------- -------------------------------------------- --------
-------- Remove the location created to avoid mistakes and to improve the acting of this spell: --------
Custom script: call RemoveLocation (udg_FS_Loc)
-------- -------------------------------------------- --------
[/trigger]


Import

It is not necessary to import this resource, but, it is wanted, it is enough to copy the triggers and all of the custom objects and imported that you/they are in this resource.
It is worth to observe that this resource is a simple example of detecting trees.

Gratitudes

To GOD, God's Holy Spirit an Jesus Cristo (for them, the honor, glory and adoration);
Blizzard (for the Warcraft's resources)
To HiveWorkShop;
And to you! (that participates in my resource)

Contact

Please, don't STOP commenting on, to give reputation, to criticize (constructively) and in general, to participate in my resource (I am open for suggestions, then, don't stop passing these for me). IN CASE of doubts he/she gets in touch with me for HiveWorkShop.
Contents

E.D.T (Map)

Reviews
19:35, 28th Jan 2013 Maker: We already have an approved GUI tree detection system Link

Moderator

M

Moderator

19:35, 28th Jan 2013
Maker: We already have an approved GUI tree detection system
Link
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,994
Don't use this way of destroying a unit group
  • Custom script: set bj_wantDestroyGroup = true
if you have another via variable:
  • Set FS_Group = (Units within FS_AoE[FS_Level] of FS_Loc matching (((Matching unit) belongs to an enemy of (Owner of FS_Caster)) Equal to True))
  • Unit Group - Pick every unit in FS_Group and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is Magic Immune) Equal to False
          • ((Picked unit) is A flying unit) Equal to False
          • ((Picked unit) is alive) Equal to True
        • Then - Actions
          • -------- Punishing the terrestrial unit in the affected area for this spell: --------
          • Unit - Cause FS_Caster to damage (Picked unit), dealing FS_Damage[FS_Level] damage of attack type FS_Type_Attack and damage type FS_Type_Damage
        • Else - Actions
          • -------- In case the conditions above are false, in other terms, the unit in this area is immune the magic, it is flying or it is dead, it is not necessary to punish these. --------
Because you still leak the group in variable, you have 2 ways:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in "units in range matching condition" and do (Actions)
or
  • Set FS_Group = (Units within FS_AoE[FS_Level] of FS_Loc matching (((Matching unit) belongs to an enemy of (Owner of FS_Caster)) Equal to True))
  • Unit Group - Pick every unit in FS_Group and do (Actions)
  • Custom script: call DestroyGroup(udg_FS_Group)
And maybe you could create a variable and store "picked unit", so the trigger won't be full of function calls
 
Level 11
Joined
Mar 27, 2011
Messages
293
Don't use this way of destroying a unit group
  • Custom script: set bj_wantDestroyGroup = true
if you have another via variable:
  • Set FS_Group = (Units within FS_AoE[FS_Level] of FS_Loc matching (((Matching unit) belongs to an enemy of (Owner of FS_Caster)) Equal to True))
  • Unit Group - Pick every unit in FS_Group and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is Magic Immune) Equal to False
          • ((Picked unit) is A flying unit) Equal to False
          • ((Picked unit) is alive) Equal to True
        • Then - Actions
          • -------- Punishing the terrestrial unit in the affected area for this spell: --------
          • Unit - Cause FS_Caster to damage (Picked unit), dealing FS_Damage[FS_Level] damage of attack type FS_Type_Attack and damage type FS_Type_Damage
        • Else - Actions
          • -------- In case the conditions above are false, in other terms, the unit in this area is immune the magic, it is flying or it is dead, it is not necessary to punish these. --------
Because you still leak the group in variable, you have 2 ways:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in "units in range matching condition" and do (Actions)
or
  • Set FS_Group = (Units within FS_AoE[FS_Level] of FS_Loc matching (((Matching unit) belongs to an enemy of (Owner of FS_Caster)) Equal to True))
  • Unit Group - Pick every unit in FS_Group and do (Actions)
  • Custom script: call DestroyGroup(udg_FS_Group)
And maybe you could create a variable and store "picked unit", so the trigger won't be full of function calls

My dear,
Do not get me wrong, but the codes used are correct. Still, thanks for commenting'll check this with a moderator.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
Losam is right you may use it that way.
this is what the group is in jass
JASS:
call ForGroupBJ( udg_group, function Trig_Untitled_Trigger_001_Func001A )

as you see bellow it should work just fine to set it to true
JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
 
Top