How do I randomly spawn units and let them move around randomly

L

laplans

Guest
At first: I'm dutch so I can make faults in my english :cool: .

I'm trying to make a singel player RPG but I want to get my creeps spawn randomly and move around randomly. How can I do this?

It is maybe fully imposibble or a part of it. But I know it's possible.

I hope I can get an answer as soon as possible so I can move further on my quest to make a good single player RPG :p :shades:. (yeah my first post :cool:)
 

n[u]ll

You can change this now in User CP.
Reaction score
93
Code:
Time - Every (whatever) seconds of game time.
Conditions -
Actions - Unit - Create 1 (creep) for neutral hostile at (Random point in ((Playable map area))

and give the creep the ability wander.

Edit: Btw, your English is great... :)
 
S

Sunny_D

Guest
"spawning units randomly" could be described a little more precisely. where do you want them to spawn (always same point, at a random rect, random point of the entire map,...). give a little more info - there are many ways to spawn units... =p

for letting them move randomly its probably already enough for your needs that you simply add the ability "Wander" (the skill that all the critters have, eg vulture, raccoon etc..). this makes the move around randomly already.

EDIT: dang! too slow again... =)
 
L

laplans

Guest
A little explanation then about the moving around,I think I already got it but to be sure. They must spawn in an area cause it would be a little hard if your hero at the beginning(so level 1) needs to fight against a level 12 creep or something like that xD.

Just replace the playable map area with the area that I want right?

Edit:btw:you guys are fast!:p
 
L

laplans

Guest
Well now we are busy. How can I make sure they won't leave the area and that there won't be to much of the creeps at one time xD. I can think it of my own but well you guys know it so I don't have to do the 'trial and error thing".:rolleyes:

Edit: Now I'm working with it,wander is nog the optimal thing. I want them to always walk around.
 

n[u]ll

You can change this now in User CP.
Reaction score
93
Hmm theres a couple ways you could keep them in the area. you could set a region and use a trigger like this...

Code:
Unit - Unit leaves (region)
Conditions - Owner of (triggering unit) is equal to Nuetral Hostile
Unit - Instantly move (unit) to (center of ((region))
or something like that.

Or you may want to set up air blockers (doodads section) and make those units air. but idk if the player has air units or not so that may not work out so great.

I think theres other/better ways to do this but i never have to.:rolleyes:
 
L

laplans

Guest
Some of you guys know the final fantasy epic map? This is maybe a good example how I want them to walk.
 
S

Sunny_D

Guest
dont know this map either... mind to explain it?

though, if it isnt made with the "wander" ability, its triggered - and to trigger a random movement is pretty much only useful if you want them to walk coordinated or over bigger distances. basically its about ordering the units (with a "Unit - Issue Point Order" action) to specific points...
 
L

laplans

Guest
Well atleast it's working for a bit,Maybe I can change things in the wander skill. Well I see what I can do. If anyone got an idea,please post it:).

No one got an idea?
 

EmBeR_NaGa

New Member
Reaction score
1
Reply to your Thread xD

(1)Events - unit enters <region> <gen> Conditions - (Entering unit) is a Hero. Actions - Turn on Trigger (4) , Create 1(what ever number you want xD) (unit) at (random point) in <region> <gen>. Next Trigger(2) - Events - unit enters <region> <gen> Conditions - (Owner of entering unit) equal to (Neutral Hostile) Actions - Issue (unit) to move to a (random point) in <region> <gen>. Next Trigger(3) - (This should be your first trigger to activate.) Events - Elapsed Time is 0.20 seconds. Conditions - (None) Actions - Turn on (trigger 2) <gen> (include all spawn triggers located to trigger 2's exact words) Next Trigger(4) - Events - Every (what ever seconds you want) Conditions - (none) Actions - Create 1(what ever number you want xD) (unit) at (random point) in <region> <gen> , Set (Unit Variable) = (Last created unit) Make (unit Variable) to move to (region) <gen> (then continue from one region to another).(or you can make them Patrol to one region.).
This is it then.
 
L

LGM

Guest
I can't read that above, but you could do:

Code:
Events
    Time - Every Whatever seconds of game time
Conditions
Actions
    Unit Group - Pick every unit in (Units in (Whatever region)) and do (Unit - Order (Picked unit) to Attack-Move To (Random point in (Whatever region)))

for the moving
 

Icyculyr

I'm a Mac
Reaction score
68
Alrighty, this is quite simple, as I do not know how you want to use it but try this

Variables (Name, Type, Array)
Code:
SpawnList, Unit-Type, Array 1
SpawnCount, Integer
SpawnAmount, Integer
SpawnRegion, Region, Array 1
SpawnRegionAmount, Integer
SpawnLoc, Point, Array 1
RandomInt, Integer

Code:
[B]Initilize[/B]
Events
    Map Initilization
Conditions
Actions
   Set SpawnCount = 1 (Number of monsters to be created per interval)
   Set SpawnList[0] = Dragon Donkey
   Set SpawnList[1] = Fairy Fluffy
   Set SpawnList[2] = Peon Of Power
   Set SpawnList[3] = Frog of Grog
   Set SpawnAmount = 4 (Because there is 4 monsters)
   Set SpawnRegion[0] = Region to spawn units at
   Set SpawnRegion[1] = Another Region to spawn units at
   Set SpawnRegionAmount = 2 (Because there is 2 regions)
Code:
[B]SpawnTheMonsters[/B]
Events
    Every 60.00 Seconds of Game Time(The interval for spawning the monsters)
Conditions
Actions
    For each Integer A from 0 to SpawnRegionAmount - 1
        Loop
            For each Integer B from 0 to SpawnCount - 1
                Loop
                    Set RandomInt = Random Number Between 0 and SpawnAmount - 1
                    Set SpawnLoc[0] = Center of SpawnRegion[Integer A]
                    Create 1 SpawnList[RandomInt] for Player 1 Red at SpawnLoc[0] Facing Random Number Between 0 and 360 degrees
                    Custom script:   call RemoveLocation(udg_SpawnLoc[0])

If that does not work, tell me, and I will try and fix any problems
Also if you do not understand, ask, and I will try to explain where (or what) something is
 
L

laplans

Guest
I'll see what I can do cause I'm not so super with variables and stuff. But I'll try the things that are listed.

Oh and it's not a random unit,but a random point in an area;I'll choose the unit that will spawn there.

EDIT:QUESTION: I want a max of 15 monsters a time to be spawned. So when there are 15 monsters in the area the spawning will stop? + Do I need to put in a whole new trigger to put other monsters in other regions?
Tnx for the help.

Don't know how to delete this message :|
 
L

laplans

Guest
Big TY

Alrighty, this is quite simple, as I do not know how you want to use it but try this

Variables (Name, Type, Array)
Code:
SpawnList, Unit-Type, Array 1
SpawnCount, Integer
SpawnAmount, Integer
SpawnRegion, Region, Array 1
SpawnRegionAmount, Integer
SpawnLoc, Point, Array 1
RandomInt, Integer

Code:
[B]Initilize[/B]
Events
    Map Initilization
Conditions
Actions
   Set SpawnCount = 1 (Number of monsters to be created per interval)
   Set SpawnList[0] = Dragon Donkey
   Set SpawnList[1] = Fairy Fluffy
   Set SpawnList[2] = Peon Of Power
   Set SpawnList[3] = Frog of Grog
   Set SpawnAmount = 4 (Because there is 4 monsters)
   Set SpawnRegion[0] = Region to spawn units at
   Set SpawnRegion[1] = Another Region to spawn units at
   Set SpawnRegionAmount = 2 (Because there is 2 regions)
Code:
[B]SpawnTheMonsters[/B]
Events
    Every 60.00 Seconds of Game Time(The interval for spawning the monsters)
Conditions
Actions
    For each Integer A from 0 to SpawnRegionAmount - 1
        Loop
            For each Integer B from 0 to SpawnCount - 1
                Loop
                    Set RandomInt = Random Number Between 0 and SpawnAmount - 1
                    Set SpawnLoc[0] = Center of SpawnRegion[Integer A]
                    Create 1 SpawnList[RandomInt] for Player 1 Red at SpawnLoc[0] Facing Random Number Between 0 and 360 degrees
                    Custom script:   call RemoveLocation(udg_SpawnLoc[0])

If that does not work, tell me, and I will try and fix any problems
Also if you do not understand, ask, and I will try to explain where (or what) something is


I can't read that above, but you could do:

Code:
Events
    Time - Every Whatever seconds of game time
Conditions
Actions
    Unit Group - Pick every unit in (Units in (Whatever region)) and do (Unit - Order (Picked unit) to Attack-Move To (Random point in (Whatever region)))

for the moving

Moving and spawning works fine now:).(only had to make some changes for the spawning) Thx. Only 1 question left:What to do with an other area??:D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top