Custom options

envenger

Active Member
Reaction score
3
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

Trigger:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Set level of Critical-Evasion for Text 0000 <gen> to 3

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 --------


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


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 --------


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:
 

Executor

I see you
Reaction score
57
So, you basically want to attach variables to units and item types.

E.x. if you pick up an evasion item the evasion value of the unit is increased by a item-type specific amount. Dropping the item will decrease the evasion value of the unit by the item-type specific evasion amount again. Am I right till there?


Well, vJass grants wonderful possibilities for circumstances like this.


example:
JASS:

struct ItemData
    real meleeEvasion
    real rangeEvasion
    real spellEvasion
    private Hashtable ref
    static method operator[] takes item i returns thistype
        return LoadInteger(.ref,GetItemTypeId(i),0)
    endmethod
    private static method onInit takes nothing returns nothing
        set .ref = InitHashtable()
    endmethod
    static method newType takes integer id returns thistype
        local thistype this = thistype.allocate()
        call SaveInteger(.ref,id,0,this)
        return this
    endmethod
endstruct

struct UnitData
    //! runtextmacro AIDS()
    real meleeEvasion
    real rangeEvasion
    real spellEvasion
    static method onItemPickUp takes nothing returns boolean
        local thistype this = thistype[GetTriggerUnit()]
        local ItemData d    = ItemData[GetManipulatedItem()]
        set .meleeEvasion = .meleeEvasion + d.meleeEvasion
        set .rangeEvasion = .rangeEvasion + d.rangeEvasion
        set .spellEvasion = .spellEvasion + d.spellEvasion
        return false
    endmethod
    static method onItemDrop takes nothing returns boolean
        local thistype this = thistype[GetTriggerUnit()]
        local ItemData d    = ItemData[GetManipulatedItem()]
        set .meleeEvasion = .meleeEvasion - d.meleeEvasion
        set .rangeEvasion = .rangeEvasion - d.rangeEvasion
        set .spellEvasion = .spellEvasion - d.spellEvasion
        return false
    endmethod
    static method AIDS_onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
        call TriggerAddCondition(t,Condition(function thistype.onItemPickUp))
        set t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(EVENT_PLAYER_UNIT_DROP_ITEM,null)
        call TriggerAddCondition(t,Condition(function thistype.onItemDrop))
    endmethod
endstruct

// ....

function someFunction takes nothing returns nothing
    local ItemData d = ItemData.newType('kpin')
    set d.meleeEvasion = 0.1
    set d.rangeEvasion = 0.0
    set d.spellEvasion = 0.4
endfunction
 

envenger

Active Member
Reaction score
3
not really understand, besides what is the point for doing all this thing?

I am gonna have a lot of triggered options in game which cant be done by manually like Critical hit % = attackers critical hit rate - opponents critical hit evasion. So when there is a damage condition, I can do the calculation and damage accordingly.

This things were not possible without calculating the amount of critical hit evasion of opponent

And these are the 2 ways which i think it could be done
 

envenger

Active Member
Reaction score
3
So, you basically want to attach variables to units and item types.

E.x. if you pick up an evasion item the evasion value of the unit is increased by a item-type specific amount. Dropping the item will decrease the evasion value of the unit by the item-type specific evasion amount again. Am I right till there?

Well not evasion actually there a lot of triggered attributes in mah RPG responsible for damage. So finding all those attributes by this manner would be easy.

i still think i couldn't explain you correctly :banghead:
 

Executor

I see you
Reaction score
57
Of course. Evasion was only an example. You can insert other attributes easily in the mentioned script. Something like: "spellPower" "spellCrit" "meleeCritical" "chanceToReplenishMana" ...

Well, maybe try again explaining your situation to us. Maybe then I can help you more :thup:
 

envenger

Active Member
Reaction score
3
See I am working on a map called Guardian Angels. and currently working on a damage system. I have already made a system to detect the damage leak-less and cant be exploited.

Now i am doing the Custom-damage trigger

There are many option in game like Critical hit rate, Critical hit Percent. These things cannot be done with normal warcraft-3 damage system.

But when i add these custom values in items they are going to stored in a variable and will be brought back again in damage triggers. And these 2 are the ways which i find it easy to get the values from the
"Event response - attacked unit"
i got these 2 ways from my limited knowledge of GUI(Warning i am still new to world editor :p)

The first one is made when the variable in which the value of the option is present i increase a fake ability of the hero and the ability is hidden is a disabled spell book and is a unit passive ability. With the increase in the value of the option i increase the level of the ability. And the trigger which i gave was a example of the method in which this value could be found.

/
/

And the second one is by naming all unit to custom values say e.g 2. and naming all item option in a order and storing it in the hastable. e.g evasion is 5 so hashtable position for this option is 2 of 3.And increase it with respect to items in hero inventory. So form the "event response attacked unit" we find the custom variable of the unit and store it in a variable and find out the respective option form the hashtable 2 of 3. 2 = custom value of the unit and 3 is the base id for evasion and is common for evasion for all hero's. once i get the value i can do the custom damage with respect to its values.

Hope this is better :banghead:
 

Ayanami

칼리
Reaction score
288
If you have a definite way of detecting Physical attacks, then go for option 2.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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