Spellcraft Spell's orbs

jarekpl12

TH.net Regular
Reaction score
6
hello Everyone... can somone give me a tip how to add/increase lvl of ability from 3 the same orbs or with 2 the same? I mean how to check it in conditions...thx
 

jarekpl12

TH.net Regular
Reaction score
6
ok I explained not too good. How to check in conditions that hero has 3 items of the same type
For example

PHP:
Flamestrike
Events  Unit - A unit Recives an Item
Conditions  (Item-type of (Item being manipulated)) Equal to |cffFF4500Fire|r
and here i need some condition that checks number of items of type |cffFF4500Fire|r
because an Action needs 3 the same items 
Actions
 

keychup

Active Member
Reaction score
34
a unit receives an item

set INTEGERX = 0
for each integer A from 1 to 6
-if item in slot integer A is equal to orb
-then set INTEGERX = INTEGERX +1
-else do nothing
set level of ability for triggering unit to INTEGERX

INTEGERX is a variable of type "integer"
 

jarekpl12

TH.net Regular
Reaction score
6
a unit receives an item

set INTEGERX = 0
for each integer A from 1 to 6
-if item in slot integer A is equal to orb
-then set INTEGERX = INTEGERX +1
-else do nothing
set level of ability for triggering unit to INTEGERX

INTEGERX is a variable of type "integer"


Something like this? Or it will have some bugs?... Im wondering what gonna happend if 2 heros wear the same item around the same time.. i mean untill the trigger ends

Code:
Flamestrike
  Events  Unit - A unit Recives an item
  Conditions  (Item-type of (Item being manipulated)) equal to |cffFF4500Fire|r
  Actions Set Orb = 0
For each (Integer A) from 1 to 6, do (Actions)
  Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  If - Conditions
  (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to |cffFF4500Fire|r
  Then - Actions Set Orb = (Orb + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  If - Conditions  (Level of Flamestrike (Neutral Hostile) for (Triggering unit)) equal to 0
  Then - Actions  Unit - Add Flamestrike (Neutral Hostile) to (Triggering unit)
  Else - Actions  Unit - Increase level of Flamestrike (Neutral Hostile) for (Triggering unit)
  Else - Actions
 

denmax

You can change this now in User CP.
Reaction score
155
It works on multiple units, and even if it didn't, the possiblity of two heroes receiving such item in the EXACT SAME MILLISECOND seems too impossible.

What your trigger does right now is actually pretty pointless in adding the for loop. The reason is because you're not using the integer variable Orb.

So you want your hero to receive an ability when he has two Fire Orbs, and another ability if he has three Fire Orbs.

Use that same loop on your actions
Trigger:
  • D
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to Fire
          • Then - Actions
            • Set Orb = (Orb + 1)
          • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Orb is Greater than or equal to 2
        • Then - Actions
          • Unit - Add Flamestrike to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Orb is Greater than or equal to 3
        • Then - Actions
          • Unit - Add Volcano to (Triggering unit)
          • Unit - Increase level of Flamestrike for (Triggering unit)
        • Else - Actions
 

jarekpl12

TH.net Regular
Reaction score
6
nono... i want to add ability (if there is no such an ability yet) or increase lvl of following ability (if there is such an ability). I have 7 kinds of orbs and every combination gives diferent ability. For example 3 Fire Orbs give Flamestrike ability or 2 Fire Orbs and 1 Earth Orb give for example Entanglin Roots

Here is my trigger to add (increase lvl of) spell with 3 DIFERENT orbs... This is easy, my problem is to do the same thing with checking if Triggering Unit has 3 the same orbs or 2 the same orbs and 1 diferent orb:
Code:
Flamestrike
    Events
        Unit - A unit Recives an item
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Item-type of (Item being manipulated)) equal to |cffFF4500Fire|r
                (Item-type of (Item being manipulated)) equal to |cffFFFF66Light|r
                (Item-type of (Item being manipulated)) equal to |cff0000FFWater|r
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) has an item of type |cffFF4500Fire|r) equal to True
                ((Triggering unit) has an item of type |cffFFFF66Light|r) equal to True
                ((Triggering unit) has an item of type |cff0000FFWater|r) equal to True
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Flamestrike (Neutral Hostile) for (Triggering unit)) equal to 0
                    Then - Actions
                        Unit - Add Flamestrike (Neutral Hostile) to (Triggering unit)
                        Item - Remove (Item carried by (Triggering unit) of type |cffFF4500Fire|r)
                        Item - Remove (Item carried by (Triggering unit) of type |cffFFFF66Light|r)
                        Item - Remove (Item carried by (Triggering unit) of type |cff0000FFWater|r)
                    Else - Actions
                        Unit - Increase level of Flamestrike (Neutral Hostile) for (Triggering unit)
                        Item - Remove (Item carried by (Triggering unit) of type |cffFF4500Fire|r)
                        Item - Remove (Item carried by (Triggering unit) of type |cffFFFF66Light|r)
                        Item - Remove (Item carried by (Triggering unit) of type |cff0000FFWater|r)
            Else - Actions
 

keychup

Active Member
Reaction score
34
interesting. should have said so earlier.
it's definitely doable.
write down each and every orb, and spells with their corresponding orb combination.
please note that you can have only 2 abilities max if you choose to use the inventory as a reference.
 

denmax

You can change this now in User CP.
Reaction score
155

I think you just said that without actually understanding what my code did, because technically it would have potentially solved your problem already :/

Copy my code, and remove the first If-Then-Else (the one with the condition - Orbs is Greater than or equal to 2), change Volcano to Flame Strike, and remove the Increase level.
 

jarekpl12

TH.net Regular
Reaction score
6
I think you just said that without actually understanding what my code did, because technically it would have potentially solved your problem already :/

Copy my code, and remove the first If-Then-Else (the one with the condition - Orbs is Greater than or equal to 2), change Volcano to Flame Strike, and remove the Increase level.

y u right... I can't understeand this function: For each (Integer A) from 1 to 6, do (Actions)

ok I'll try... thx
 

jarekpl12

TH.net Regular
Reaction score
6
now the trigger adds ability after i pick up 2 orbs and after i pick 3rd orb level of ability is increased to 5

interesting. should have said so earlier.
it's definitely doable.
write down each and every orb, and spells with their corresponding orb combination.
please note that you can have only 2 abilities max if you choose to use the inventory as a reference.
Fire, Water, Earth, Storm, Energy, Light, Dark
 

Attachments

  • Spells.txt
    2.7 KB · Views: 283

vypur85

Hibernate
Reaction score
803
Understand denmax's trigger. The idea is there. That is how you detect multiple items. From post#7, you seemed to be quite well verse with triggers (unless, of course, the trigger was not made by you).

The idea is to calculate how many similar items you have in the hero inventory. And then decide if the unit has multiple items or not. Hence the 1 to 6 integer loop. Understand the trigger given and apply it to your map. And if there's any trigger problem, please post your most current trigger when you ask your next question (as how you did in post#7).
 

keychup

Active Member
Reaction score
34
Sorry I haven't come online for a while. I'll look into your spells when I get home from school. It looks like an invoke-type set of triggers can take care of this. I'll let you know as soon as I get something done.
 

jarekpl12

TH.net Regular
Reaction score
6
this is my last progress: when i buy 1st Fire orb - Flamestrike lvl 1, then i buy 2nd Fire orb - Flamestrike lvl 5 :(



Code:
Flamestrike
    Events
        Unit - A unit Recives an item
    Conditions
        (Item-type of (Item being manipulated)) equal to |cffFF4500Fire|r
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to |cffFF4500Fire|r
                    Then - Actions
                        Set Orb = (Orb + 1)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Orb equal to 3
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Flamestrike (Neutral Hostile) for (Triggering unit)) equa; to                  Then - Actions
                                Unit - Add Flamestrike (Neutral Hostile) to (Triggering unit)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Codnitions
                                        (Level of Flamestrike (Neutral Hostile) for (Triggering unit)) less than 5
                                    Then - Actions
                                        Unit - Increase level of Flamestrike (Neutral Hostile) for (Triggering unit)
                                Else - Actions
 

vypur85

Hibernate
Reaction score
803
The pasted trigger seems a bit off. But remove the second if then else out of the integer loop. And set the integer value to 0 at the beginning of the trigger.

Code:
Set Orb = 0
For each (Integer A) from 1 to 6, do (Actions)
  Loop - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
          (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to |cffFF4500Fire|r
      Then - Actions
          Set Orb = (Orb + 1)
      Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        Orb equal to 3
    Then - Actions
        ......
 

keychup

Active Member
Reaction score
34
hold on, so the idea is to pick up 1 fire orb to get 1 ability and pick up a second orb to upgrade it? i thought you had to combine 3 orbs to get a spell.

Please wait for my trigger. I can handle all the abilities.
 

vypur85

Hibernate
Reaction score
803
> so the idea is to pick up 1 fire orb to get 1 ability and pick up a second orb to upgrade it?
Refer to the trigger in post#7. Combined orbs give either the ability or level up. If you 5 different kind of orbs, there are about 12 different combinations, if I'm correct.
 

keychup

Active Member
Reaction score
34
Unfortunately you will not be able to use my trigger to upgrade your spells. You cannot obtain, for example, Flamestrike without 3 flame orbs. If you do have Flamestrike, picking up another orb will only determine the second ability, not upgrade the first. If you want an ability to be upgraded, however, you can implement the Upgrades in the object editor and research the ability directly.
These are the variables you'll be needing:

HASHTABLE: Hashtable Type, No Arrays
ABILITY []: Ability Type, 82 Arrays
ORB1: Integer Type, No Arrays
ORB2: Integer Type No Arrays

First you need to create a hashtable then you need to store all the abilities in ABILITY []

Trigger 1:
Event
Elapsed Game Time is 0 seconds
Conditions
None
Actions
Create a Hashtable
Set HASHTABLE = Last Created Hashtable
Set ABILITY [3] = Flamestrike
Set ABILITY [12] = Rain of Fire
Set ABILITY [102] = Endurance Aura
Set ABILITY [1002] = Shockwave
Set ABILITY [10002] = Fire Bolt
...

Refer to this table for the complete list of spell codes:

COMBINATION ---------- Ability ------------- Code

FIRE FIRE FIRE ------- Flamestrike --------- 3
FIRE FIRE WATER ------ Rain of Fire -------- 12
FIRE FIRE EARTH ------ Endurance Aura ------ 102
FIRE FIRE STORM ------ Shockwave ----------- 1002
FIRE FIRE ENERGY ----- Fire Bolt ----------- 10002
FIRE FIRE LIGHT ------ Breath of Fire ------ 100002
FIRE FIRE DARK ------- Immolation ---------- 1000002

WATER WATER WATER ---- Crushing Wave ------- 30
WATER WATER FIRE ----- Water Elemental ----- 21
WATER WATER EARTH ---- Brilliance Aura ----- 120
WATER WATER STORM ---- Blizzard ------------ 1020
WATER WATER ENERGY --- Frost Bolt ---------- 10020
WATER WATER LIGHT ---- Breath of Frost ----- 100020
WATER WATER DARK ----- Frost Nova ---------- 1000020

EARTH EARTH EARTH ---- Entangling Roots ---- 300
EARTH EARTH FIRE ----- Faerie Fire --------- 201
EARTH EARTH WATER ---- Force of Nature ----- 210
EARTH EARTH STORM ---- Fan of Knives ------- 1200
EARTH EARTH ENERGY --- Thorns Aura --------- 10200
EARTH EARTH LIGHT ---- Abolish Magic ------- 100200
EARTH EARTH DARK ----- Shadow Strike ------- 1000200

STORM STORM STORM ---- Chain Lightning ----- 3000
STORM STORM FIRE ----- Thunder Clap -------- 2001
STORM STORM WATER ---- Forked Lightning ---- 2010
STORM STORM EARTH ---- Lightning Shield ---- 2100
STORM STORM ENERGY --- Statis Trap --------- 12000
STORM STORM LIGHT ---- Storm Bolt ---------- 10200
STORM STORM DARK ----- Serpent Ward -------- 1002000

ENERGY ENERGY ENERGY - Polymorph ----------- 30000
ENERGY ENERGY FIRE --- Searing Arrows ------ 20001
ENERGY ENERGY WATER -- Cold Arrows --------- 20010
ENERGY ENERGY EARTH -- Slow Poison --------- 20100
ENERGY ENERGY STORM -- Bear ---------------- 21000
ENERGY ENERGY LIGHT -- Evasion ------------- 120000
ENERGY ENERGY DARK --- Curse --------------- 1020000

LIGHT LIGHT LIGHT ---- Holy Light ---------- 300000
LIGHT LIGHT FIRE ----- Inner Fire ---------- 200001
LIGHT LIGHT WATER ---- Heal ---------------- 200010
LIGHT LIGHT EARTH ---- Rejuvenation -------- 200100
LIGHT LIGHT STORM ---- Hardend Skin -------- 201000
LIGHT LIGHT ENERGY --- Healing Ward -------- 210000
LIGHT LIGHT DARK ----- Banish -------------- 1200000

DARK DARK DARK ------- Death Coil ---------- 3000000
DARK DARK FIRE ------- Unholy Aura --------- 2000001
DARK DARK WATER ------ Sleep --------------- 2000010
DARK DARK EARTH ------ Raise Death --------- 2000100
DARK DARK STORM ------ Unholy Frenzy ------- 2001000
DARK DARK ENERGY ----- Impale -------------- 2010000
DARK DARK LIGHT ------ Cripple ------------- 2100000

FIRE WATER EARTH ----- Cyclone ------------- 111
FIRE WATER STORM ----- Slow ---------------- 1011
FIRE WATER ENERGY ---- Spell Steal --------- 10011
FIRE WATER LIGHT ----- Healing Wave -------- 100011
FIRE WATER DARK ------ Mana Burn ----------- 1000011

FIRE EARTH STORM ----- Feral Spirit -------- 1101
FIRE EARTH ENERGY ---- Critical Strike ----- 10101
FIRE EARTH LIGHT ----- Trueshot Aura ------- 100101
FIRE EARTH DARK ------ Envenomed Weapons --- 1000101

FIRE STORM ENERGY ---- Pulverize ----------- 11001
FIRE STORM LIGHT ----- Command Aura -------- 101001
FIRE STORM DARK ------ Bloodlust ----------- 1001001

FIRE ENERGY LIGHT ---- Shackless ----------- 110001
FIRE ENERGY DARK ----- Spiked Carapace ----- 1010001

FIRE LIGHT DARK ------ Feedback ------------ 1100001

WATER EARTH STORM ---- Mana Shield --------- 1110
WATER EARTH ENERGY --- Mirror Image -------- 10110
WATER EARTH LIGHT ---- Life Drain ---------- 100110
WATER EARTH DARK ----- Cleaving Attack ----- 1000110

WATER STORM ENERGY --- Parasite ------------ 11010
WATER STORM LIGHT ---- Devotion Aura ------- 101010
WATER STORM DARK ----- Acid Bomb ----------- 1001010

WATER ENERGY LIGHT --- Bash ---------------- 110010
WATER ENERGY DARK ---- Mana Drain ---------- 1010010

WATER LIGHT DARK ----- Frost Armor --------- 1100010

EARTH STORM ENERGY --- War Stomp ----------- 11100
EARTH STORM LIGHT ---- Barrage ------------- 101100
EARTH STORM DARK ----- Hex ----------------- 1001100

EARTH ENERGY LIGHT --- Drunken Haze -------- 110100
EARTH ENERGY DARK ---- Carrion Beetles ----- 1010100

EARTH LIGHT DARK ----- Roar ---------------- 1100100

STORM ENERGY LIGHT --- Wind Walk ----------- 111000
STORM ENERGY DARK ---- Orb of Annihilation - 1011000

STORM LIGHT DARK ----- Vampiric Aura ------- 1101000

ENERGY LIGHT DARK ---- Essence of Blight --- 1110000

Now this next trigger is what you will use to change the abilities

Trigger 2:
Event
A unit acquires an item
Conditions
None
Actions
-----FIRST ABILITY-----
Set ORB1 = (Load (Get String ID Key ORB1) of (Key (Triggering unit)) from (HASHTABLE))
Remove ABILITY [ORB1] from (Triggering unit)
Set ORB1 = 0
For Each Integer from 1 to 3
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to FIRE Then Set ORB1 = (ORB1 + 1) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to WATER Then Set ORB1 = (ORB1 + 10) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to EARTH Then Set ORB1 = (ORB1 + 100) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to STORM Then Set ORB1 = (ORB1 + 1000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to ENERGY Then Set ORB1 = (ORB1 + 10000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to LIGHT Then Set ORB1 = (ORB1 + 100000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to DARK Then Set ORB1 = (ORB1 + 1000000) Else Do Nothing
Add ABILITY [ORB1] to (Triggering unit)
Hashtable - Save ORB1 as ( Get String ID Key ORB1) of (Key (Triggering unit)) in HASHTABLE
-----SECOND ABILITY-----
Set ORB2 = (Load (Get String ID Key ORB2) of (Key (Triggering unit)) from (HASHTABLE))
Remove ABILITY [ORB2] from (Triggering unit)
Set ORB2 = 0
For Each Integer from 4 to 6
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to FIRE Then Set ORB2 = (ORB2 + 1) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to WATER Then Set ORB2 = (ORB2 + 10) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to EARTH Then Set ORB2 = (ORB2 + 100) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to STORM Then Set ORB2 = (ORB2 + 1000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to ENERGY Then Set ORB2 = (ORB2 + 10000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to LIGHT Then Set ORB2 = (ORB2 + 100000) Else Do Nothing
If Item-type of (Item carried by (Triggering unit) in slot (Integer A))) equal to DARK Then Set ORB2 = (ORB2 + 1000000) Else Do Nothing
Add ABILITY [ORB2] to (Triggering unit)
Hashtable - Save ORB2 as ( Get String ID Key ORB2) of (Key (Triggering unit)) in HASHTABLE
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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