• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

help with triggers and skills

Status
Not open for further replies.
Level 2
Joined
Nov 16, 2011
Messages
13
i have been having a problem implementing damage to a custom made skill(im making a map with triggers for the first time). can anyone lend me some aid tips and suggestions on what i am doing wrong?

the concept of wat i am trying to do is.

heroes have passive skills such as the one shown called Rune of Earth. they deal damage by using items only because i took off their attack function. wen i use the item Strike of earth, i want to make the damage change depending on the level of Rune of Earth. this goes for all the other items i am going to make for this map as well. each item's damage or use is increased depending on the level of the Rune(skill) your hero has.
just to clarify again if it didnt make sense before.

---if i have the skill rune of fire and i have an item called strike of fire. i want it to deal 100 damage if rune of fire is lvl 1, 150 if its lvl 2, and so on.

any help is much appreciated, thanks! :ogre_haosis:
 

Attachments

  • Strike of earth.jpg
    Strike of earth.jpg
    100 KB · Views: 107
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well.. If you wan't to do it that way, I think the best would be saving the Item values inside a Hashtable based on the Item-Type handle Id... Probably this sounds "chinesse" since it's the first time you work with triggers.

I'm not sure, but I think you can't set the Item Ability levels into the item.. neither i'm sure if you can set UnitAbilityLevel to increase the level of an item based ability.

If the ability has 4 levels, I think you'll have to create 4 Items and 4 Abilities, one item por ability as a "faked level up"... and set the item/ability values in a Hashtable.
 
Level 2
Joined
Nov 16, 2011
Messages
13
can u give me a quick run through of hastables? or post a link to the page describing it? u can do both if u have the time :D
 
Level 2
Joined
Nov 16, 2011
Messages
13
can you guys tell me if its possible to make lvl requirements for item uasage? like implementing the skill of an ability as the requirement
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yes, you can.

You can save the required item level in the Item ID and check it when the item is acquired, else, drop it.

You can also use the Custom Value of the item if you aren't going to use it in any other way.
 
Level 2
Joined
Nov 16, 2011
Messages
13
just wondering here. if possible can u guys make a small sample map so i can see what these triggers should look like? i want something to base my triggers off from because im completely loss wen trying to save information into hastables and i see value and i click on it and then the same window opens over and over and over. if u guys have the time and patience to do a sample map for me itll be greatly appreciated. thanks in advance and thanks for the help so far.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
In this first trigger you have to save each item level and else using
call SaveInteger(udg_YourHashtableName, 'ItemType ID', Hashtable parent key [i like to call it Slot], And the item level)
Custom script: call SaveInteger(udg_Hash, 'rde3', 0, 2)

Be aware that the ItemType ID is between '...' (I don't know how these are called in English). To know the item type ID look for the item in the Editor and press CTRL+D. It will reveal each object raw data, including the Item ID.

  • Melee Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • -------- SaveInteger() = We're saving a whole number to compare with unit level --------
      • -------- udg_Hash is the Hashtable we created, in which we're going to save the values --------
      • -------- 'rde3' is the Integer ID of the Ring of Protection +4 --------
      • -------- 0 is the slot where we're going to save the data --------
      • -------- Last, the number 2 is the level I want this item to require --------
      • -------- So its: "call SaveInteger(udg_YourHashtableName, The Item Type ID between '.', The slot where you're saving it, and the level the item requires) --------
      • Custom script: call SaveInteger(udg_Hash, 'rde3', 0, 2)
  • Item Level
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • -------- Now we LoadInteger(udg_YourHashtableName, the item Id, and the slot where we saved the item level) --------
      • Custom script: set udg_i = LoadInteger(udg_Hash, GetHandleId(GetManipulatedItem()), 0)
      • -------- if the item level is greater than the hero level, drop the item. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Greater than (Hero level of (Triggering unit))
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
        • Else - Actions
It's faster if you do it in JASS.

JASS:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
    set udg_Hash = InitHashtable()
    
    // Here you add the items levels following the same model
    // call SaveInteger(HashtableName, ItemId, Slot, Required Level)
    
    // Ring of Protection +4
    call SaveInteger(udg_Hash, 'rde3', 0, 2)
    // Periapt of Vitality
    call SaveInteger(udg_Hash, 'prvt', 0, 6)
    // Claws of Attack + 12
    call SaveInteger(udg_Hash, 'ratc', 0, 15)
    // etc...
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Melee_Initialization, 0.00 )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

This following script can be mixed. There's no need to use all those locals. I just did it that way so you can see clearly what those values mean

JASS:
function Trig_Item_Level_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer UnitLevel = GetHeroLevel(u)
    
    local item Item = GetManipulatedItem()
    local integer ItemId = GetHandleId(Item)
    
    local integer ItemLevel = LoadInteger(udg_Hash, ItemId, 0) 
    // if the item level is greater than the hero level, drop the item.
    if ItemLevel > UnitLevel then
        call UnitRemoveItem(GetTriggerUnit(), GetManipulatedItem())
    endif
    
    set u = null
    set Item = null
endfunction

//===========================================================================
function InitTrig_Item_Level takes nothing returns nothing
    set gg_trg_Item_Level = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Level, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( gg_trg_Item_Level, function Trig_Item_Level_Actions )
endfunction

The "Reduced" Version would be

JASS:
function Trig_Item_Level_Actions takes nothing returns nothing
    if LoadInteger(udg_Hash, GetHandleId(GetManipulatedItem()), 0)  > GetHeroLevel(GetTriggerUnit()) then
        call UnitRemoveItem(GetTriggerUnit(), GetManipulatedItem())
    endif
endfunction

//===========================================================================
function InitTrig_Item_Level takes nothing returns nothing
    set gg_trg_Item_Level = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Level, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( gg_trg_Item_Level, function Trig_Item_Level_Actions )
endfunction
 
Status
Not open for further replies.
Top