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

integer pools!

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
so i had learned some things about unit pools, item pools...that it's sometimes much better to use them as global variables rather than local variables.

ok, so...now i'm doing that. i don't have to keep on making pools which takes a lot of lines, i can just make them once, and then make units/items come from them with just one line.

now there's this great system someone made up, at least i think it's great...

i liked randomizing the gold resource a certain way for gold mines...
of course i could do something like put the gold mines in a unit pool and have various copied gold mines. but thanks to this pool system i don't have to have x versions of a certain kind of unit if i can adjust the necessary different attributes easily via this integer pool system.

but i've got a problem! as far as i know, his integer pool system only lets you make local intpool variable. you cannot make intpool variable be global. so i cannot reuse the same pool without creating it all over again, which is quite the chore, and is why i sometimes use global unit pools and item pools.

so, i've already asked him about it, but being the impatient person i am, and knowing how slow wc3c.net is to responding to posts...i wanted to see if anyone here could come up with a solution if i posted a thread about the problem.
here's a link to the thread with the system.
http://www.wc3c.net/showthread.php?t=108369
 
Level 13
Joined
May 11, 2008
Messages
1,198
uhm...oh...i thought i had to set/create the variable when i declared it...

how to use variables in jass is confusing sometimes where some variables do not work depending on how you declare them. oh well. and when people make up their own variables, well, things get even more interesting.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
Its an emulated type, it all compiles to normal jass when you save the map.

There are 2 types of variables in JASS. Globals which are accesable by every function and share the same value accross all triggers. Locals which only exist within the function for that instance of the function. Globals are stored in main memory whereas locals are on the stack.
 
Level 13
Joined
May 11, 2008
Messages
1,198
Its an emulated type, it all compiles to normal jass when you save the map.

There are 2 types of variables in JASS. Globals which are accesable by every function and share the same value accross all triggers. Locals which only exist within the function for that instance of the function. Globals are stored in main memory whereas locals are on the stack.

exactly. this is why global integerpools are pretty important. thankfully the code of the script itself needs nothing new it's just the instructions for using the script should probably be slightly modified.
 
Status
Not open for further replies.
Top