• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Remove skill condition need help

Status
Not open for further replies.
Level 3
Joined
Apr 4, 2012
Messages
64
hello. heres the deal i have a script that when i buy the item, gives the hero an abilitie, the thing is i wanted to make a condition that if unit(the hero) abilities =4(counting only normal abilities without ultimate abilitie count) do else actions

from a1 to a80 its trigger of hero abilities

  • a1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Dark Ritual -Can Be Upgraded To level 10-
    • Actions
      • Set skill[(Player number of (Triggering player))] = Dark Ritual
      • Wait 0.20 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of skill[(Player number of (Triggering player))] for (Triggering unit)) Less than 1
        • Then - Actions
          • Unit - Add skill[(Player number of (Triggering player))] to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of skill[(Player number of (Triggering player))] for (Triggering unit)) Less than 10
            • Then - Actions
              • Unit - Increase level of skill[(Player number of (Triggering player))] for (Triggering unit)
            • Else - Actions
              • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: You can´t get your...
              • Player - Add 100 to (Triggering player) Current lumber
 
Why do you use a Wait 0.20 action?...

You repeat the same thing (Player number of...) / (Triggering Unit) over and over and over. Use a variable.

If level = 0 then: add ability
If level is less than 10 then: increase level.

This can be easily done with the https://www.hiveworkshop.com/forums...2-0-a-203991/?prev=search=-Kobas-&d=list&r=20 made by Kobas, and works for all your item/abilities.

you still didnt answer how to add the condition.
kobas spellsystem doesnt count the abilities so it doesnt let hero have more then 4 plus the ulti.
and ye ill check on that on the second release. my first release will be a function map. the second will cover all the dumb code envolved
 
Create an Integer variable array = SkillQ[Index]

Wenever you trigger a player add ability set SkillQ[Player Number] = (Skill[Player Number] + 1)
Wenever you trigger a player remove ability set SkillQ[Player Number] = (Skill[Player Number] - 1)

Integer Condition: SkillQ[Player Number] is less than or equal to 4.
 
Create an Integer variable array = SkillQ[Index]

Wenever you trigger a player add ability set SkillQ[Player Number] = (Skill[Player Number] + 1)
Wenever you trigger a player remove ability set SkillQ[Player Number] = (Skill[Player Number] - 1)

Integer Condition: SkillQ[Player Number] is less than or equal to 4.

example plz?

i have made the variable n stuff just got confused...
 
The example is exactly as my last post.

After triggering any Unit-Add Ability do:
Set SkillQ[Player Number of Owner of (The Unit You're giving the ability)] = (Skill[Player Number] + 1)

After triggering any Unit-Remove Ability do:
Set SkillQ[Player Number of Owner of (The Unit You're removing the ability from)] = (Skill[Player Number] - 1)

The condition you want to check is an integer comparison.
If SkillQ[Player Number] is equal to 4 then
-> Means the unit already has 4 skills.

This will work only for one unit per player.
 
The example is exactly as my last post.

After triggering any Unit-Add Ability do:
Set SkillQ[Player Number of Owner of (The Unit You're giving the ability)] = (Skill[Player Number] + 1)

After triggering any Unit-Remove Ability do:
Set SkillQ[Player Number of Owner of (The Unit You're removing the ability from)] = (Skill[Player Number] - 1)

The condition you want to check is an integer comparison.
If SkillQ[Player Number] is equal to 4 then
-> Means the unit already has 4 skills.

This will work only for one unit per player.

well i got till here
Set SkillQ[(Player number of (Owner of (Matching unit)))] = how do u do that?
the unit iam removing is triggered player hero how do put it intead of matching unit? or can i put set matching unit=triggered player hero?
 
What unit you're giving the ability to? What unit are you removing the ability from?

That's the same unit you're going to use in [Player Number of (Owner of (ThatUnit))]

If the event is a generic unit event (A unit... something) you can use (Triggering Player) as (Owner of (Triggering Unit)).
 
What unit you're giving the ability to? What unit are you removing the ability from?

That's the same unit you're going to use in [Player Number of (Owner of (ThatUnit))]

That unit is 1 of 40 heros that the player will choose in-game on the alter that isnt even built yet lol see what i mean or not?
 
Yeah, I see what you mean, but you don't see what I mean.

The Unit-Type of the hero doesn't matter. The player needs a Hero Unit near a Shop to buy the Item-Skill. If the player can only have one hero at the time, then it's fine. That Hero Acquiring an Item-Skill will always be the Triggering Unit.
 
Yeah, I see what you mean, but you don't see what I mean.

The Unit-Type of the hero doesn't matter. The player needs a Hero Unit near a Shop to buy the Item-Skill. If the player can only have one hero at the time, then it's fine. That Hero Acquiring an Item-Skill will always be the Triggering Unit.

damn i cant make it :S can u post war3 code?
 
  • a1
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Dark Ritual -Can Be Upgraded To level 10-
  • Actions
    • Set TPlayer = (Triggering Player)
    • Set TUnit = (Triggering Unit)
    • Set TInt = (Player Number of TPlayer)
    • Set TSkill = Dark Ritual
    • Set TForce = PlayerGroup(TPlayer)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of TSkill Equal to 0)
      • (TInt less than 4)
    • Then - Actions
      • Unit - Add TSkill to TUnit
      • Set SkillQ[TInt] = (SkillQ[TInt] + 1)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TSkill for TUnit) Less than 10
      • Then - Actions
        • Unit - Increase level of TSkill for TUnit
      • Else - Actions
        • Game - Display to TFoce for 5.00 seconds the text: You can´t get your...
        • Player - Add 100 to TPlayer Current lumber
    • Custom script: call DestroyForce(udg_TForce)
Copying this 80 times to handle different abilities is awkwardly inneficient. You could do this with 1 or 2 triggers for all item/abilities (Like -Kobas- System does).
 
  • a1
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Dark Ritual -Can Be Upgraded To level 10-
  • Actions
    • Set TPlayer = (Triggering Player)
    • Set TUnit = (Triggering Unit)
    • Set TInt = (Player Number of TPlayer)
    • Set TSkill = Dark Ritual
    • Set TForce = PlayerGroup(TPlayer)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of TSkill Equal to 0)
      • (TInt less than 4)
    • Then - Actions
      • Unit - Add TSkill to TUnit
      • Set SkillQ[TInt] = (SkillQ[TInt] + 1)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TSkill for TUnit) Less than 10
      • Then - Actions
        • Unit - Increase level of TSkill for TUnit
      • Else - Actions
        • Game - Display to TFoce for 5.00 seconds the text: You can´t get your...
        • Player - Add 100 to TPlayer Current lumber
    • Custom script: call DestroyForce(udg_TForce)
Copying this 80 times to handle different abilities is awkwardly inneficient. You could do this with 1 or 2 triggers for all item/abilities (Like -Kobas- System does).

well yeah but it works xD
 
Just use TriggerUnit for this event when you want to refer to the unit/hero that acquires an item. Do not copy that 80 times, it's just so inefficient. Think about it, try to group the items (all 80 items) in Object Editor into 1 group, e.g. Artifact, level 6. Then check the event condition if the item is any of Artifact or even any of Artifact-Level 6 specifically, then do the same actions to all heroes, plus all players if you want to.

Use if condition in the actions, even NEST IF(if then elseif) if you really need to verify which item the hero has just acquired.
All items can be handled in 1-2 GUI triggers, just use IF.
vJass coder only need a function in library, then call it for any item & actions followed by the identified item in the If condition.
 
Like i said b4 i apriciate that alot but iam a begginer and i want to release a fully working version after that ill redo the codes like you guys are saying, but first i wanna release the map

well i tested it adds the skill anyways but prevents from lvling it stays lvl 1 even if u buy it again

why i want this? iam going to add a spellbook and the hero so he will come with a spellbook and blink abilitie by default plus ulti and 3 abilities and 1 empty slot that im thinking on something new to it=7 slots that is the max

  • a4
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Drunken Brawler -Can Be Upgraded To level 10-
    • Actions
      • Set TPlayer = (Triggering player)
      • Set TUnit = (Triggering unit)
      • Set TInt = (Player number of TPlayer)
      • Set TSkill = Drunken Brawler
      • Set TForce = (Player group(TPlayer))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TSkill for (Triggering unit)) Equal to 0
          • TInt Less than 4
        • Then - Actions
          • Unit - Add TSkill to TUnit
          • Set SkillQ[TInt] = (SkillQ[TInt] + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of TSkill for TUnit) Less than 10
            • Then - Actions
              • Unit - Increase level of skill[(Player number of (Triggering player))] for (Triggering unit)
            • Else - Actions
              • Game - Display to TForce for 5.00 seconds the text: You can´t get your...
              • Player - Add 100 to (Triggering player) Current lumber
      • Custom script: call DestroyForce(udg_TForce)
 
Eh.. Re-doing stuff is one of the worse things you can do. It's better to invest time planning things than inves time in mending stuff.
 
If you got a job to do, you better do it well in the first place. Otherwise, make a simple map then develop it bit by bit, recoding a huge map is a big pain and energy consumption.

iam almost finished lol i remoded everything i added multiboards mods shop system and everything i just need little more conditions on certain things

i just needed that condition to finish the map lol
 
so any ideias how to add codition if player has 4 abilities game tell player you can't have anymore spells.

all abilitie buyable items are in custom purshable category

  • a1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Dark Ritual -Can Be Upgraded To level 10-
    • Actions
      • Set skill[(Player number of (Triggering player))] = Dark Ritual
      • Wait 0.20 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of skill[(Player number of (Triggering player))] for (Triggering unit)) Less than 1
        • Then - Actions
          • Unit - Add skill[(Player number of (Triggering player))] to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of skill[(Player number of (Triggering player))] for (Triggering unit)) Less than 10
            • Then - Actions
              • Unit - Increase level of skill[(Player number of (Triggering player))] for (Triggering unit)
            • Else - Actions
              • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: You can´t get your...
              • Player - Add 100 to (Triggering player) Current lumber
 
  • a1
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Dark Ritual -Can Be Upgraded To level 10-
  • Actions
    • Set TPlayer = (Triggering Player)
    • Set TUnit = (Triggering Unit)
    • Set TInt = (Player Number of TPlayer)
    • Set TSkill = Dark Ritual
    • Set TForce = PlayerGroup(TPlayer)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of TSkill Equal to 0)
      • (TInt less than 4)
    • Then - Actions
      • Unit - Add TSkill to TUnit
      • Set SkillQ[TInt] = (SkillQ[TInt] + 1)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TSkill for TUnit) Less than 10
      • Then - Actions
        • Unit - Increase level of TSkill for TUnit
      • Else - Actions
        • Game - Display to TFoce for 5.00 seconds the text: You can´t get your...
        • Player - Add 100 to TPlayer Current lumber
    • Custom script: call DestroyForce(udg_TForce)

this doesnt make much sense since it doesn't work
 
Last edited:
Status
Not open for further replies.
Back
Top