Skill choosing trouble

Unholygod90

New Member
Reaction score
0
I'm currently working on a hero arena and I'm having a few issues with making abilities that can be bought at the start.
What would be the simplest way to make an ability buy-able and sell-able (in-case you decide otherwise). I'd also like to make sure that no one is able to leave the area until they have all of their skills (a max of 5). The easiest way I know of is via a trigger that has conditions where slot 1-5 has a certain type of item. If there is a better way please let me know!
Once this problem is solved I have one more question so please stick around! Thanks in advance!
 
Like "Custom Hero Line Wars"?

I believe the 'skills' in the shops are just items?
Then a matching skill is triggered onto the hero, I would assume.
 
yea, pretty much the same concept as custom here line wars.
My only trouble is on how to set up the trigger, any help with that? ;)
 
All I can think of is just matching each item and giving the ability.
Say, just for example, "Fan of Knives".
FoK's item code is "XXX1".
FoK's ability code is "XXX2".

Then, whenever the game starts:
Remove the item, and replace it with the matching ability ID.
Item - Remove XXX1
Unit - Add ability XXX2

I think you might have to do that for every item (A trigger for every item..)
Unless there's a way to check names of items vs abilities.
 
Cool, I'll try and give it a shot! Thanks for the advice :thup: I'll give you an update in a bit on how it works.
 
Could have made this a little easier with the idea I had.
Could have made a script like this:
Code:
function Vamp takes nothing returns nothing
    call UnitRemoveItem(unit, 'XXX1')
    call UnitAddAbility(unit, 'XXX2')
endfunction
And made a function like that for each item.
Then just call that function based on the item.
 
You would just make a simple function like that for each item/ability.
Then, in your GUI trigger, do something like:
Code:
loop 1-6
    if item = XXX1 then
        call function XXX1
    elseif item = XXX5
        call function XXX5
    <...>
    endif
endloop
Obviously those aren't the right ways to call things, but you get the idea.
 
Could have made this a little easier with the idea I had.
Could have made a script like this:
Code:
function Vamp takes nothing returns nothing
    call UnitRemoveItem(unit, 'XXX1')
    call UnitAddAbility(unit, 'XXX2')
endfunction
And made a function like that for each item.
Then just call that function based on the item.

Where it says "Vamp" that is just an example correct? I can replace that with like..."Hero"?

Edit: Oh, I think I may understand. Thats the name of the function. So I'd call it..."Bash" if thats the ability I want to make it...?
 
Yes, your edit is correct.
It's just to make it easier.

Hmm, you'll need to pass the unit though, so do this:
Code:
function example takes unit t, returns nothing
    call UnitRemoveItem(t, 'XXX1')
    call UnitAddAbility(t, 'XXX2')
endfunction
Then, in your GUI trigger, do this:
Code:
Custom script:    call example(GetTriggerUnit())
Or whatever unit type you may need.
Putting it in the brackets will 'pass' the unit to the function, so it knows what unit it's dealing with.
 
Hmmm... Don't think the Jass lines helped much or at all.

First you need an event. Assuming you're using items, the event should be in relation to items. Now create a trigger and let the event be 'A unit acquires an item'.

You need to know what item is acquired to perform the proper action. So at the condition part, set it to be 'Item-type carried by (Triggering unit) Equal to YourItemTypeForAbilityX'.

At the actions section, give your unit the said ability, which in this case Ability X. Use 'Unit - Add ability'. You might wanna remove the item since it's a dummy for this purpose.

Code:
Event
  A unit acquires an item
Condition
  Item-type carried by (Triggering unit) Equal to YourItemTypeForAbilityX
Actions
  Hero - Remove (Item being manipulated) from (Triggering unit)
  Unit - Add Ability X to (Triggering unit)

You can also convert the item into a powerup and used immediately after acquiring it. This way, the first line of the trigger above won't be required anymore.
 
He doesn't want the item to be instantly converted into an ability.
You pick your abilities (items), then after everyone else is done you get ported to the arena.
At that point, during the port, the items are switched for actual abilities.

Go download 'Custom Hero Line Wars' (From here on TH.net) and check it out :) !
 
Ok so this is what I have so far...
Code:
function BashAbility takes nothing returns nothing
    call UnitRemoveItem(unit, '0001')
    call UnitAddAbility(unit, '1001')
endfunction

(To make it easier on myself I have any code that starts with a 1 is an ability, and 0 is an item. I'm hoping that works right.)

I also have...
Code:
function example takes unit RedHero, returns nothing
    call UnitRemoveItem(RedHero, '0001')
    call UnitAddAbility(RedHero, '1001')
endfunction

Then finally with a GUI of...
Code:
Custom script:    call example(GetTriggeringUnit())

Not gonna lie, don't really understand it yet but I trust in you that it works. :p
Doing my best to learn it so I hope I'm not testing your patience if I get anything wrong.

Edit: Fixed a typo I made in the code
 
That looks good.

With the passing of the unit;
The function (function example) since it's in a different trigger, doesn't know what unit it's trying to do these actions to.
The function needs to know what unit it has to remove the item, and add the ability.
So, it "takes" the unit from the GUI, so it knows what unit it's dealing with.
The GUI "gives" (passes) the unit to the function, so that it knows what unit it deals with so it can do it's thing (item/ability).

Hope that helps, a bit :p
JASS is just GUI without the pretty texts.

"Unit - Remove Item" in GUI.
Unit - Remove 'item' from (Triggering Unit)
It's pretty much the same in JASS:
UnitRemoveItem(<unit>, <item>):
UnitRemoveItem(GetTriggerUnit(), 'item')
 
I have one more question, for the GUI. What should I make the Event?

I seem to have done something wrong aswell, It disabled the triggers due to errors >.>
 
For the event, it should be whenever all the players are taken into the arena.
So, a certain time; When a timer expires; When a player enters <Portal 001>, etc.
Whatever your thing is that decides when they enter the arena.
 
Ok so I have 6 errors, 5 with the Jass and 1 with the custom script.
The 5 errors are...

-Line 148: Expected a valid argument list
call UnitRemoveItem(unit, '0001')

-Line 149: ""
call UnitAddAbility(unit, '1001')

-Line 151: Expected a valid parameter list
function example takes unit RedHero, returns nothing

-Line 153: Invalid argument type (integer)
call UnitAddAbility(RedHero, '1001')

-Line 153: Expected a code statement (integer)
call UnitAddAbility(RedHero, '1001')

Custom Scrpit error is...
-Line 148: Expected a function name
call example(GetTriggeringUnit())

Edit: The reason for line 148 and 149 in JASS might be fore the simple reason that I haven't set the items or abilities to have certain codes (trying to figure the out right not XD)
It makes me sad to know there is SO much I still have to learn with world editor considering how long I have been working with it. I guess that's what happens when your self-taught...
 
You pass the unit as "RedHero", but then call for it as "unit" in the code.
Code:
...takes unit <name>...
The name needs to be the same as in the code:
Code:
...(<name>, 'XXXX')

And items and abilities don't use that type of numbering.
Items use lowercase characters, like 'rejp' for "Rejuvination Potion".
Abilities use uppercase, and start with an 'A'.
Then generally just go from 'A000' - 'A009'.
Then after 'A009', you can do 'A00A' or just continue with 'A010', 'A011', etc.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top