When killed by spell lose level

RibljaCorba

TH.net Regular
Reaction score
5
Hello again ,

Ok i want trigger when i kill enemy hero with spell (i will make that spell) he lost level (if he have level 2+) ,if he has killed by another spell he dont lose level ....
 

Komaqtion

You can change this now in User CP.
Reaction score
469
First:
Ok i want trigger

That doesn't sound very nice... You simply just want a trigger to be made for you ?!

So, you only have 1 single spell which does this ? :S
Then, you'd simply use the event "A unit Starts the effect of an ability", and then make a condition checking if "Target unit of ability being cast is a Hero Equal to True" and also, if "Ability being cast Equal to Your_Ability".
Then, Hero - Set level of Target unit of ability being cast to (Hero-level of Target unit of ability being cast + 1) or something ;)
 

reyghost

New Member
Reaction score
14
hi , I dont un think u can check if the reason of an enemy unit dying is this or that spell,but u can try this:
Run a trigger when the ability is casted,condition is that the target of the ability is a hero and that hero's level is higher or equal to 2,then action, store the unit u have targeted in a variable and run an initially off trigger,that check if a unit dies,then condition,dying unit is equal to the one u stored in your variable,and the action just like your other spell,but lowering the level.
If u dont see it i can try make it in editor and ill post it(though not sure this will work)
 

RibljaCorba

TH.net Regular
Reaction score
5
I will make spell wich giving to hero +35 green demage , and if i kill him with that spell or that demage he lost level.......

@reyghost ok u can make that for me?
 

Joccaren

You can change this now in User CP.
Reaction score
54
Try this:

Event:
*Unit begins casting an ability
Conditions:
*Ability being cast equal to your ability
Actions:
*Set TempUnit to target unit of ability being cast
*Wait 1 second
*If then else
If: Temp unit is dead
Then: Set level of Temp Unit to Level of Temp unit - 1
Else:

Hope that helps
BTW, done freehand, don't bag me
 

Joccaren

You can change this now in User CP.
Reaction score
54
tempunit is a unit variable, you have to create it in the variables panel (The yellow X)
 

reyghost

New Member
Reaction score
14
Sorry for slow posting didnt see see your message till this morning.

Here it goes: (i repeat im not sure)

Trigger:
  • Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
      • ((Target unit of ability being cast) is a Heroe) Equal to True
      • (Hero level of (Target unit of ability being cast)) Higher than or equal to 2
    • Actions
      • Set Target_Hero = (Target unit of ability being cast)
      • Trigger - Turn on Ability2 <gen>



Trigger:
  • Ability2
    • Events
      • Unidad - A unit Dies
    • Conditions
      • (Dying unit) Equal to Target_Hero
    • Actions
      • Heroe - Set Target_Hero Hero-level to ((Hero level of Target_Hero) - 1), Hide level-up graphics
      • Trigger - Turn off (This trigger)


As u can see the second trigger is initially off,wich is not necessary but its good so you dont have the game cheking every unit diying, only when you have casted your ability on a valid hero,this is a hero with level 2 or more.
I really think this should work,thoug not 100% sure,try it.And more experienced people give opinion please.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Then you can't check if the unit was killed by the spell though. with my way, you can be pretty sure.
 

reyghost

New Member
Reaction score
14
You are totally true sorry.Only one thing, waiting 1 sec doesnt either ensure the guy was killed by spell could cast spell let him 30 hp and other source kill him and anyway get the -level penalty.
Use Joccaren's trigger though I think you should use a smaller wait,like 0.5 sec or so,and add the other conditions,target unit is a hero and his hero level is bigger than 2.

Also joccaren try not to use begins casting ability event,u can cancell the spell and still get the trigger run,better use starts the effect of an ability :)
 

Joccaren

You can change this now in User CP.
Reaction score
54
For the one second thingy: yeah, but you can be pretty sure thats what killed it. I wanted to give enough time for the missile to reach the unit before checking if it was dead

For the begin effect of ability: True, it doesn't really matter if its instant cast though does it? But still will keep in mind for later
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top