• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

need somebody who understand why variable is empty?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
[Solved] need somebody who understand why variable is empty?

when i tame chocobo then i put a number(ability lv of target unit) to a variable (chocobosex[player number]) but when i use a skill on chocobo (Rest ability) then variable suddenly empty.

(u can check if u type '1' in chat)

oh and if i made another mistake then pls tell me

  • Tame Chocobo
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Healing
      • (Owner of (Target unit of ability being cast)) Equal to Neutral Passive
    • Actions
      • Set plNR = (Player number of (Owner of (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Chocobo
          • ((Casting unit) is A Hero) Equal to True
          • (Percentage life of (Target unit of ability being cast)) Greater than or equal to 99.00
          • (ChocoboSex[(Player number of (Owner of (Triggering unit)))] Not equal to 3) and (ChocoboSex[(Player number of (Owner of (Triggering unit)))] Not equal to (Level of Chocobo Sex for (Target unit of ability being cast)))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Chocobo1[plNR] Equal to No unit
            • Then - Actions
              • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
              • Set ChocoboSex[plNR] = (ChocoboSex[plNR] + (Level of Chocobo Sex for (Target unit of ability being cast)))
              • Set Chocobo1[plNR] = (Target unit of ability being cast)
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You caught this a c...
              • Unit - Remove Wander (Neutral) from (Target unit of ability being cast)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Chocobo2[plNR] Equal to No unit
                • Then - Actions
                  • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
                  • Set ChocoboSex[plNR] = (ChocoboSex[plNR] + (Level of Chocobo Sex for (Target unit of ability being cast)))
                  • Set Chocobo2[plNR] = (Target unit of ability being cast)
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You caught this a c...
                  • Unit - Remove Wander (Neutral) from (Target unit of ability being cast)
                • Else - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You cant tame this ...
        • Else - Actions
  • Rest
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Rest
    • Actions
      • Set TempPoint = (Random point in ChocoboStable <gen>)
      • Unit - Move (Triggering unit) instantly to TempPoint
      • Unit - Change ownership of (Triggering unit) to Player 12 (Brown) and Change color
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Unit - Add Wander (Neutral) to (Triggering unit)
      • Game - Display to (All players) the text: (Name of Chocobo1[(Player number of (Owner of (Triggering unit)))])
      • Game - Display to (All players) the text: (Name of Chocobo1[(Player number of (Owner of (Triggering unit)))])
 

Attachments

  • 1_new.w3x
    132.1 KB · Views: 78
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- You can always use "Triggering Player" for "(Owner of (Triggering Unit))". Works better.
  • Set plNR = (Player number of (Triggering Player)
2- If you're using the same unit (Target Unit of Ability Being Cast) several times, declare it into a variable and use the variable instead, is better, and faster (for you and for the system).
  • Set Unit1 = (Target unit of Ability being cast)
Do this on the beginning of the actions.

3- You declared "plNR" but didn't used it some times.
  • (ChocoboSex[plNR] Not equal to 3) and (ChocoboSex[(plNR] Not equal to (Level of Chocobo Sex for Unit1)
4- You're using "Chobo1[plNR]" and "Chocobo2[plNR]" for the same unit, inside the "then", and in the "Else"; there's not need for that. You can use the same variable.

5- Player Group(...) leaks.
  • Set Force = Player Group(...)
  • Game - Display to Force the text ...
  • Custom script: call DestroyForce(udg_Force)

So far, I don't get the real problem here. When Chocobo rests the ownership is changed, means the player losses his chocobo.

Sorry if I missunderstood something. Try giving more details about what you want to achieve.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
So far, I don't get the real problem here. When Chocobo rests the ownership is changed, means the player losses his chocobo.

yea but if i store a unit to a variable and change unit owner then unit still in variable but after i changed owner in Rest trigger chocobo[PlNr] is empty and idk why, i can call back with Call trigger

Problem is unit disapear from variable :/

i need 2 chocobo variable array because every player could tame 2 chocobo not 1

4.
if chocobo1 variable is not empty then its store to 2nd variable the ability target unit

i dont got why when i use the skill then the game think i used the different ability.

SO i got 2 skill, both based on slam unit skill, 1 ability with 'Rest' name and 1 with 'Free' name, when i use rest skill thengame think its the another skill :/

  • Release
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Free
    • Actions
      • Set plNR = (Player number of (Owner of (Triggering unit)))
      • Set ChocoboSex[plNR] = (ChocoboSex[plNR] - (Level of Chocobo Sex for (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chocobo1[plNR] Equal to (Triggering unit)
        • Then - Actions
          • Set Chocobo1[plNR] = No unit
        • Else - Actions
          • Set Chocobo2[plNR] = No unit
      • Unit - Add Wander (Neutral) to (Triggering unit)
      • Unit - Change ownership of (Triggering unit) to Neutral Passive and Retain color
      • Set TempPoint = (Random point in Chocobo Spawn <gen>)
      • Unit - Move (Triggering unit) instantly to TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 12
Joined
Oct 16, 2010
Messages
680
umm i see now, that is a rule.... if u use for 2 spells the same base spell
then both of them will have the same order id
means if u cast one of them the game will recognize that u used both the spells

so basically as soon as u send Boco to rest u release it.

you need to use an other spell for one of them

TIP: Most useful dummy ability is "Chanel" since it dose nothing
u just need to set it to visible and chose a base order id for it that no other ability uses
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
See? That's the important thing about giving details.

What Lender said is the solution. Use Channel ability, customize it however you want, and use different order strings for both spells. Units can't have two skills at the same time, both having the same order ID.

Channel is default wc3 dummy ability used only to trigger effects, and allows a lot of customizations.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
so rule is i cant have 2 ability with same order on same unit?

then why i have this problem after i changed the order string?
 

Attachments

  • new.JPG
    new.JPG
    99.2 KB · Views: 62
Level 20
Joined
Jul 14, 2011
Messages
3,213
Is not only "Order String"... also "Base Ability ID".

You can check "Spellbook" and "Channel Ability". Both have a field that reads: "Base Ability ID" or something like that.

Default WC3 skills already have their Base Ability ID, channel and spellbook are the only ones that allow you to modify the ability ID, it's basicaly, and ability that works with some other ability ID
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Is not only "Order String"... also "Base Ability ID".

You can check "Spellbook" and "Channel Ability". Both have a field that reads: "Base Ability ID" or something like that.

Default WC3 skills already have their Base Ability ID, channel and spellbook are the only ones that allow you to modify the ability ID, it's basicaly, and ability that works with some other ability ID

oh now really clear to me :) thx very much your effort for try explain to my stone brain :)
 
Status
Not open for further replies.
Top