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

[JASS] gg_rct_number_(variable?)

Status
Not open for further replies.
Is it possible to do something like this in jass?
JASS:
function Trig_Set_Regions_Actions takes nothing returns nothing
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 85
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set udg_FFregions[GetForLoopIndexA()] = gg_rct_FF_00_Copy_(GetForLoopIndexA())
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction
Because setting 85 regions manually doesn't really thrill me...
 
Level 13
Joined
May 11, 2008
Messages
1,198
why would you need 85? isn't there some way you can lower the number by somehow reusing regions? you could probably move them i think...then again doing that might end up being more complicated than the variable. variables sure are a chore, huh? the worst part is i don't know when you should use variable and when you shouldn't precisely but i guess i must be getting some stuff right because my map doesn't really crash anymore i think...
 
Level 9
Joined
Nov 28, 2008
Messages
704
Why are yo using those Loop Indexs.. wouldnt it be easier on yourself to make a local integer i = 0 or something, and manually set how much you want the loop to run?

Is it more efficient or something? I dont get it.
 
BWAHAHAHA! I solved the problem!
I feel so smart now.

See the problem was I have a game that has a MASSIVE library. And players need to search the whole thing to find a book. So I have loops that check to see if the players are in the regions marked for searching and I needed to assign all the regions to a region array variable.

And I've done it! And somewhat easily.
I wrote a program in c++ that saved all the lines as a txt then I pasted it into the editor. BWAHAHAHA
Code:
#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

int main () 
{
  int x;
  cout<<"Writing file.\n";
  ofstream myfile;
  myfile.open ("code.txt");
  for(x=0; x<=96; x++)
  {
    myfile << "    set udg_zBookRegions["<< x <<"] = gg_rct_z_Books_"<< x <<"\n";
    }
  myfile.close();
  cout<<"Finished writing file.\n";
  system("pause");
  return (0);
}
 
Level 12
Joined
Mar 16, 2006
Messages
992
You know the object editor for ability levels can do this too, right?
Ability description: set udg_zBookRegions[1] = gg_rct_z_Books_1
Auto fill levels.
 
Status
Not open for further replies.
Top