how to change item ability or ability stats using trigger

Omer Simpson

New Member
Reaction score
0
hello
first, sorry for my bad english, I learn them on tv from Simpsons etc. :)

I use WE for some time and have some problems who cant be solved with GUI
so I need jass functions, and that is problem because my programming skill is wery low ( but I am familiare with "convert to text" and "show as raw data" concept )
I am searching this forum for example but bad english+unusual problem... cant find solution.
If already exist page with this just give me link and feel free to delete this...

I have two stuff to do

1. To ad/remove ability to item using triger. This is posible to unit but item ? need this:

add ability X to item Y

2. To change ability stats using trigger for ability with integer value Hero stats ( armor, damage, int, str, agil )
need this:

for ability A stats name N set value V

where V is number or integer variable

thanks :thup:
 

Tyrulan

Ultra Cool Member
Reaction score
37
I've been a long time out of JASS coding, and the World Editor in general, but I think I can still help you. In fact, I don't think you need JASS at all.

I believe in order to replace an ability on item, you must replace the item which has a different ability.
Example: Item A has ability B, so we change into Item C has ability D.

As far as casting abilities based on hero stats, you're better off creating an 'OnSpellCast' trigger and checking for abilities B and D. Then you can deal damage of type with whatever mathematical factors that you need.

Let me know if you need more help with this.
 

Omer Simpson

New Member
Reaction score
0
I know for that, but in that case you must make lots of items, and trigger for every combinations, and cant merged random items etc.
Wish to hero find one ring of armor, then others pickuped just stack on them...
Searching forum and discover few pages for that question but no answer...
apparently that pretty nasty ?

in GUI trigger there is "add ability to unit" action, work fine.
try to change it, combining with others and experimenting with functions in blizzard.j, finally get code without errors but dont work :(
just game slow for a second when activate it but nothing change on item.

Ok, first put ring armor +3 on map (gg_item_rde2_0002) and then try to add him item ability +5 armor (AId5) to get ring +8 armor
make trigger "test" and this in them


function ItemAddAbility takes integer abilityId, item whichItem returns boolean
return ItemAddAbility(abilityId, whichItem)
endfunction

function Trig_test_Actions takes nothing returns nothing
call ItemAddAbility( 'AId5', gg_item_rde2_0002 )
endfunction

No errors, but dont work. What is wrong here ?


For question 2, is it anyway and anyhow possible to "reach" object editor stats names and values using trigger ?
This could be useful and for this first problem - each unit and item have abilList with id of abilityes that unit/item have.
Just cannot find function who could set/change abilList !
 

Tyrulan

Ultra Cool Member
Reaction score
37
Your function is recursive. It will never exit the call stack until the game engine forces it to (most likely at 8191).
JASS:
function ItemAddAbility takes integer abilityId, item whichItem returns boolean
    return ItemAddAbility(abilityId, whichItem)
endfunction

Your best bet is to create functions to see what item abilities a hero already has, then add what is required. You should be able to have one ability (Ring Mail) and give it levels (Level 1, 2, 3 etc..) and just level that ability up when the hero picks up an item of +5.

It shouldn't be too difficult to add 5 levels from level 3 of an ability.
 

Omer Simpson

New Member
Reaction score
0
This is blizzard.j function for adding ability to unit, I've just try to change it to add ability to item instead to unit.

function UnitAddAbilityBJ takes integer abilityId, unit whichUnit returns boolean
return UnitAddAbility(whichUnit, abilityId)
endfunction

Searching forum, and it seems that changing items, abilities, item stacking and combining and so, is very complicated to do. People wrote big function, hundreds lines of code, weird things... It is above my level.
And most of that give ability to unit and not to item, or give some pre created item for combination defined in trigger.
That action exist in trigger editor, set event - Hero pickup a item, action - give some ability to that Hero, set level of that ability...
but people want more options, settings or whatever...
It seems that things in object editor must be set during making map, and cannot be changed using triggers...

I've do almost everything what I wont on my maps, except that item stacking, ability change and so...
People from Blizzard should put few actions in WE and make that much easy. One for items - add ability to item, and few for abilities, for change some stats. But, if they did not do that so far...

If someone wish to try, I think for adding abilities to items, best way is modifying abilList in object editor, if is that possible using functions...
For modifyng abilities, must change stats values.
 

Tyrulan

Ultra Cool Member
Reaction score
37
I've provided a suitable solution above, it seems you haven't understood it fully. I'm sorry, but I cannot help you further with this.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Honestly when you get to the point where you want to randomize stats on items and provide modifiers/enchantments its time to code your own item system, check out the item system used on TKoK Eastern Kingdoms ORPG, i think you would find it to your liking
 

Omer Simpson

New Member
Reaction score
0
This idea about increase level of ability give me idea how to solve this, even without jass.
I combine that with some my old triggers and add integer variable for counter. Now I manage to find way to "connect" attributes, damage and armor to item and add or remove when item pickuped or dropped. Now they can be shared among more heroes, or lost if item is droppable upon death.
It is not exactly this what I want at begining but is close enough !

For armor:
1. Create custom ability from one of Item Armor Bonus, with lots of levels (100 maximum), set first level Defense Bonus to 0, second level 2, and then just increase for 1. Set to be Hero ability, not item !!
2. Create one dummy item (just for event setting).
3 Create one integer variable for counter initial set to 0 ( ArmrValue)
4. Make three trigers

First, make two triggers for situation when Hero pickup or drop that special item

Item ARMOR pickup
Events
Unit - A unit Acquires an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
(Item-type of (Item being manipulated)) Equal to Shield of Armor X
Actions
Unit - Add Hero Armor Bonus (+X) to (Hero manipulating item)
Unit - Set level of Hero Armor Bonus (+X) for (Hero manipulating item) to ArmrValue
......................................................................................
Item ARMOR drop
Events
Unit - A unit Loses an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
(Item-type of (Item being manipulated)) Equal to Shield of Armor X
Actions
Unit - Remove Hero Armor Bonus (+X) from (Hero manipulating item)

But variable counter value is 0 so that do not have any effect yet !
So make trigger who set value and remove pickuped item.
Here is example with just one item (Ring of Protection +2), for remain just copy If function, modify it and add below.

Item ARMOR Bonus
Events
Unit - A unit Acquires an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
((Hero manipulating item) has an item of type Shield of Armor X) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item being manipulated)) Equal to Ring of Protection +2
Then - Actions
Set ArmrValue = (ArmrValue + 2)
Unit - Set level of Hero Armor Bonus (+X) for (Hero manipulating item) to ArmrValue
Item - Remove (Item being manipulated)
Else - Actions

All together, if Hero have item "Armor X" in inventory and pickup Ring, Ring disappear and Hero get armor bonus for value of that Ring. When drop "Armor X" lose that armor, but return them when again pickup "Armor X". Or other Hero get them if pickup "Armor X". That simulate real item.

For damage items same this, just make ability from Item Damage Bonus !

For attributes similar, need three variables (str, agl, int), and not abilities but actions for modify Hero attribute.

Item X pickup
Events
Unit - A unit Acquires an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
(Item-type of (Item being manipulated)) Equal to Attribut Collector
Actions
Hero - Modify Strength of (Hero manipulating item): Add StrnValue
Hero - Modify Agility of (Hero manipulating item): Add AgilValue
Hero - Modify Intelligence of (Hero manipulating item): Add IntlValue
..................................................................................
Item X drop
Events
Unit - A unit Loses an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
(Item-type of (Item being manipulated)) Equal to Attribut Collector
Actions
Hero - Modify Strength of (Hero manipulating item): Subtract StrnValue
Hero - Modify Agility of (Hero manipulating item): Subtract AgilValue
Hero - Modify Intelligence of (Hero manipulating item): Subtract IntlValue
....................................................................................
Item Attribut Bonus
Events
Unit - A unit Acquires an item
Conditions
And - All (Conditions) are true
Conditions
((Hero manipulating item) is A Hero) Equal to True
((Hero manipulating item) has an item of type Attribut Collector ) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item being manipulated)) Equal to Circlet of Nobility
Then - Actions
Hero - Modify Strength of (Hero manipulating item): Add 2
Set StrnValue = (StrnValue + 2)
Hero - Modify Agility of (Hero manipulating item): Add 2
Set AgilityValue = (AgilValue + 2)
Hero - Modify Intelligence of (Hero manipulating item): Add 2
Set IntlValue = (IntlValue + 2)
Item - Remove (Item being manipulated)
Else - Actions

All together, when Hero pickup Circlet and have Collector in inventory, Circlet disappear and Hero get +2 all stats. When drop Collector lose that attributes, but return them when again pickup Collector. Or other Hero get them if pickup Collector.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Except that has an exceptionally bad interface, will drastically increase load times (level of ability cant exceed 5 or load times go up), and the fact that its gui means it leaks as it uses actions in the underlying code, regardless of whether or not your code would leak in jass, and this is the Jass Zone, why someone would do that in place of an item library is beyond me

And being able to do something "even without jass" isnt exactly wanted in the jass zone specifically because most people posting in this forum prefer to code in jass... once you learn it its much easier to use, program, and do about anything, I could do anything in gui, but i prefer to do it in Jass
 

Omer Simpson

New Member
Reaction score
0
yes, make lag, increase load time and do not work good on units with Metamorphosis and Chemical rage...
but I do not have time now to work on this
at least this for attributes work great.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      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