Triggered skills kills not giving rewards

Status
Not open for further replies.
Level 3
Joined
May 28, 2015
Messages
41
Hey there again 8)

now that i got to creating skills i stumbled upon a new problem

i made a simple "point system" as i like to call it, which is really just skillpoints of an ivisible hero, that count points for player-owned kills and points for being in a certain area of the arena. Whenever a unit dies i give 1 "unspent skillpoint" to that counting hero owned by the owner of killing unit...but when the enemy player unit dies by the damage done by an ability it does not give a skillpoint to killing player. Why?

the skill that kills a unit is cast via creating a dummy under "owner of attacking unit" controll so it should be considered that this player kills a unit i think...but for some reasons it's not thus giving no reward for a unit also though the player flag is turned on

that's how the ability trigger looks like
  • Events
  • Unit - a unit is attacked
  • Conditions
  • level of skill for attacking unit is more than 0
  • random intenger between 1 and 100 is less than 17
  • mana of attacking unit is more than 15
  • Actions
  • Unit - set mana of attacking unit -15
  • Unit - create a dummy
  • Unit - order that dummy to cast poisoned knife(base of the ability)
  • Unit - remove that dummy
what am i doing wrong?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Because you are removing dummy unit.When target unit dies with skill damage, game is unable to find killer unit, easiest solution is instead of removing dummy unit, you add expiration timer to dummy unit and make it live until the poison effect over.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
You are already creating a new dummy unit for each spell cast, not using an already existing one.
 
Level 3
Joined
May 28, 2015
Messages
41
You are already creating a new dummy unit for each spell cast

right! thanks man 8)

edit:

but what if 2 units trigger the ability creating 2 dummies with a 0.01 delay for example...which dummy would recieve an order to cast a skill? i mean is it possible for them to mess up the casts?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Both dummies will cast the spell.

Lets imagine that both units attack at the same time.
The function in the source code of that first unit is called.
During that function, the game will run the event "A unit is attacked"
And as long as that event is still firing, the game will not continue with the attack function of the unit nor will it start calling that same function for the second one.

So both dummies will be casting that ability.

However, you need a unit indexer to store data like damage or original caster.
But you dont need those as your damage is completely from the object editor.
 
Level 12
Joined
May 22, 2015
Messages
1,051
i made a simple "point system" as i like to call it, which is really just skillpoints of an ivisible hero, that count points for player-owned kills and points for being in a certain area of the arena. Whenever a unit dies i give 1 "unspent skillpoint" to that counting hero owned by the owner of killing unit...but when the enemy player unit dies by the damage done by an ability it does not give a skillpoint to killing player. Why?

Use a global integer variable from the trigger editor to track this.

From a bug I ran into recently, I think WC3 acts strangely when you try to give a hero skill points when they already have enough to learn all of the rest of their abilities. It often just cuts back to the max needed to level all abilities to their top level. If your invisible dummy hero has no hero abilities, it might be capping it at 0. If it does, it might have very strange behaviour.

If the invisible dummy hero unit has no other purpose, I would just remove it and replace it with an integer array global variable where each index is for a specific player.

  • Events
    • Unit - A unit dies
  • Conditions
    • Triggering unit belongs to and enemy of (Owner of KillingUnit())
  • Actions
    • set tempInt = kills[Player number of (Owner of KillingUnit()])
    • set tempInt = tempInt +1
    • set kills[Player number of (Owner of KillingUnit()]) = tempInt
 
Level 3
Joined
May 28, 2015
Messages
41
it might have very strange behaviour.

i noticed that but i dealt with it...strange behaviour occurs when a hero gains a lvl so the game calculates the skillpoins discarding all triggered change (i think) but when you disable exp gain for a hero and change skillpoints via triggers only it works fine though you need at least 1 skill of at least 1 lvl to give that hero smth to spend points on...otherwise it wouldn't have points at all

i'm still new to the triggers so most of the time i'm changing and simplificating my so called "systems" to work properly with more controll over them demanding less changes to take an effect 8)) i guess the mere "desire" to show players points on a dummy hero icon would be changed by a leaderboard in future versions of the map so thx for the global tip 8))
 
Level 3
Joined
May 28, 2015
Messages
41
btw regarding one of the systems...

i have 2 units per race 3 lvl each...and i'm trying to make it possible to detect which lvl of which unit should be added to spawning building at the begining of the round. i'm using intenger array(lets say it is calle plSelect[0..12] to track which player selected which race at the begining so what i need to do is call a value of a certain player selection to put that in formula (plSelect[1]+current lvl of "meleeUpgr"*10) or smth like that which should call a certain unit from a unit array

hope that's comprehendable xD

the problem is when i use a certain plSelect intenger it adds it's index instead of a value thus messing with me...
plyaer selection event works properly when i add units to tavern with a different method it adds correct units from the unit array

any ideas how i can fix that value?

---upd---

managed to fix that firmula when removed integer loop oO
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
btw regarding one of the systems...

i have 2 units per race 3 lvl each...and i'm trying to make it possible to detect which lvl of which unit should be added to spawning building at the begining of the round. i'm using intenger array(lets say it is calle plSelect[0..12] to track which player selected which race at the begining so what i need to do is call a value of a certain player selection to put that in formula (plSelect[1]+current lvl of "meleeUpgr"*10) or smth like that which should call a certain unit from a unit array

hope that's comprehendable xD

the problem is when i use a certain plSelect intenger it adds it's index instead of a value thus messing with me...
plyaer selection event works properly when i add units to tavern with a different method it adds correct units from the unit array

any ideas how i can fix that value?

---upd---

managed to fix that firmula when removed integer loop oO

Glad to hear you got that to work. From what it sounds, you want it to be something like:
Race 1
Unit type 1 level 1
Unit type 2 level 1
Race 2
....
And then also Unit type 1 level 2 etc.

I think a nice way you could do it is basically just store the unit type the player currently has and then update it when they choose a race or upgrade something. It depends on how your map works, though.

I'd have an array for unit type 1 and an array for unit type 2 (the array is so you have one slot per player in each array). When a player chooses a race, set the unit types for each of that players' slots to the level 1 version. When they get the corresponding upgrades, update the unit type to the next one (doing a unit type comparison on what they currently have if the upgrade is generic - like "Upgrade to level 2 melee unit" or something - or just set it if the upgrade is unique). From there, you just fetch the unit types for that player and you don't have to worry about anything at this point. Just spawn the units based on what's stored in the array.

I hope I understood your problem correctly lol. I totally understand what you mean with the "systems" though haha. I have things like that in my map that I am slowly converting to regular variables and stuff. I think the variables will be lighter (better performance) in the long run and also easier to understand.
 
Last edited:
Level 3
Joined
May 28, 2015
Messages
41
From what it sounds, you want it to be something like:

yeap...each race have 2 (for now then that would be 9) unit types. melee and ranged both types have 3 lvls so it makes up to 6 units per one race.

so what i did is when the player selects a race from the dialog box it sets player selection to 1-6 dependant on the race

then i have smth like this:

  • Events
  • Game - value of fight becomes 1
  • Conditions
  • Actions
  • Player Group - pick every player in all players
  • If/then/else multiple functions
  • If
  • raceSelect[player number of picked player] =1
  • Then
  • Unit Group - pick every unit owned by picked player of type tavern
  • Neutral Building - add meleeUnits[1+((current lvl of "meleeUpgr" for (picked player))*10))] to picked unit with stock
the tricky part is to get unit index from meleeUnits[] array correctly so that it would be added to the tavern depending on what lvl of "meleeUpgr" the picked player have and for some reason the loop that was in the race selection trigger interfered with that formula calling wrong unit index

since i have upgrades available only in between the rounds and no unit could be sent to the arena in that period i simple remove all units from the tavern when the round is finished which is indicated by
  • Game - Value of fight becomes 0
though it works just as intended i dont know wheter it causes leaks or not...haven't thought about leaks removal yet
 
Level 12
Joined
May 22, 2015
Messages
1,051
I don't think that kind of thing will leak - based on what I see. The main ones to look out for are unit groups and points, I think.

If it's working for you like that, then it's probably fine. That way works nicely since you can set up all of the arrays in one spot.
 
Level 3
Joined
May 28, 2015
Messages
41
yep 8) though i intend to use separate arrays for each group of units for they have identical formation. It shows now smth like that:

melee[11] - lvl1 race1
melee[21] - lvl2 race1
melee[32] - lvl3 race 2

this way making its easy to navigate and set up units just remembering what lvl of unit you need and for which race. I think i orginised it nicely xD
 
Level 3
Joined
May 28, 2015
Messages
41
see this tutorial for information.

i've looked into the tutorial and i think i'll aply that today (now that i have finished a unit selection and upgrade process) but here's couple of questions

how big the array should be? i mean do i need to make it for example 67 exactly or i might just set it to 99 and be happy with myself?

now i use a generic "unit being attacked" event and check if the random integer is less than skill chance and whether the attacking unit have enough mana to cast it. but would that work the same way with that indexing?

i assume with that indexing system i can add a cooldown to a passive ability so it would not occur 2 times in row...what conditions shall i add to the indexing caster so it would need to wait for the cooldown without interrupting other units of the same type cast chances?

thx for the tut and if you clarify that for me that would be much appreciated 8)

truly yours xD
 
Level 3
Joined
May 28, 2015
Messages
41
okay guys...now i'm sort of stuck...

i need to create a skill which teleports the enemy away from the caster...so what i'm doing is:

  • Events
  • Unit - a unit is attacked //which is the only action i seem to find appropriate for a passive skill to occur
  • Conditions
  • level of vanishing_strike_lv2 for (attacking unit) more than 0 //check if the attacking unit have the ability at all
  • Mana of (attacking unit) equals or more than 15 //check that a attacking unit have enough mana to cast spell
  • random integer number between 1 and 100 less than 17 //finily checking that the skill should occur on the hit or not
  • Actions
  • Trigger - add to VS2e <gen> the event (attacked unit) recieve damage // as i understand that prevents the attacked unit from being teleported right away before the actual attack
and then in the VS2e trigger i do this:

  • Events // left blank cus the action is added via VS2s trigger
  • Conditions //have no clue what to do there cus of VS2s trigger conditions check everything
  • Actions
  • Unit - move (atriggering unit) instantly to ((position of (triggering unit)) offset by 200 towards (facing of attacking unit) degrees
so the questions are:

1) how to make it MUI not to mess with direction of teleportation
2) why is it teleporting an enemy for larger distance each time it is attacked? 1st - 200 2nd - 400 - 3rd 600(or 800 not sure)
 
Level 9
Joined
Apr 23, 2011
Messages
527
please use this tutorial to properly paste your triggers.

you don't need two triggers, you just need one. change the event in the first trigger to a unit receives damage. if you do this, it will be MUI as the effect is instant (i think). you also have a point leak in your moving trigger, (Position of (Triggering unit)). set that to a point variable (example variable name point) before you use it, and remove it using a custom script;
  • Custom script: call RemoveLocation(udg_point)
 
Level 12
Joined
May 22, 2015
Messages
1,051
You get 2 point leaks with the "point with offset" functions. You need to clear the point you get from the unit and the new point you make with the offset.

It's getting farther and farther because the event is being added each time you attack. It is triggering more and more each time you attack them. You could put them in a unit group and check if they are in that group before adding the event. If they aren't you add the event and add them to the group.

To make it MUI, just put all of the checks for level of ability and mana and random chance in the damage trigger. Use "Event respsonse - damage source" instead "Event response - attacking unit" for everything in the second trigger. It is the unit that did the damage.

I think the only problem you would have after is making sure the damage is from an attack. If the unit with this knockback ability does damage from other things (like thunderclap, for example), units that he has attacked might have this effect happen. Since you are moving them, a ministun is not really a problem. You could remove the random chance calculation and instead just use a bash ability with the chance you want. Set the duration of the buff to 0.01 and the bonus damage to 0. Use a unique buff instead of the default "stun (pause)" buff and check for it when they get damaged. Check for the buff in the trigger. If it's not there, do nothing. Otherwise, remove the buff and the rest is the same.
 
Status
Not open for further replies.
Top