• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Hihanteki (Jinada-like skill) not working properly.

Status
Not open for further replies.
Level 9
Joined
May 21, 2014
Messages
580
I have 3 triggers that build-up the skill. As I have explained many times:
Hihanteki is a Jinada-like skill. The hero is granted a 100% critical chance, then when his attack landed, the 100% critical chance is removed. After a certain amount of time, the 100% critical chance will be given back to the hero.

The problem is: Sometimes, the 100% critical chance is not removed. I don't know what's causing it, but it is also random at happening. I believe that it isn't the lag that's causing this.

These are my triggers:

8WgtP


8Wgsu.png


8WgKs.png


"Hihanteki (Kenwa Assassin)" is the ability that can be learnt by the hero, which has a buff placer that places the buff "Hihanteki Buff Placer" which does nothing but just buff detection.
"Hihanteki Dummy Spellbook" contains "Hihanteki (Temporary)" and "Hihanteki Effects"
"Hihanteki (Temporary)" is the 100% critical strike.
"Hihanteki Effects" are just simply added effects.
I also have the hero have the Real Spellbook that has the same ID as the dummy spellbook. I also disabled both the real spellbook and dummy spellbook at map initialization.

I used GDD system for damage detection.

Please help me so I can move on to other stuff that needs to be done.
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
First off, don't use the "Do nothing" action, as it does nothing (cause no action) but still stresses your PC because it is function call. If you leave nothing in the last "Else - Actions" block, you will get the same result but with better efficiency.

Second, the trigger "Hihanteki Reset" can be simplified into two ITEs
Code:
If (conditions)
     Or - (conditions)
          Level equal to 1
          Level equal to 2
Then (Actions)
     Set time to 10.00
Else (Actions)
     If (conditions)
          Or - (conditions)
               Level equal to 3
               Level equal to 4
     Then (Actions)
          Set time to 8.50
     Else (Actions)
          Set time to 7.00
Because the trigger fires only after Hihanteki learns this skill, we don't need to worry about the level being anywhere else than between number 1 and 5 (including these numbers), so you can conclude that if the number can only be somewhere between [1...5] and the number is not 1 nor 2,3 or 4, then it obviously has to be 5, hence the fifth time is put in the last Else-Actions block and automatically set to 7.00.

More so, there is an algorithm that will work for this and get rid of all those conditions:
  • Set x = (Integer((0.48 x (Real(HihantekiLevel)))))
  • Set HihantekiRechargeValue = (10.00 - ((Real(x)) x 1.50))
"x" is a temp integer variable. You can do the whole thing in one line, but I think this way it is easier to understand.
It may be a little bit confusing as what "x" does. Explanation is in the hidden tabs.
  • Set x = (Integer((0.48 x (Real(HihantekiLevel)))))
1) First, it takes HihantekiLevel and converts it into real number (using "Conversion - Convert integer to real" action) -> e.g. if the value is 4, then converted it will be 4.00.

2) Next, it multiplies the converted value by 0.48 ... the number 0.48 is just random constant that happens to go well with the calculation.
If converted number is 4.00, then after this calculation (4.00 * 0.48) the number will be 1.92

3) The obtained number is now converted back to integer (Conversion - Convert real to integer action). What it does is that it takes only the integer part of the number and cuts off the decimal part away. It does not round up or down the number.
So if we had 1.92 and convert it into integer, we get number 1 (1.92 -> everything behind decimal point is cut off -> what was left intact is number 1).

4) Now we have final number x (in our case, the x = 1)

  • Set HihantekiRechargeValue = (10.00 - ((Real(x)) x 1.50))
5) In this action we use the number x as a multiplier for the reduction of time (which is 1.50 seconds).
First, number x needs to be converted so we get correct result.
E.g. x = 1 ==> converted ==> 1.00
and use this to multiply the reduction (1.00*1.50) = 1.50 which is then subtracted from number 10.00 and we get the correct time.
Level 4 time = 8.50.


Imo, if you use DDS, why don't you trigger your own critical strike? If it is guaranteed 1-hit crit, then all you really needs is a boolean variable.
e.g. boolean is named "WillBeCrit" and has "False" value by default.
When timer expires, you change that value to "True" and when unit takes damage from your hero, you check if value in WillBeCrit is True... you get 2 possible results:
a) value is "False" -> nothing happens (the guaranteed crit hit is on cooldown)
b) value is "True" -> you multiply damage taken and show floating text above unit; you also change the value back to "False" and start the timer.

Then once again when timer expires, it simply changes the boolean value back to "True", as the crit is ready.

Edit:
Or even better - when unit crits, you turn off the trigger which causes the critical strike (using Trigger - Turn off (This trigger) action) and start the timer. When timer expires, you turn on the trigger switched off earlier.
 
Level 9
Joined
May 21, 2014
Messages
580
First off, don't use the "Do nothing" action, as it does nothing (cause no action) but still stresses your PC because it is function call. If you leave nothing in the last "Else - Actions" block, you will get the same result but with better efficiency.

I will follow this by heart. Thank you.

More so, there is an algorithm that will work for this and get rid of all those conditions:
  • Set x = (Integer((0.48 x (Real(HihantekiLevel)))))
  • Set HihantekiRechargeValue = (10.00 - ((Real(x)) x 1.50))
"x" is a temp integer variable. You can do the whole thing in one line, but I think this way it is easier to understand.
It may be a little bit confusing as what "x" does. Explanation is in the hidden tabs.
  • Set x = (Integer((0.48 x (Real(HihantekiLevel)))))
1) First, it takes HihantekiLevel and converts it into real number (using "Conversion - Convert integer to real" action) -> e.g. if the value is 4, then converted it will be 4.00.

2) Next, it multiplies the converted value by 0.48 ... the number 0.48 is just random constant that happens to go well with the calculation.
If converted number is 4.00, then after this calculation (4.00 * 0.48) the number will be 1.92

3) The obtained number is now converted back to integer (Conversion - Convert real to integer action). What it does is that it takes only the integer part of the number and cuts off the decimal part away. It does not round up or down the number.
So if we had 1.92 and convert it into integer, we get number 1 (1.92 -> everything behind decimal point is cut off -> what was left intact is number 1).

4) Now we have final number x (in our case, the x = 1)

  • Set HihantekiRechargeValue = (10.00 - ((Real(x)) x 1.50))
5) In this action we use the number x as a multiplier for the reduction of time (which is 1.50 seconds).
First, number x needs to be converted so we get correct result.
E.g. x = 1 ==> converted ==> 1.00
and use this to multiply the reduction (1.00*1.50) = 1.50 which is then subtracted from number 10.00 and we get the correct time.
Level 4 time = 8.50.

This is amazing. I never ever had thought about anything like this. I shall implement this.

Imo, if you use DDS, why don't you trigger your own critical strike? If it is guaranteed 1-hit crit, then all you really needs is a boolean variable.
e.g. boolean is named "WillBeCrit" and has "False" value by default.
When timer expires, you change that value to "True" and when unit takes damage from your hero, you check if value in WillBeCrit is True... you get 2 possible results:
a) value is "False" -> nothing happens (the guaranteed crit hit is on cooldown)
b) value is "True" -> you multiply damage taken and show floating text above unit; you also change the value back to "False" and start the timer.

Then once again when timer expires, it simply changes the boolean value back to "True", as the crit is ready.

Edit:
Or even better - when unit crits, you turn off the trigger which causes the critical strike (using Trigger - Turn off (This trigger) action) and start the timer. When timer expires, you turn on the trigger switched off earlier.

I can't trigger the critical because I wanted the floating text to display the right value that was inflicted, since the hero has a skill Orb of Corruption (AND BY THIS I FOUND OUT WHY IT WASN'T WORKING: He has an orb effect, thus the buff isn't really placed.)
And since the hero has Orb of Corruption, the damage will already be altered since the damage has been affected with the Orb of Corruption already.
If I trigger it, the critical will be very powerful, so I had to use the critical strike skill. I triggered the critical strike before already, but a 69 base damage would inflict 400+ damage (because GDD_Damage is the damage + the -armor from orb + WInd Walk damage)

Another question: Is there another buff placer that would stack with orb of corruption? I wanted the condition to have a buff placer so that it ensures it comes from a normal attack.

Thank you for your time to give me awesome algorithms and tips :thumbs_up:
 
Level 12
Joined
Nov 3, 2013
Messages
989
Can't you use the orb of corruption? Make it Unique for the unit, if it isn't already, and use that to identify that it's the right unit that is attacking

Have another trigger check if orb of corruption is leveled and if it isn't then add another custom one which uses the same buff and then remove it and disable this trigger.

You could perhaps use an ability like cold arrow which would override orb of corruption when it's used.
 
Status
Not open for further replies.
Top