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

Variables.. Questions

Status
Not open for further replies.

The Panda

Icon Reviewer
Level 57
Joined
Jun 2, 2008
Messages
8,912
Just started making maps again and I have mine pretty much done, I just need to do all the triggering and such.. I'm wondering how to use or create variables for triggers? I'm just very confused about them.

Also, for whatever reason.. when I place a hero down on the map and try to test it, it crashes and gives me an error? I'm not too sure why..
 
Last edited:
Variables are really great helpers. They do the work simpler and cleaner, and many things just possible.

It's similar like maths variables, with "x" or "y" and so on, they are just placeholders which hold a certain value.
You may name the variables what ever you want, the name alone doesn't really matter -- but it's good if you choose descriptive words. So "a" "b" "c" and so on would not be always good for variable names.

The value that a variable can store depends not on the name, but on the variable type. You define the variable type when you create it.
For example a unit type variable can store units, like heroes. A player type variable can store players like Player 1 / Player 2.

The good thing is, you can assign values to your variable in one trigger, and simply refer to the variable in an other trigger, too. Just as example.

Look for examples in the tutorial and in google-- and ask if something is still confusing.
 
Also, for whatever reason.. when I place a hero down on the map and try to test it, it crashes and gives me an error? I'm not too sure why..

What crash do you get? (take a screenshot of it if you can) Does the crash happen in the editor, or in the actual game when it is trying to load your map?

I've had it happen with faulty models, e.g. some extra geosets that I left without materials or anything.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
For the crash, it might be a good idea to disable all triggers (simply disabling them one by one), to ensure that none of the triggers are the problem.

If the crash is gone when the triggers are disabled, then one of the triggers is causing it.
In that case, you simply turn them on one by one and test the map every time in between, then you know which trigger it is.
After that, if the trigger is relatively large, you could try to disable/enable lines in the same way to find out where it crashes, but if it is small, then you could also just upload it here and hope that someone else recognizes the crash.

If the crash is still there when all triggers are disabled, then you may have invalid object editor data, corrupted resources, or other weird problems.
In that case, you should try to set the object editor values back to their defaults one by one, testing each time in between.
(Please note that a field of which you do not expect to create these crashes may still cause the crash. For example, upgrades into <unit> could be a cause of a crash. So just to make sure, you should NOT skip fields of which you think that could not possibly cause the crash.)
 
Status
Not open for further replies.
Top