Hey guys the rpg which i am making is gonna have a lot of custom option in items. which need to be triggered. So to find the value of the option from the attacked unit and attacking unit there are 2 ways.
1. Using fake passive ability as a option
in this method when ever the hero picks or drops items he loses and gain a number through which i increase the level of a fake ability. e.g. if i want my evasion to 25 i have 2 passives
One from 0,1,2,3,4..9
another one 10,20,30..100
when i need to detect this value when the unit is being attacked, so
This trigger i have made to re-create a situation when a unit is wearing any item giving 3 critical evasion and leveled the ability to level 3
With this trigger i find out the level of the ability of the attacked unit and store it in a variable named evasion
The second method is using hastables
2. Using Hashtables
By this i use the first part of hashtables to store the custom value of unit then the second part is the id of the option stored.
Then increase the value of that hashtable when the unit picks or drops a item. i have use the current value as 3
Here when the unit is being attacked i find the custom value of the attacked unit and with the help of it i find the value of critical evasion.
My question:
Which do you think is better
What i am think is using hashtable for pvp combat and abilities for pve combat. And round of all monsters and unit values to a multiple of 5 to make the trigger a bit faster
what do you think is better?
Other notes : I have used another good system for damage detection and it cant be abused. :shades:
1. Using fake passive ability as a option
in this method when ever the hero picks or drops items he loses and gain a number through which i increase the level of a fake ability. e.g. if i want my evasion to 25 i have 2 passives
One from 0,1,2,3,4..9
another one 10,20,30..100
when i need to detect this value when the unit is being attacked, so
Trigger:
- Untitled Trigger 001
- Events
- Map initialization
- Conditions
- Actions
- Unit - Set level of Critical-Evasion for Text 0000 <gen> to 3
- Events
This trigger i have made to re-create a situation when a unit is wearing any item giving 3 critical evasion and leveled the ability to level 3
Trigger:
- Untitled Trigger 001
- Events
- Unit - Text 0000 <gen> Is attacked
- Conditions
- Actions
- Set attacker = (Attacking unit)
- Set attacked = (Attacked unit)
- Custom script: loop
- Custom script: exitwhen GetUnitAbilityLevelSwapped('A000', udg_attacked) == udg_evasion
- Set evasion = (evasion + 1)
- Custom script: endloop
- -------- Do rest of the damage trigger --------
- Events
With this trigger i find out the level of the ability of the attacked unit and store it in a variable named evasion
The second method is using hastables
2. Using Hashtables
Trigger:
- Untitled Trigger 002
- Events
- Map initialization
- Conditions
- Actions
- Unit - Set the custom value of Paladin 0001 <gen> to 123
- Hashtable - Create a hashtable
- Set hastable = (Last created hashtable)
- -------- The first part of the hastable is custom vaule of the unit and second part is id of option e.g evasion = 0 --------
- Unit - Set the custom value of Paladin 0001 <gen> to 2
- -------- Let the vaule of option = 3 --------
- Hashtable - Save 3 as qwe of 0 in hastable
- Events
By this i use the first part of hashtables to store the custom value of unit then the second part is the id of the option stored.
Then increase the value of that hashtable when the unit picks or drops a item. i have use the current value as 3
Trigger:
- Untitled Trigger 001
- Events
- Unit - A unit Is attacked
- Conditions
- Actions
- Set attacker = (Attacking unit)
- Set attacked = (Attacked unit)
- Set attackedCV = (Custom value of attacked)
- Set attackedCV = (Load qwe of 0 from hastable)
- Game - Display to (All players) the text: (String(attackedCV))
- -------- Do rest of the damage trigger --------
- Events
Here when the unit is being attacked i find the custom value of the attacked unit and with the help of it i find the value of critical evasion.
My question:
Which do you think is better
What i am think is using hashtable for pvp combat and abilities for pve combat. And round of all monsters and unit values to a multiple of 5 to make the trigger a bit faster
what do you think is better?
Other notes : I have used another good system for damage detection and it cant be abused. :shades: