• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Outside Regions

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2010
Messages
480
Usually spawn points are trigger as center of region
  • Unit - Create 1 Zombie for Neutral Hostile at (Center of Abomination <gen>) facing Default building facing degrees
but im trying to make them spawn "outside" the region. but i don't know how to trigger them. what im trying to accomplish here is to randomly spawn units near the map boundary without using 4 regions. is this possible?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Let's say you want them to spawn at a random location near a horizontal boundary, then you can do:

  • Set tempLoc = (Point((Random real number between -2816.00 and 2816.00), (2560.00 + (Random real number between -128.00 and 128.00))))
  • Unit - Create 1 Footman for Player 1 (Red) at tempLoc facing Default building facing degrees
  • Custom script: call RemoveLocation( udg_tempLoc )
The "-2816 to +2816" comes from the playable map boundaries (in my case, this was 52 x 52 - you can then do 52*64 - 512 to get the correct number).
The "2560 + ... " is a guideline I use here. It's the upper limit of my map (2816) - 256 and the "-128 to +128" is so that they don't all spawn at the same line.
Of course, if you want them to spawn in a line: you can just remove that randomness there.

For the lower boundary, make the Y-value negative.
For the side boundaries, switch the position of X-and Y.

This may look difficult, but it's really easy. You just create a set of semi-random coordinates where the units can spawn.
 
Level 9
Joined
Apr 7, 2010
Messages
480
my map is 32x32 full and 20x20 playable

in this case, i use 20*32 - ___ to get the correct number
and as guidline ____
the upper limit of my map is ___ - ___ and the ___ to ___"

i dont know where you get the - 512
as for the guidline, its my limit - 512/2 right? but in my case i wont use 512 since its too large i guess.
and no idea about the -128 and 128

EDIT: do i have to use 4 tempLoc? (-,-) (-,+) (+,+) (+,-) for each side?
its getting more complicated. @_@
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Let me just give you this:

Main = (SIZE-12)*64

Top = Main - 256
Bottom = - (Main + 256)
Left = -Main
Right = Main

SIZE is the actual map size, such as 32 or 96. I subtract it by 12 because that's the default playable map size (12 less than the actual map size).
You can replace "SIZE-12" by PLAYABLE_SIZE
The rest are their respective maximum coordinates (Top/Bottom: Y coordinate, Left/Right: X coordinate).

I think that, with those values, you can create the coordinates yourself :)

I did subtract all these values by 256 in my map (that's probably too much in a 32x32-map), so they didn't spawn at the outermost border but a little in front of it.

The -128/+128 is to make the spawn height vary slightly. As I said: you don't need that per se if you want them to spawn at a fixed line (that line being the border of the map).
 
Level 9
Joined
Apr 7, 2010
Messages
480
ok i understand the coordinate thing. thanks +rep

anyway. do i have to set a random real number between 1 to 4
then create 4 if all conditions are true?
if Real = 1
then action using loc1?
if Real = 2 use loc2, until real4?
or is there a shorter way?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I just came up with this:

  • Actions
    • Set randInt = (Random integer number between -2 and 1)
    • Set tempInt = (((Sign(randInt)) x 1200) + (((Abs(randInt)) - 1) x ((Sign(randInt)) x 256)))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Abs(randInt)) Equal to 1
      • Then - Actions
        • Set tempLoc = (Point((Real(tempInt)), 0.00))
      • Else - Actions
        • Set tempLoc = (Point(0.00, (Real(tempInt))))
    • Unit - Create 1 Footman for Player 1 (Red) at tempLoc facing Default building facing degrees
    • Custom script: call RemoveLocation( udg_tempLoc )
randInt values:
-2: bottom
-1: left
0: top
1: right

The "1200" is a bit less than 1280 ("Main" in my previous post), because otherwise they'd hug the edge. You can use 1280 if you want to, that's something you have to see for yourself.

I hope this answers your question (I wasn't sure what exactly you were trying to do).
 
Level 9
Joined
Apr 7, 2010
Messages
480
ok i'll try this triggers later

anyway im going to explain what im trying to do. im trying to make units spawn near the sides of the map boundaries.
there are 2 points actually

1. it makes players think that the monsters came outside the map or at least that's what i want them to expect
2. rather than just random places to spawn, players would have a hard time "camping" or defending themselves. just think about a zombie apocalypse, zombie dont spawn on thin air.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
unfortunately, creating a zombie on top of the boundaries is impossible. even outland abyss doesn't allow you to create ground unit (only flying is able to be created).

i guess creating a black thick fog (don't know if this exist though) over the spawn region would be enough ?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
unfortunately, creating a zombie on top of the boundaries is impossible. even outland abyss doesn't allow you to create ground unit (only flying is able to be created).

i guess creating a black thick fog (don't know if this exist though) over the spawn region would be enough ?
You could also limit the camera boundaries (how are they called again?) so that players cannot see the actual edges (where the zombies spawn).

My functions should be good enough for what you want, just change the "0.00" (other coordinate) to a random real between -1000 and +1000 or something.
Also, instead of "tempInt", perhaps make it "tempReal" - I wasn't really thinking about that too much :p.
 
Status
Not open for further replies.
Top