How do you get the Region Name of a Certain Region once a Unit Enters that Region?
Data Table doesnt work for me because it collides with a data table (string type and not the region type havent tried meddling with it yet either so if anybody could suggest me something, be happy to help in return anyways)
I don't see any region from name functions or triggers. There is a RegionFromId function in galaxy which is used when doing Set Variable with type Region.
I believe the IDs are simple increments from 1 to numRegions. It would be possible then to manually create an array of region names and do your own lookup in galaxy script. Seems like a lot of work, but if you really absolutely need the name...
constnumRegions=10;string[numRegions+1]regionNames;regionnames[1]="First Region Name";// ... etcstringgetRegionName(regionmyRegion){inti;for(i=1;i<numRegions;i+=1){if(myRegion==GetRegionFromId(i)){returnregionNames[i];}}return"";}
Examine the regions in the terrain editor of the attached sample map then run it and move your marine through the regions. It'll announce when you enter/leave each one.
Also note that I'm not reporting the same names as in the editor - I don't see a way of getting those - when you set up the names in the data you can name them whatever you want.
I'm not sure I see the purpose behind this. If you explain what you're trying to accomplish there might be a better way of doing it. Especially since you have to setup an entering/leaving event for each individual region.. it might be easier to have a separate trigger for each region and then have them call another trigger or function for any shared functionality. Unless you're dynamically creating regions..
Depending on what you want, there is a more efficient way of doing this. If you only need to look up a region by name, not the name of a region, then you can use DataTableSetRegion(preset scope, string name, region value);
Then you can find the region by its name using DataTableGetRegion(preset scope, string name);
Using this method you can lookup regions by name without using a for loop. It's also easier to code. It does not allow you to lookup the string name of a given region though.
Perhaps the easiest way to see it is just to plop a couple of them into a GUI trigger and then view the map script to see what they look like in custom script.
@Nurdguy: Go
Depending on what you want, there is a more efficient way of doing this. If you only need to look up a region by name, not the name of a region, then you can use DataTableSetRegion(preset scope, string name, region value);
Original question was specifically for getting the name of a given region...
Again, the original post asks for the name of the region, not region by name. And it was discussed above already there's a RegionFromId function, doesn't appear to be anything for the name, surprisingly.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How do you get the Region Name of a Certain Region once a Unit Enters that Region?
Data Table doesnt work for me because it collides with a data table (string type and not the region type havent tried meddling with it yet either so if anybody could suggest me something, be happy to help in return anyways)
I'm not sure if you can get a name from a region, but you can get a region from a region name using "Region From Name" function.
you can get region from name (string type). use a conversion function
@SoulTaker916: Go
and what Conversion Function would that be? (Just woke up)
A region name is not accessable from script.
@Mille25: Go
You are correct i misread.
I don't see any region from name functions or triggers. There is a RegionFromId function in galaxy which is used when doing Set Variable with type Region.
I believe the IDs are simple increments from 1 to numRegions. It would be possible then to manually create an array of region names and do your own lookup in galaxy script. Seems like a lot of work, but if you really absolutely need the name...
Heres what I did. You can grab ability assets if you want. Blind , Toss and Stuffs.
Examine the regions in the terrain editor of the attached sample map then run it and move your marine through the regions. It'll announce when you enter/leave each one.
Also note that I'm not reporting the same names as in the editor - I don't see a way of getting those - when you set up the names in the data you can name them whatever you want.
I'm not sure I see the purpose behind this. If you explain what you're trying to accomplish there might be a better way of doing it. Especially since you have to setup an entering/leaving event for each individual region.. it might be easier to have a separate trigger for each region and then have them call another trigger or function for any shared functionality. Unless you're dynamically creating regions..
@Nurdguy: Go
Its for my RPG, btw where did you learn, Or got those Scripts? :)
@Nurdguy: Go
Depending on what you want, there is a more efficient way of doing this. If you only need to look up a region by name, not the name of a region, then you can use DataTableSetRegion(preset scope, string name, region value);
Then you can find the region by its name using DataTableGetRegion(preset scope, string name);
Using this method you can lookup regions by name without using a for loop. It's also easier to code. It does not allow you to lookup the string name of a given region though.
@MasterWrath: Go
Uh, Where can I find that?
@Mugen245: Go
That's all in the DataTable trigger actions.
Perhaps the easiest way to see it is just to plop a couple of them into a GUI trigger and then view the map script to see what they look like in custom script.
I just created them.. basic programming
Original question was specifically for getting the name of a given region...
@Nurdguy: Go
Oh. Isn't there already a function for that? RegionFromName(string name).
@MasterWrath: Go
Again, the original post asks for the name of the region, not region by name. And it was discussed above already there's a RegionFromId function, doesn't appear to be anything for the name, surprisingly.