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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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