| 01-02-2006, 01:24 PM | #1 |
Hi! ![]() I want to spawn a creeps with regions (RegionCreep1 to RegionCreep4) if the player is in a specific region (RegionWilderness), and let those creeps attack the player. Like in the RPG map: Wind and Cloud Open RPG. If the player is out of the region they stop attacking and return to their region, and stop spawning new creeps. How can I do this? |
| 01-02-2006, 01:29 PM | #2 |
I'm not so good at region triggers but I think there is an event "Unit - Leaves Region" but I think it is on UMSWE. But well, that event could do the work. Then you order the creeps to retreat and done, I hope. |
| 01-02-2006, 01:39 PM | #3 | |
Quote:
periodic events would be te way to go, but you could also use a timer thats set at a random range for more "realistic" creep spawning. First, you would count the number of Player Heros in the reigon, seed a random number with this, then spawn that many units. (eg: if there are 5 players in the reigon, when the spawn trigger activates then: ctreate (random number between 3-5) * (player count(5)) [unit] at (random point in reigon) ) its not exactly as simple as it could be, but you get better gameplay out of it. if your looking for simple, then use a periodic event set at (oh, 20+ sec) and if a player unit is present in the reigon, spawn a swarm of units. but i like my complicated method better :) |
| 01-02-2006, 01:55 PM | #4 |
@Mc !: A unit leaves region event is in normal WE too. |
| 01-02-2006, 01:58 PM | #5 |
I would do something like this Code:
Enter
Events
Unit - A unit enters (Region 001)
Conditions
((Entering unit) is A Hero) Equal to True
Actions
Set IsInRegion = TrueCode:
Leave
Events
Unit - A unit leaves (Region 001)
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Leaving unit) is A Hero) Equal to True
(Number of units in (Units in (Region 001) matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
Then - Actions
Set IsInRegion = False
Else - Actions
Set IsInRegion = TrueCode:
Spawn
Events
Time - Every 8.00 seconds of game time
Conditions
IsInRegion Equal to True
Actions
Unit - Create 1 Footman for Neutral Hostile at (Random point in (Region 001)) facing Default building facing degrees
Unit Group - Pick every unit in (Units in (Region 001) owned by Neutral Hostile) and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to Attack (Random unit from (Units in (Region 001) matching (((Matching unit) is A Hero) Equal to True)))Its very primitive and has leaks but I just made something up, might not be exactly what you want but if so I can fix it up. |
| 01-02-2006, 02:18 PM | #6 |
This should work. Thank you! :D Code:
Outlands
Events
Time - Every 30.00 seconds of game time
Conditions
Actions
Unit - Create ((Random integer number between 1 and 2) x (Number of units in (Units in AreaOutlands <gen> matching (((Matching unit) is A Hero) Equal to True)))) Gnoll for Neutral Hostile at (Random point in AreaOutlands <gen>) facing Default building facing degrees
Unit Group - Order (Last created unit group) to Attack (Random unit from (Units in AreaOutlands <gen> matching (((Matching unit) is A Hero) Equal to True)))
Unit - Create ((Random integer number between 0 and 1) x (Number of units in (Units in AreaOutlands <gen> matching (((Matching unit) is A Hero) Equal to True)))) Gnoll Poacher for Neutral Hostile at (Random point in AreaOutlands <gen>) facing Default building facing degrees
Unit Group - Order (Last created unit group) to Attack (Random unit from (Units in AreaOutlands <gen> matching (((Matching unit) is A Hero) Equal to True))) |
| 01-02-2006, 02:23 PM | #7 |
I hope you guys make sure, the hero will not be overwhelmed by too many monsters. You need to add some check for the number of monsters that is currently around or something like that. |
| 01-02-2006, 02:27 PM | #8 |
I can create a timer: Every 180 seconds, if theres 0 heroes in the region, kill all units by neutral hostile in that region. |
| 01-02-2006, 02:57 PM | #9 |
or just add a wait in the leave region after that do for all spaws (if hero count = 0): order back to region (unit's custom number) |
| 01-03-2006, 12:52 AM | #10 |
Instead of a constant running of a period event, you could do something where when a hero enters a region, you can turn on a period spawn and when the hero leaves, you can check if there are any other heros left and turn it off or leave it on. This would make the game run a bit smoother if you have many other periodic events and the heros are not always in the spawning regions. |
| 01-03-2006, 08:39 AM | #11 | |
Quote:
with your method, compression is harder. with my method, you can toss actions into one periodic trigger for ALL spawning reigons. and you should add an "if" in it to prevent zerging: if (units in [reigon] owned by [player]) > 30 then skip remaining actions else [spawn] endif (im too lazy to open te WE :P its better learning to make you do it yourself :)) |
| 01-03-2006, 06:54 PM | #12 | |
Quote:
|
| 01-03-2006, 06:59 PM | #13 | |
Quote:
they dont make the game run muc slower if you fix all the memory leaks within them. Ive made maps with events that fire every half secont, and do over 50 actions. yet, no lag. Periodic events dont cause lag in and of themselves, but memory leaks and REALLY complex actions within them do cause lag. simply counting units in the reigon then spawning a few units every 30 seconts wont cause that many problems. if it was every secont, ten yes, it would be a problem. |
| 01-04-2006, 12:50 AM | #14 |
Efficiency and the bare minimum for a lag-free game are different things. We do not know if he has many other periodic events or none at all. I was explaining an optional method he could do if he wanted to reduce a bit less lag. I was not arguing that one period event would make the game crash. I ventured into the unknown with an optional possibility and telling me that a more efficient way is unessesary because it only creates a small amount of lag is unessesary. You do not know if someone with a slow computer might play his game. If he already created a few periodic events, then with this one, the player was already lagging a bit but still in playable terms, this event may have triggered it to go into the unplayable zone. |
| 01-04-2006, 10:23 AM | #15 |
Ever played cube defense ? youde be surprised how bad its trigggerd. (from an anti-periodic event way of thinkin) every half secont (yes, half secont) every unit owned by the "creeps" is issued a move order. tats up to 60+ creeps. a secont. WITH memory leaks!!! yet, when i play cube D, i never lag. why? because periodic events are NOT a major cause of lag, UNLESS you are doiing something INSANE every secont. i myself run on a sub-standard coputer. (heck, when i started playin WC3, i only had 256 memory! and im still on a 1.4 GHz prossesor!) i know what will cause lag, cause i have to deal with it allot. one periodic event that handels ALL the spawning on the map will not cause that much lag, even in a map wit allot of other periodic events, ESPECIALLY cause its only going to run every 30 seconts! if it was running every secont, i would not be arguing wit you. and wit your method, one would ave to do ALLOT more work. im not gonna argue this any more. good day to you. I SAID GOOD DAY! |
