HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Creep help ?

03-08-2008, 08:12 AM#1
ThonGod
I'm making an AoS map with neutrals and I'm not really sure how i would have groups of different creeps respawning one or two minutes after a previous group of creeps dying.

Can anyone post a sample trigger that i can modify and learn from ?

Thanks,

- ThonGod
03-08-2008, 08:35 AM#2
RolePlaynGamer
Try this tutorial.

http://wc3campaigns.net/showthread.php?t=97706

Just store some units in a unit pool and detect when the crep group is dead, then make some random units from the pool.
03-10-2008, 03:40 AM#3
ThonGod
Thanks, ill muck around with that since i dont really know much about JASS =]
+rep

And is there a simple way with GUI ?

- ThonGod
03-10-2008, 03:49 AM#4
The Elite
no, learn jass, its really worth it
03-10-2008, 07:46 AM#5
Gorman
It is either easier with GUI, or impossible.

Just add each unit to a unit group (in an array) then detect when the number of units in that array is 0, and then spawn a new group after that. To know if a group in the array is being used already just check to see if number of units in array is 0, but if they are neutral units then you already have a set number anyway.

I can give you a trigger if you want, but once you start making it it should just flow.
03-11-2008, 08:46 AM#6
Furion
Here's what I used, ThonGod. I hope this helps.

The Spawn Trigger:

Trigger:
Creep Camp 1
Events
Conditions
Collapse Actions
Set TempInt = 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Creeps[TempInt] is empty) Equal to True
Collapse Then - Actions
Wait 15.00 seconds
Set TempInt = 1
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set CreepType[1] = Thunder Lizard
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set CreepType[1] = Lightning Lizard
Collapse Else - Actions
Do nothing

The Resurrection Trigger:

Trigger:
Respawn Lead Trigger
Collapse Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 19, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Dying unit) is in Creeps[(Integer A)]) Equal to True
Collapse Then - Actions
Unit Group - Remove (Dying unit) from Creeps[(Integer A)]
Trigger - Run CreepTriggers[(Integer A)] (checking conditions)
Collapse Else - Actions
Do nothing

Also, you need to place the creeps initially, so just use a

Trigger:
Trigger - Run Creep Camp 1 <gen> (checking conditions)

action to place the units initially.

This system may not be the most efficient, but it made me happy. It allows you to easily manage many different creep camps (I had 19 at the time) without using JASS, and allows you to easily have predetermined multiple creep types in each camp.
03-11-2008, 10:36 PM#7
ThonGod
Thanks for the code =D

---------------------------

Gorman can you post your triggers too ? =)

---------------------------

What are you making here? :
Trigger:
Set TempInt = 1
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]

CreepType[1] ?

--------------------------

And then below it you have a
Trigger:
Set CreepType[1] = Thunder Lizard

--------------------------

TempInt is an integer,
TempPoint is a point,
CreepType is a unit array (with how ever many creep types i want ?)

Is that all for your variables?

---------------------------
I would also like to know why yourTempInt seems to always be one ?

Kinda confusing i tihnk ?

===Possibly edits when i get home from where ever im going===

- ThonGod
03-12-2008, 02:18 AM#8
TheSecretArts
you missed array CrSpawnLoc
03-12-2008, 08:26 AM#9
ThonGod
Thanks Secretarts for that =]

--------------------------

Trigger:
Set TempPoint = (Random point in CrSpawnLoc[TempInt])

Thats Location one because its seems to always be set as one?

Man im confused =]

- ThonGod
03-12-2008, 01:51 PM#10
Rising_Dusk
We have a system located in our database called the Creep Respawn System. I have a funny feeling it could be something you're looking for. It's in jass, but I can nearly guarantee it is more modular than anything you're using. (And therefore far more useful)
03-13-2008, 11:24 AM#11
ThonGod
I dont really seem to be able to use it because of all his variables and locs and is probably the reasons why it has lots of "expected line " or seomthing

and i cant open it in single player O_o

- ThonGod
03-13-2008, 03:50 PM#12
Rising_Dusk
It requires vJass, that's why. Download grimoire here. It's very easy to use, though, all you do is create a region and run a single line of custom code. It's all elaborated in the first post in that topic.
03-14-2008, 08:20 PM#13
Furion
Hey ThonGod, sorry my system was confusing. Here's what's up with it.

TempInt is an integer variable being used to keep track of which camp is being respawned.
TempPoint is a point variable used to clean up memory leaks.
CreepType is a unit-type array variable used to dictate what type of creeps are spawned in each camp.
CreepSpawnLoc(ation) is a region array variable that dictates which camps are located where.
Creeps is a unit group array used to track whether the creeps in a camp are alive or dead.

So what you do to use the system is at map initialization, you set each value for CreepType and CreepSpawnLoc, and then run the trigger initially, and after that, the creeps will automatically respawn after the time you specify when they are all dead.


Now to specifically answer your questions:

Quote:
Originally Posted by ThonGod
What are you making here? :
Trigger:
Set TempInt = 1
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]

I am spawning the creeps and adding them to the appropriate unit group. It says "At a random point in creep camp #1, spawn the creep type that goes in camp #1 and add that unit to group #1."

Quote:
Originally Posted by ThonGod
And then below it you have a
Trigger:
Set CreepType[1] = Thunder Lizard

That is how you have units of different types in the same camp. For example, for creep camp 1, I wanted 2 lightning lizards and 1 thunder lizard. So I set CreepType[1] = Lightning Lizard, and then after spawning two of those, I set the CreepType[1] = Thunder Lizard, spawned one of those, and then set CreepType[1] back to its default, Lightning Lizard. In this way, you can have as many different creep types in each camp as you want.

Quote:
Originally Posted by ThonGod
I would also like to know why your TempInt seems to always be one?

TempInt is always 1 because I only copied the creep camp 1 trigger for you. They are all the same except for the numbers changed. For example, here is creep camp 2 for you:

Trigger:
Creep Camp 2
Events
Conditions
Collapse Actions
Set TempInt = 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Creeps[TempInt] is empty) Equal to True
Collapse Then - Actions
Wait 15.00 seconds
Set TempInt = 2
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set CreepType[2] = Murloc Nightcrawler
Set TempPoint = (Random point in CrSpawnLoc[TempInt])
Unit - Create 1 CreepType[TempInt] for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Add (Last created unit) to Creeps[TempInt]
Custom script: call RemoveLocation( udg_TempPoint )
Set CreepType[2] = Murloc Mutant
Collapse Else - Actions
Do nothing

As you can see, just the numbers change. It is a bit of a hassle to change them, but most of it is just copy-pasting. I am sure the JASS guys would be disdainful at how each camp requires its own trigger, and rightfully so since they can do it more easily, but this system worked well for me since I do not know how to use JASS yet.

One last note, I am sure you realized this, but the "Wait" time is how long it takes for the creeps to respawn after the last one in the camp dies. Just make it longer or shorter to suit your needs.
03-16-2008, 12:40 AM#14
ThonGod
Thanks Furion!

Its in my map and tested and it works perfectly!

+rep when i can

:D

-----------------------------------

Would i do something similar to randomly select and create one of twelve special units at a certain location?

And have them removed from the twelve when one dies?

And keeps on repeating until all twelve are dead ?

And having some other random crazy unit be created in the middle of the map ?

-----------------------------------

- ThonGod -

EDIT: What does " double free of location in "Trig_Camp_Elven_Actions" mean ? It appeared while i was testing the map once .
03-31-2008, 02:47 AM#15
Furion
Glad I could help, dude. Here are the answers to your other questions.

Quote:
Originally Posted by ThonGod
Would i do something similar to randomly select and create one of twelve special units at a certain location?

I would do something like this:
Trigger:
Untitled Trigger 001
Collapse Events
Map initialization
Conditions
Collapse Actions
Unit Group - Add Unit1 to SpawnTypeGroup
Unit Group - Add Unit2 to SpawnTypeGroup
Unit Group - Add Unit3 to SpawnTypeGroup
Unit Group - Add Unit4 to SpawnTypeGroup
Unit Group - Add Unit5 to SpawnTypeGroup
Unit Group - Add Unit6 to SpawnTypeGroup
Unit Group - Add Unit7 to SpawnTypeGroup
Unit Group - Add Unit8 to SpawnTypeGroup
Unit Group - Add Unit9 to SpawnTypeGroup
Unit Group - Add Unit10 to SpawnTypeGroup
Unit Group - Add Unit11 to SpawnTypeGroup
Unit Group - Add Unit12 to SpawnTypeGroup

In this one, each unit is a unit you put on the map (they can be invisible or hidden or whatever) that represents one of the 12 unit types you want to be placeable.

And then this:
Trigger:
Untitled Trigger 001
Collapse Events
Whenever
Conditions
Collapse Actions
Set TempUnit = (Random unit from SpawnTypeGroup)
Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Remove TempUnit from SpawnTypeGroup

Note: That goes in between the Set TempPoint = Wherever and the Unit Group - Add (Last Created Unit) lines of the trigger I posted in my last post.

Quote:
Originally Posted by ThonGod
And have them removed from the twelve when one dies?

I would remove it after it spawns like I do above, but you could do it when it dies, if you want.

Quote:
Originally Posted by ThonGod
And keeps on repeating until all twelve are dead ?

And having some other random crazy unit be created in the middle of the map ?

If you only add one unit initially instead of the three I gave in the Thunder Lizards example, it will behave exactly like you want. Now, trying to guess what you meant here, but if you wanted to create a random boss unit at the center of the map after all 12 are dead, you would have a BossTypeGroup, and you alter my trigger from the previous example to look like this:

Trigger:
Untitled Trigger 001
Events
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(SpawnTypeGroup is empty) Equal to True
Collapse Then - Actions
Set TempUnit = (Random unit from BossTypeGroup)
Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at TempPoint facing Default building facing degrees
Collapse Else - Actions
Set TempUnit = (Random unit from SpawnTypeGroup)
Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at TempPoint facing Default building facing degrees
Unit Group - Remove TempUnit from SpawnTypeGroup

Note: you would have to set up a BossTypeGroup like I did for SpawnTypeGroup.

Quote:
Originally Posted by ThonGod
EDIT: What does " double free of location in "Trig_Camp_Elven_Actions" mean ? It appeared while i was testing the map once .

I think it says you are having a problem with a trigger of yours called Camp Elven Actions. I don't know what double free of location means.