Warcraft III resources & community, 2003–2006 · archived

Very noobish triggeriring help... or variables if you prefer

22 posts
#1

Very noobish triggeriring help... or variables if you prefer

Is there any other way, in an AOS map, to have units attack move on a set path (that twists and turns, i set multiple regions so the units don't hug the inside of the path and make it look ugly), without using so many triggers? As in, I mean copying the "attack move" to region trigger and copying and pasting it alot.

I here you can do this with variables. Is this true?

Thanks guys :D
#2
since no one has answered yet and your post has been up for almost an entire day i suppose i should tell you that no, i don't think there is any way to get around this. it's annoying and mind-numbing work to create pathing AIs but in order to make a good map you'll have a lot of such mind-numbing work to do alongside the really creative and rewarding stuff.
#3
its easy, make triggers like this:

events: unit enters 'rect I'
conditions: unit is owned by player X (player comparison)
actions: unit - order triggering unit to move to 'rect II'

events: unit enters 'rect II'
etc
etc
etc
#4
lol that's exactly what he wants to avoid.
#5
its the only way, else they will move the fastest way (always the same path)
#6
Oh, ok. I don't mind making the triggers, it's just when playing a new game a friend made. (it was kind of like tech wars) he said he made the unit movement with variables, so I was wondering how to do that, and possibly avoid the lag.

Thanks for the help tho guys :)
#7
yea u can use variables if u want, but u dont need em xD
in techwars like games, u have triggers like

events: unit is finished training (or sumthing)
actions: order last trained unit to attack 'enemy base'
#8
There is a way to use less triggers. It involves region arrays.

I don't have access to the editor at the moment so I'll just give you a basic idea for now. I'm in the process of moving, so give me a few days and I can give you a real example of what I'm trying to say.

But for now, here's a blind attempt:

This is assuming there is only 1 path.

You create your array, rgnPath, for example. Set it to a X (where X is the number of regions in the pathing) value array.

Then you make a simple trigger to declare the variables in your array.

Map Initialization

Set rgnPath(1) = Out of Spawn Region
Set rgnPath(2) = First turn Region
Set rgnPath(3) = Second turn Region
Set rgnPath(4) = End Zone Region
Etc.

Note: I have no idea how your pathing is laid out, this is just a crude example I came up with on the spot.

With your Array now declared you can make your trigger.

It would be something like this:

Whenever a unit owned by Player Y(Owner of the creeps) enters rgnPath(1)
Whenever a unit owned by Player Y(Owner of the creeps) enters rgnPath(2)
Whenever a unit owned by Player Y(Owner of the creeps) enters rgnPath(3)
Whenever a unit owned by Player Y(Owner of the creeps) enters rgnPath(4)
etc.

For Integer A = 1 to X (X is the number of regions in your array)
And this is where my lack of World Edit shines through.

If *Region unit is in* = A Then
Unit - Order triggering unit to AttackMove to rgnPath(A + 1)



And that's pretty much it. Basically what this does is:
The For statement loops through each region in the arrya to compare it to where the unit is, this allows you to determine where the unit is; rgnPath(A), therefore where to tell it to go from here. You want it to goto the next region in the array so you order it to move to A + 1. Easy, right?
#9
the array size does nothing whatsoever, just so u know ^^

this is what it will say in the map script, nomatter what you put for the size

global (type) array (name)
#10
Thanks for all your help guys. I suck at variables, but I'll spend a weekend trying to get this all organized and stuff.

Look for my map (the very first one I plan to finish 100%) Siege Of The Undercity.

Thanks again for your help :D
#12
what i MEANT ( maybe not clear enuff ) was that an Array defined in the Globals ( GUI ) variable editor takes a size. Unlike most programming languages, the map just ignores the size that you put in, and i was pointing that out

try opening a war3map.j with a global array in it sometime x.x
#13
try opening a war3map.j with a global array in it and taking a look at InitGlobals function sometime x.x
#14
yeah. right. it stores the size. right. thats why you can store 12 values easily in an array of size 2?

:lol:
#15
did i say something about being unable to store 12 values easily in an array of size 2?
(i didn't, i was referring to initial values)