Struggling to learn variables..

kasilopana

New Member
Reaction score
1
Ey everybody =)

It've been some time now, and I'm still struggling when it comes to variables..

I've read tons of guides/tutorials, but can't seem to fully understand it, and make it work.

- How did you guys manage to learn about variables? and how long did it take you to like.. Fully understand it, and use it?

I just think it would be a lot easier for me if I had someone to explain it to me In real life, but none of my friends likes the editor, so no help from them :(

(Sorry for my english, my main language is danish)
 

drak_dragon

New Member
Reaction score
6
well, I don't quite understand what you're after. I understand them pretty well, each has its own properties and limitations, and situations you are allowed to use them in. What exactly are you having trouble with?
 

kasilopana

New Member
Reaction score
1
well, I don't quite understand what you're after. I understand them pretty well, each has its own properties and limitations, and situations you are allowed to use them in. What exactly are you having trouble with?

Variables in general... Like.. When I take a look at you guys' triggers.. I just think "How the hell did they do that" Though I did make these for my TD today! :eek: (Stored Lives)

Trigger:
  • Unit dies
    • Events
      • Unit - A unit enters Left side South Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Unit - Kill (Triggering unit)
      • Set Lost_life = (Lost_life - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: (String(Lost_life))
          • Game - Display to Player Group - Player 2 (Blue) the text: (String(Lost_life))
        • Else - Actions



Trigger:
  • Dead checker
    • Events
      • Unit - A unit enters Left side South Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Lost_life Equal to 0
        • Then - Actions
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 2 (Blue) with the message: Defeat!
          • Game - Display to (All players) the text: Team 1 has been def...
        • Else - Actions
          • Do nothing
 

drak_dragon

New Member
Reaction score
6
the only other thing i could tell you to do is look at some maps that are open for anyone to peek inside, and see how they work. beyond the tutorial I linked you, the rest is just a little complex for me to explain without going into deep details, probably because it's like second nature. If you can get 'hold of me through the method I proposed you, then possibly I could explain it to you there. Its.... complicated. I'd say just look up typical programming guides and search for how variables work - theyre pretty much the same logic, its just that the words are different? :p
 

kasilopana

New Member
Reaction score
1
the only other thing i could tell you to do is look at some maps that are open for anyone to peek inside, and see how they work. beyond the tutorial I linked you, the rest is just a little complex for me to explain without going into deep details, probably because it's like second nature. If you can get 'hold of me through the method I proposed you, then possibly I could explain it to you there. Its.... complicated. I'd say just look up typical programming guides and search for how variables work - theyre pretty much the same logic, its just that the words are different? :p

How did you manage to learn variables? Just got to it over time? Read some guides? Made a 100 maps? ;)
 

drak_dragon

New Member
Reaction score
6
How did you manage to learn variables? Just got to it over time? Read some guides? Made a 100 maps? ;)

well, i've been programming since i was like 11. had an old TI 83+, loved that thing. Using variables now is just second nature to me :x

just think of variables as tokens to hold information in that you wish to call later on. like, if you want to ask "okay, can I cross the bridge because its built?" you'd have a variable called BridgeBuilt, and it would be boolean (true or false) and would tell whether the bridge is built, or if it is still broken.

this is starting to get lengthy and make little progression. I'd be happy to help you more, but probably in private messages or in msn so it doesnt flood the board with bumps on this.
 

niceone

New Member
Reaction score
3
I never knew what variables where...

Till the day I started C# scripting. And now I don't understand WHY I didn't understand them xD

But its quite simple a variable is something that stays the same the whole game unless you change it.

So if you set a variable at start to like 100 after 2 hours play it will still be 100 :)

Variables aren't bound to a single trigger so when 1 trigger changes its value the other trigger will directly use that new value.

Like in your thing

Set Lost_life = (Lost_life - 1)

at start you set the life to a value (like 50)

Then trought that one you will deduct 1 from it everytime that trigger is called.

But it won't say that your game ends when it hits 0 you will need to check it somewhere in an other trigger if it is less or equal to 0 to have it end a game.

So you can just keep the "variable" in a simple spot and you can call it from everywhere.

(If you do any scripting language a variable would ba a public field :))
 

Tyman2007

Ya Rly >.
Reaction score
74
Variables can be complicated to some, but should not be attempted by someone who is not used to math and storing things properly.
I suggest looking at your floor and counting how many things you can put into a better place :p

Variables are more for organizing and communicating data easier. Say if I REALLY wanted to bring a string, say "Hello" over to another trigger, the variable is like a tiny man that runs at light speed and can carry up to 8192 pounds (that's how many instances you can be running at a time, don't bother knowing this it's not important for you right now) that delivers the string from place to place.

How did I learn about variables? Simply put I learned about them in algebra. There is little difference between the variables you use in math and the variables you use in WC3.

For instance, the variables in WC3 can hold much more than 1 thing and many different types of things, while the variables in math can only hold a real.

If you've taken an algebra course, then that would help. Variables are pretty much 2nd nature to me. I read no guide on them to get my abilities. If you can learn to associate numbers with letters, you're one step closer :p
 

Inflicted

Currently inactive
Reaction score
63
How did you guys manage to learn about variables?

haha i just one day got bored and messed around with the editor and figured out what everything does. just try and see what everything says, most things are self explanetory
 
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