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

[Trigger] Timers, Unit groups assist system

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
Hey Battlehound again. I am trying to create an assist system for my map. It is a hero AOS (style of Dota, if you know what that is) and I wanted to make a system so that not only the person who lands a killing blow on an enemy hero, but also anyone dealing damage, will get gold from the kill.

So basically what I tried to do is add anyone who deals damage to a hero into a unit group, then, after 30 seconds, they would be removed. Here is the trigger I tried.

  • Assist Group
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource is A Hero) Equal to True
      • (DamageEventTarget is A Hero) Equal to True
      • (DamageEventSource belongs to an enemy of (Owner of DamageEventTarget)) Equal to True
    • Actions
      • Unit Group - Add DamageEventSource to AssistGroup
      • Countdown Timer - Start Assist_Timer[(Player number of (Owner of DamageEventSource))] as a One-shot timer that will expire in 3.00 seconds
This trigger (should) adds any unit attacking a hero to the Assist Group.

  • Assist Group Remove P2
    • Events
      • Time - Assist_Timer[2] expires
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from AssistGroup
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from AssistGroup
      • Game - Display to (All players) the text: (String((Number of units in AssistGroup)))
(There is a trigger like this for each player, each Timer array from 2-8 (player 1is bot))This is supposed to remove any heroes from the assist group.


But it seems that no1 is added or removed from the group. Help appreciated
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
you have to do

JASS:
Custom Script : call DestroyTimer(udg_Assist_Timer[GetPlayerId(GetOwningPlayer(udg_DamageEventSource)) + 1])
Custom Script : set udg_Assist_Timer[GetPlayerId(GetOwningPlayer(udg_DamageEventSource)) + 1] = CreateTimer()

in between your two Actions in the top trigger
 
Level 7
Joined
May 15, 2009
Messages
192
Thank you both, it now works (Did a small trigger which allowed me to see how many units were in the assist group). To be frank, I have no idea what the custom scrips did, but when I set the size of the timer to 8 (This is my maximum number of players))

However, when the timer runs out, it seems that no1 is removed from the group. But atleast the trigger is half way done now. And btw, Damage Source and damage target are unit variables from Bribe's damage engine, and so far I have only tested this system with heroes, so it should work.




thank you guys. +rep
 
Level 7
Joined
May 15, 2009
Messages
192
Alright I fixed it. Turns out the problem was the timer array. For some reason I can't seem to make Timers work in arrays, but anyroad.
I fixed the trigger by replacing the Timer[player number] with an If/Then/Else for every player, and every player had their own timer variable. So If Player is damages a hero Timer2 will start. And they are probaly removed from the group after the set time aswell.

Now all there is to do, is to get somekind of gold reward and Game Text for when you actually benefit from the assist (The hero you damaged is killed) but I believe I can handle it on my own from here.

Thx for all the help and replies +rep
 
Status
Not open for further replies.
Top