Unit: Create unit in specific terrain type

Killerphill

New Member
Reaction score
1
Hi guys.

I need to know how to create units at a random point in a specific terrain type around the entire map or else my "creeps" will be spawning everywhere. lol.

is this possible? + rep for solution :)

thanks in advance.
 

TideOfChaos

New Member
Reaction score
25
Nope.
There is no way to check the sort of Terrain in an area. You will just have to create a whole lot of regions my friend.
 

Evoroth

New Member
Reaction score
11
Yes, there's a condition which is something like "Is terrain type at (point) equal to (Lordaeron Dirt or whatever).

You have to options, either make a trigger which somehow picks every location (which some interval) in lordaeron dirt (or whatever), or pick a random point in playable map area (or preferingly smaller), check if it's on lordaeron dirt, and pick a new random point if it isn't.
 

cleeezzz

The Undead Ranger.
Reaction score
268
check if it's on lordaeron dirt, and pick a new random point if it isn't.

even though you can check terrain type, it would be better to use regions, it is possible for the trigger to run maybe 100+ times before a picks the right point (depending how much of this terrain type is around the map)

unless its over 60% of the maps terrain type, then i wouldn't recommend it.
 

wraithseeker

Tired.
Reaction score
122
Code:
Unit - Spawn your unit

If Terrain type at last created unit equal to your terrain
then

else
kill last created unit

This is hand written.
 

Killerphill

New Member
Reaction score
1
i cant have the spawned unit being killed or else eventually theyll all die off. ive also tried doing that "terrain condition" thing but havent gotten any luck with it yet. i dont really want to fall back on regions as i cant "mold" them into a wierd shape and that would cause all units to spawn inside the region and not where the region doesnt cover.

sorry if i explained that wrong.
 

mordocai

New Member
Reaction score
17
try using pathing blockers? and then just turn collision off if unit is at the desired tileset, then turn back on, if not then just dont do that at all? i think this woudl require a region, and unit groups
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
The simplest and most easiest way is to:
(Note: this is not an optimized trigger however it works and removes the leaks.)
Code:
ConditionalTerrainSpawn
    Events
        Player - Player 1 (Red) types a chat message containing !Behold my great glory shall smite thee unto all Eternity! as An exact match
    Conditions
    Actions
        Set CreepType = Footman
        Set CreepSpawnLocation = (Random point in (Playable map area))
        Set VarTerrainType = Lordaeron Summer - Dirt
        Set CreepPlayer = Neutral Hostile
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Terrain type at [COLOR="Blue"]CreepSpawnLocation[/COLOR]) Equal to (==) [COLOR="Blue"]VarTerrainType[/COLOR]
            Then - Actions
                Unit - Create 1 [COLOR="Blue"]CreepType [/COLOR]for [COLOR="Blue"]CreepPlayer [/COLOR]at [COLOR="Blue"]CreepSpawnLocation [/COLOR]facing Default building facing (270.0) degrees
            Else - Actions
                Custom script:   call RemoveLocation(udg_CreepSpawnLocation)


Always use variables. It makes it easy to change what you want when they are all at the top. All the actions should be independent of the variables. Makes it easy to debug your maps too.

I use names like VarTerrainType to help me distinguish at a glance that I'm using a variable instead of a actual command.
 

Killerphill

New Member
Reaction score
1
Nevermind, i got it working my own way, just changed a whole lot of triggers around that chovynz gave me. thanks for the help man, + rep to you.
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Aheh. Your welcome. I'm glad you got it working.
You're supposed to change things how you need them.
I cant mind read :D.
Goodluck with the rest of your map.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top