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.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +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