• 🏆 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!

[Spell] need help with a summoning spell

Status
Not open for further replies.
Level 2
Joined
Aug 6, 2012
Messages
27
Hey guys I recently created a skill such that:

- My hero summons a monster
- If each one of two die, the another will die together

( this skill works like the skill of Hero Meepo in DotA )

I've tried to deal with but still unsuccessful

Can anyone help me?
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
Dont forget to add the original unit at start and everytime it revives to meepoGroup.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • Set tempUnit = (Summoned unit)
      • Unit Group - Add tempUnit to meepoGroup
      • Set tempUnit = No unit
  • Untitled Trigger 002
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in meepoGroup and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Unit - Kill tempUnit
      • Set tempUnit = No unit
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
id use a hashtable for that.

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_hash = InitHashtable()
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Bear
    • Actions
      • Set loc = (Position of (Triggering unit))
      • Unit - Create 1 Bear (Level 1) for Player 1 (Red) at loc facing Default building facing degrees
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 1, GetTriggerUnit())
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 2, bj_lastCreatedUnit)
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(bj_lastCreatedUnit), 1, bj_lastCreatedUnit)
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(bj_lastCreatedUnit), 2, bj_lastCreatedUnit)
      • Custom script: call RemoveLocation(udg_loc)
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Bear (Level 1)
          • (Unit-type of (Triggering unit)) Equal to Mountain King
    • Actions
      • Custom script: call KillUnit(LoadUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 1)
      • Custom script: call KillUnit(LoadUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 2)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I improved Chaosy's triggers a bit.
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_hash = InitHashtable()
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Bear
    • Actions
      • Set loc = (Position of (Triggering unit))
      • Unit - Create 1 Bear (Level 1) for Player 1 (Red) at loc facing Default building facing degrees
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 0, bj_lastCreatedUnit)
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(bj_lastCreatedUnit), 0, GetTriggerUnit())
      • Custom script: call RemoveLocation(udg_loc)
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: if HaveSavedHandle(udg_hash, GetHandleId(GetTriggerUnit()), 0) then
      • Custom script: call KillUnit(LoadUnitHandle(udg_hash, GetHandleId(GetTriggerUnit()), 0)
      • Custom script: endif
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I improved Maker's triggers a bit.
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_hash = InitHashtable()
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Bear
    • Actions
      • Set Caster = (Triggering unit)
      • Set loc = (Position of Caster)
      • Unit - Create 1 Bear (Level 1) for (Triggering player) at loc facing Default building facing degrees
      • Set Summon = (Last created unit)
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(udg_Caster), 0, udg_Summon)
      • Custom script: call SaveUnitHandle(udg_hash, GetHandleId(udg_Summon), 0, udg_Caster)
      • Custom script: call RemoveLocation(udg_loc)
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Caster = (Triggering unit)
      • Custom script: if HaveSavedHandle(udg_hash, GetHandleId(udg_Caster), 0) then
      • Custom script: call KillUnit(LoadUnitHandle(udg_hash, GetHandleId(udg_Caster), 0)
      • Custom script: endif
 
Level 2
Joined
Aug 6, 2012
Messages
27
Waiting for someone wanting to improve defskull's trigger a bit ;))

I just try this one and see it is quite easy but still take effect :D

  • sea1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Sea Elemental
    • Actions
      • Set loc_1 = (Position of (Triggering unit))
      • Set waterOwner = (Triggering unit)
      • Unit - Create 1 Summoner for (Triggering player) at loc_1 facing Default building facing degrees
      • Set water = (Last created unit)
      • Unit Group - Add water to Group
      • Unit Group - Add waterOwner to Group
  • sea2
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Group) Equal to True
    • Actions
      • Unit Group - Pick every unit in Group and do (Unit - Explode (Picked unit))
 
Status
Not open for further replies.
Top