• 🏆 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!

Variables - Determining the type you need.

Status
Not open for further replies.
Level 1
Joined
Jan 26, 2011
Messages
3
I hate to start up my first post with a question, but I need to understand this. I have a basic understanding of programming logic and I only worked in Pascal.

The problem I run into the most often in WE is determining which variable type I am able to use. "No generated variable of this type exists".

Example:
Why can't I use a variable "MaxHealth" of type Integer that stores a unit's maximum health in order to be used in the following instruction?
  • Events
    • Unit - Unit's life becomes Less than or equal to ((MaxHealth)/2.00)
I need a way to determine the type of variable I am allowed to use in certain situations.
 
Maximum health is normally an integer number, you won't see a unit bearing "342.90" as maximum health, it's just turned internally into a real number/value, so that you don't continuously mess up with integer conversions.

So, when you are going to place the max health/2 function, scroll to "Unit - Unit property" and find "Maximum life" of (Unit).
By default, this action accepts real values. If you want to convert values, there is some conversion method of converting reals <-> strings/integers and the other way around.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
A basic programming language will teach us 4 basic knowledge which is:

- String -> A sequence of character which ranging from A-Z , Symbols , etc
Example: Jason , CoW , !!!!@@@!###

- Boolean -> A value that is known as TRUE/FALSE | ON/OFF | 1/0
Example:
  • [If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Boolean Equal to True
    • Then - Actions
      • Trigger - Turn on (This trigger)
    • Else - Actions
      • Trigger - Turn off (This trigger)
- Integer -> Digit(s) which has no fractional parts
Example: 3 , 470 , 23 , 900

- Double (or known as Real in Trigger Editor) -> Digit(s) that has fractional parts
Example: 2.78 , 0.03 , 7564.90
 
Status
Not open for further replies.
Top