[Solved] Need help with coding...

Level 12
Joined
Mar 30, 2013
Messages
668
Greetings,

I wonder if anyone can help me out with some coding..
1. Make a trigger run at XX seconds.
2. How to make a trigger stop running when a unit is killed.
3. How to make an item to DMG 20% to an enemy hero, and when used it will be removed from the inventory.

Would be cool if you could show me how.
Thanks!
 

Jampion

Code Reviewer
Level 13
Joined
Mar 25, 2016
Messages
1,293
1. After a ceratin time or periodic?
2. You can turn trigger off this prevents them from running because of their events. They can still be running by "run trigger".
3. Item:
actively used=true
number of charges=1
perishable=true
Add a target ability like finger of death. Use a trigger to deal damage.
 
Level 12
Joined
Mar 30, 2013
Messages
668
Thanks for the reply.

1. Elapsed game time is 300 seconds activate the trigger "Run"...
2. ?
3. Ok, i will try create it, i will report back if i managed to do it or not.

I would appreciate if you could create the triggers and post them here, it would make it a lot easlier!
Thanks.
 

Jampion

Code Reviewer
Level 13
Joined
Mar 25, 2016
Messages
1,293
1.
This trigger runs after 300 seconds.
  • RunAtTime
    • Events
      • Time - Elapsed game time is 300.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: this trigger runs a...
2.
StopRunning is the trigger you want to stop running.
If the trigger StopRunning is already running this will not interrupt it.
It only stops future runs of the trigger.

If you want that a specific unit needs to be killed, you can use the specifc unit event.
  • UnitKilled
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Trigger - Turn off StopRunning <gen>
 

Jampion

Code Reviewer
Level 13
Joined
Mar 25, 2016
Messages
1,293
Use this, if you want to run a trigger, as if its event was fired.
  • Trigger - Run Test <gen> (checking conditions)
Use this, if you want to activate a trigger, so it can run from future events.
  • Trigger - Turn on Test <gen>
 

Jampion

Code Reviewer
Level 13
Joined
Mar 25, 2016
Messages
1,293
Here is a map. It's diffcult to explain everything here.

As Chaosy said it is a good idea to use a healing potion as the base item, as it also can only be used once.
Change the ability to a ability like finger of death, that deals 0 damage.
Make a trigger that runs when the item is used (a unit starts the item ability) and deal the damage with a trigger.

A problem on my current map is, that the lightning effect is not displayed due to the fact, that the item gets removed, before the lightning effect starts.
This bug can be fixed of course, but I did not want to make the map unnecessarily complicated.
 

Attachments

  • ItemDamage.w3x
    17 KB · Views: 14
Top