• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

New to GUI Question

Status
Not open for further replies.
Level 4
Joined
Dec 6, 2009
Messages
75
Hey guys, i'm new to the hive and pretty new to triggers and such, i know some stuff but i'm by no means good yet.

This talk of integers and variables confuses me to no end, i've read tutorials on the site already but it still confuses me.

Could someone with the time please break these 2 things down for me as i have already tried to read tutorials and i still don't learn anything
 
Level 12
Joined
Feb 23, 2008
Messages
587
Sure, And I understand why. As its hard for 1 too make the tutorials work for every skill level. And I think the biggest reason is alot of them go into so much depth that missing the point can be easy.

Variables


Basically a variable is something the computer can hold information.
Like for example your Total_Kills could be variable. Its called a Variable because it can change.

Integers

A Integer is a type of variable. That can hold a number. But not a fraction of a number. So you could save 5 in it or 5000 but not 5.5. If you try to divide a integer by 2 it cuts off the reminder. like 5/2 = 2. not 2.5.

Putin it all together

So In the world editor, once you have a map opened. you can click the A for triggers. and then a X for variables. X is a common name for variable. Like in math class.
In warcraft there are alot of different variable types. Look at them in there.
You have to use triggers use the variables but that's going a bit father then you asked.

Did this help?
 
Level 4
Joined
Dec 6, 2009
Messages
75
Thank's a lot for stopping by to help me out here friend, you have no idea how much it means to me and how easier it makes it for me when someone like yourself stops by to lend a hand.

That did help and i think i have it down, so like this


Variables

A variable is a piece of information that the game can hold in memory, like, who has the most kills on the leaderboard and such

Integers

An integer is a type of variable that can hold numbers. but only by 5's?


so i understand where Variables come in, but i do not have any idea why there would be integers when we have something more efficient such as an Variable

Clarification is needed :razz:
 
Level 12
Joined
Feb 23, 2008
Messages
587
An integer is a type of variable that can hold numbers. No I meant it cant have a fraction. like 1.1 or 1.5. It can only store hole numbers that are positive or negative.

There are variables that can store numbers with fractions, But a Integer isn't one of them.

For Example a variable of type "Real" can.

A Variable has to have a type. like Integer, or Unit ect.
There is no such thing as a variable with out a type, like Integer.

Is that clear?
 
Level 4
Joined
Dec 6, 2009
Messages
75
Not really, can you give me some examples of an Integer in practice?

I can see why this would be frustrating for you, most people don't have the patience required to actually show how stuff like this work's
 
Level 12
Joined
Feb 23, 2008
Messages
587
Of a Variable Of Type Integer you mean.

Integers in warcraft are variables. They are a type of variable.


This is a trigger, that gos off when someone dies. If player 1 was the person to kill that unit, then hes TotalKills gos up by one. TotalKills is a integer Or said another way a variable of type integer. .
  • Total Kills
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set TotalKills = (TotalKills + 1)
A Integer is a Variable.

One type of variable is a Integer

That make sense?
 
Level 4
Joined
Dec 6, 2009
Messages
75
^ Yep that makes sense, i getcha

Variables are scores of information held within the game

Integers are the type of score of information held within the game, no?
 
Level 7
Joined
May 3, 2007
Messages
210
You could think of it as a variable being a box. An integer being an object placed inside that box.

However, each type of variable is a specifically shaped box, to which only certain objects can fit. Imagine a babys toy, where there are many holes with different shapes, circles, squares, and objects that he learns to put threw those holes.

An integer variable, is a box that holds only integers. Likewise, a real variable is a box that holds only reals.

Once you understand this, the only problem is understand what the types actually are.
As said before, an integer is just the whole number line, were a real is any number with a decimal. A unit variable is just a unit reference, a string variable is just a string of letters.

Hope that helped a little.
 
Level 4
Joined
Dec 6, 2009
Messages
75
I get what variables are now, their just scores of information that can change hence the name, e.g Kill Scores, Number of buildings lost, Number of Units, Number of deaths etc

But integers, they are also variables but different types?

more info on integers is needed


EDIT: What would be the best way for me to get this integer - reals whatever stuff down? as i see it is quite neccasery for mods, perhaps you both know of a few activities i could partake in or maybe you could link more trigger screens to give me a better idea
 
Level 12
Joined
Feb 23, 2008
Messages
587
A Variable has to have a type. Integer is just a type it can be.

In Warcraft if you want a variable you have to declare of a certain type.

Here are some samples of different variable types.

Example 1 - Integers
Variable of type Integer Type. Stores a number.

Here is a trigger, using a integer. Once you get 50 kills you win! But if you get 50 deaths you lose.

  • Total Kills
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set TotalKills = (TotalKills + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TotalKills Equal to 50
        • Then - Actions
          • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
        • Else - Actions
  • Total Deaths
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Matching unit)) Equal to Player 1 (Red)
    • Actions
      • Set TotalDeaths = (TotalDeaths + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TotalDeaths Equal to 50
        • Then - Actions
          • Game - Defeat Player 1 (Red) with the message: Defeat!
        • Else - Actions
Example 2 - Point
A Point is a variable just like integer. But Its a variable that stores a location.

When a pesent gets atted it orders that unit to run to HomeTown.
Then it sends all near by foot me to attack the attacker.

  • Protect The Pesents
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Peasant
    • Actions
      • Unit - Order (Attacked unit) to Move To HomeTown
      • Unit Group - Order (Units owned by Player 1 (Red) matching ((Unit-type of (Matching unit)) Equal to Footman)) to Attack (Attacking unit)
Your best bet at this point is to open the world editor and try to make a extremely basic map. Prehaps make a map with a Footmen and 10 sheep. Try to set it up so after the footmen kills 10 sheep that you win the game. That will be a great start.

Was this helpful?
 
Level 4
Joined
Dec 6, 2009
Messages
75
To Rover2341


Thank's for the help, can i come to you to ask any future questions?, since you have already aided me here it will be easier going if i ask you something next time.


To Manstie


Thank you, i will keep that in mind when i make something next, i assume if i use ''Do Nothing'' it will cause 'leaks'?.
 
Level 4
Joined
Dec 6, 2009
Messages
75
Ok so i tried the suggestion of making a footman kill 10 chickens so you win the game, i messed up and now when i hit a chick i win the game, DO NOT WANT

i'll upload the map for you guys to take a look and perhaps you'll be able to tell me my error, i had a go at making my own integer and i think that is where i messed up, i don't know for sure


but instead of killing 10 chickens and winning, i have to merely attack a chicken once to win, map up
 

Attachments

  • Spells map.w3x
    22.4 KB · Views: 31
Level 37
Joined
Mar 6, 2006
Messages
9,240
Use trigger tags to post the code, not many people are willing to download a map.

[TRIGGER]Code goes here[/TRIGGER]

So it looks like this:
  • ChickenKill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Chicken
    • Actions
      • Set TotalDeaths[(Player number of (Owner of (Killing unit)))] = TotalDeaths[(Player number of (Owner of (Killing unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TotalDeaths[(Player number of (Owner of (Killing unit)))] Equal to 10
        • Then - Actions
          • Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores)
        • Else - Actions
This makes the trigger to work for all players, not just for player 1. What you did wrong was you set the value to 10 at the end of the trigger, you should set it to value = value + 1 at the beginning of the trigger.
 
Last edited:
Level 4
Joined
Dec 6, 2009
Messages
75
Maker, can you tell me why i have to make that change?

As in, what does it change that makes the objective into scoring ten kills, i find i learn best if i get told both how something works and why
 
Level 3
Joined
Apr 29, 2009
Messages
32
1. I suppose you don't want to give the player 10 kills if he only killed 1 unit.
2. The reason due to that you have to set the action
  • Set TotalDeaths = TotalDeaths + 1
at the beginning of the trigger is that if you do the
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TotalDeaths Equal to 10
    • Then - Actions
      • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
    • Else - Actions
before this won't really happen, since the integer value still haven't changed.
 
Level 12
Joined
Feb 23, 2008
Messages
587
Was what they said clear to you? If not ill take a look at the map you put up, and give you a suggestion.
If you finish that project. Put it up on a post. Once its fully working we can move on. If you still need help then let me know.

Ill give you a another, harder project but will help you learn alot if your able to do it. I believe the best way to learn is by doing, but ill answer any questions you have either here or private message. Here would likely be best though, so others can help also, but feel free to private msg me to tell me your stuck.
 
Level 4
Joined
Dec 6, 2009
Messages
75
Thank's a lot rover, your ideas are welcome after i am done with this project and then once you've had a look at that we can move on, cheers brother, i'll be working on it for awhile today :cool:



Ok huge problem, ever since i updated to the latest patch ages ago i got the blue screen of death and my computer crashed, now most of the time i try to Run wc3 i get this at startup

This application has encountered a critical error:

FATAL ERROR!

Program: C:\Program Files\Warcraft III\War3.exe
Exception: 0xC0000094 (INT_DIVIDE_BY_ZERO) at 001B:6BA786A4

what do you guys make of that? it's stopping me from playing
 
Last edited:
Level 4
Joined
Dec 6, 2009
Messages
75
Hmm, Are you running the map you made? or just trying to open up warcraft. If its your map. post your code. or if you have to attach your map and ill fix it for ya.




Nah it's whenever i start up Warcraft 3, gets me every time so i'm reinstaling now and hopefully it'll fix itself up

Tonght i'm working on the map some more so i'll attach it in here for you to take a look at so far :gg:



EDIT: I've been busy lately, so tomorow if someone would like to see i will post the map, but just if someone asks, no point in posting it if you don't want to take a look
 
Last edited:
Status
Not open for further replies.
Top