HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

rpg unit creat

07-28-2004, 11:30 PM#1
Crimsongg137
i was wondering how in rpgs when u enter a region unit spawn out and attack the hero.. how would u do that.. would u need a unit group i have no clue.. some 1 plz help
07-28-2004, 11:44 PM#2
Milkman
Your answer is a monster array, paired with a few variables and some loops.

Here's an example:
First the Array for the monsters:
Code:
Initialize Monster Spawners
    Events
    Conditions
    Actions
        Set NumSpawners = 5
        -------- Note that 'frequency' controls how often the monster spawns. --------
        -------- 1 frequency is 0.5 seconds.  4 frequency is 2 seconds.  8 frequency is 
        -------- 4 seconds 
        -------- By default it is 4 (2 seconds)  --------
        For each (Integer A) from 0 to NumSpawners, do (Set Frequencies[(Integer A)] = 8)
        For each (Integer A) from 0 to NumSpawners, do (Set MaxMonsters[(Integer A)] = 7)
        For each (Integer A) from 0 to NumSpawners, do (Set EnableSpawners[(Integer A)] = True)
        Set MonsterSpawners[0] = Gnoll Hut 0050 <gen>
        Set SpawnTypes[0] = Murloc Tiderunner
        Set EnableSpawners[0] = False
        Set MonsterSpawners[1] = Gnoll Hut 2 0046 <gen>
        Set SpawnTypes[1] = Murloc Tiderunner
        Set EnableSpawners[1] = False
        Set MonsterSpawners[2] = High Elven Farm 0053 <gen>
        Set SpawnTypes[2] = Gnoll Poacher
        Set EnableSpawners[2] = False
        Set MonsterSpawners[3] = High Elven Farm 0051 <gen>
        Set SpawnTypes[3] = Gnoll Poacher
        Set EnableSpawners[3] = False
        Set MonsterSpawners[4] = Forest Troll Hut 0041 <gen>
        Set SpawnTypes[4] = Satyr
        Set EnableSpawners[4] = False
        Set MonsterSpawners[5] = Nerubian Ziggurat 0080 <gen>
        Set SpawnTypes[5] = Ghoul
        Set EnableSpawners[5] = False
                -------- Set initial frequencies --------
        For each (Integer A) from 0 to NumSpawners, do (Set InitialFrequencies[(Integer A)] = Frequencies[(Integer A)])
        Trigger - Run Initialise Monster Groups <gen> (ignoring conditions)
        Trigger - Turn on Monster Spawn Sweep <gen>
        Trigger - Turn on Monster Spawn Death <gen>
Numspawners is the total amount of spawningpoints. Maxmonsters is the maximum amount of monsters on one spot simultanioulsy.
This next trigger makes it so that all the triggers won't have to check all the time:
Code:
Enable Spawn Set 1
    Events
        Unit - A unit enters StartMonsterSpawners1 <gen>
    Conditions
        ((Owner of (Entering unit)) is in Playersgroup) Equal to True
    Actions
        Set EnableSpawners[0] = True
        Set EnableSpawners[1] = True
        Set EnableSpawners[2] = True
        Set EnableSpawners[3] = True
For each section, of spawnpoints you can have a region that enables this when a unit enters, or several regions since for events, only one has to be true.

Next Trigger:
Code:
Initialise Monster Groups
    Events
    Conditions
    Actions
        -------- I only trust 'set variable' to initialise an Array type --------
        For each (Integer A) from 0 to NumSpawners, do (Trigger - Run Set Up One Monster Group <gen> (ignoring conditions))
Another trigger, theese tow can be combined however, blizzard thinks that this way is better, don't know why.
Code:
Set Up One Monster Group
    Events
    Conditions
    Actions
        Unit - Create 1 SpawnTypes[(Integer A)] for Player 12 (Brown) at (Position of MonsterSpawners[(Integer A)]) facing Default building facing (270.0) degrees
        Set MonsterGroups[(Integer A)] = (Last created unit group)

What theese two does is that they create the initial monsters. If you preplace all the units, the map can become quite laggy when editing.

The initialize respsawn trigger:
Code:
Monster Spawn Sweep
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 0 to NumSpawners, do (If (((MonsterSpawners[(Integer A)] is alive) Equal to True) and ((Number of units in MonsterGroups[(Integer A)]) Less than MaxMonsters[(Integer A)])) then do (Trigger - Run Spawn One Monster <gen> (ignoring conditions)) else do (Do nothing))
Here's the trigger for respawning:
Code:
Spawn One Monster
    Events
    Conditions
    Actions
        -------- Addition for turning them on and off --------
        If (EnableSpawners[(Integer A)] Equal to False) then do (Skip remaining actions) else do (Do nothing)
        -------- I spawn one monster every time 'frequency' gets to zero --------
        Set Frequencies[(Integer A)] = (Frequencies[(Integer A)] - 1)
        If (Frequencies[(Integer A)] Not equal to 0) then do (Skip remaining actions) else do (Do nothing)
        -------- I restore the frequency --------
        Set Frequencies[(Integer A)] = InitialFrequencies[(Integer A)]
        Unit - Create 1 SpawnTypes[(Integer A)] for Player 12 (Brown) at (Position of MonsterSpawners[(Integer A)]) facing (Random real number between 0.00 and 360.00) degrees
        Unit Group - Add all units of (Last created unit group) to MonsterGroups[(Integer A)]
        -------- We could even play a special effect, here. --------
        Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
This trigger just removes the units that die from the unit group.
Code:
Monster Spawn Death
    Events
        Unit - A unit owned by Player 12 (Brown) Dies
    Conditions
    Actions
        For each (Integer A) from 0 to NumSpawners, do (If (((Dying unit) is in MonsterGroups[(Integer A)]) Equal to True) then do (Unit Group - Remove (Dying unit) from MonsterGroups[(Integer A)]) else do (Do nothing))

That would work fine, note, all thees triggers come from the blizzard rpg Warchasers. It's always a good idea to look in there if you have a problem.
I wont give you variable types and so on as you can just CnP this from Warchasersm i've done enough writing for some time.

Hope i helped you out.
07-28-2004, 11:49 PM#3
Crimsongg137
ty man i love u
07-29-2004, 03:05 AM#4
Crimsongg137
Does any1 know how to creat units just like in final fantasy,,,
07-29-2004, 03:14 AM#5
HomerTheDragoon
Quote:
Originally Posted by Crimsongg137
Does any1 know how to creat units just like in final fantasy,,,

is that like where u kill the unit and later it comes back and is spawned where it was first created? :(
07-29-2004, 11:50 AM#6
Crimsongg137
nope the ff rpg way is when u enter a region and like 20 guys comes out and attacks u...
07-29-2004, 01:58 PM#7
Milkman
Events: A unit enters region Start Spawn
Conditions:
Actions:
Create 20 MonstersOfType at Wave1
Pick all units in Wave 1 and do issued order, attack move to Start Spawn.
Game - Display Message: Heads up, here they come!
07-29-2004, 02:19 PM#8
Crimsongg137
Quote:
Originally Posted by Milkman
Events: A unit enters region Start Spawn
Conditions:
Actions:
Create 20 MonstersOfType at Wave1
Pick all units in Wave 1 and do issued order, attack move to Start Spawn.
Game - Display Message: Heads up, here they come!
wait waht? u lost me there
07-29-2004, 03:30 PM#9
Crimsongg137
ur thinking about a td..
07-29-2004, 03:40 PM#10
Eeporgorg
Code:
Events
A unit enters spawn1 <gen>
Conditions
Entering unit is equal to Hero
Actions
Create 20 monstertype at random point in spawn1
Pick every unit in spawn1 <gen> belonging to neutral hostile and do order picked unit to attack entering unit

Something like that?
07-29-2004, 03:53 PM#11
Crimsongg137
yes.. but how would i spawn units lik in a group.. or the 1 above is good?
07-29-2004, 04:21 PM#12
Eeporgorg
You mean like just one big claud of units? It already does that. Please elaborate
07-29-2004, 06:13 PM#13
Crimsongg137
well i think i have it thanx every one for helping.. will any of u guys do try out the tour mode?
08-04-2004, 02:34 AM#14
Master-O-Chaos
i just do things like that like... Event-Unit enters region "region name"
Conditions- None
Actions-Create 20 (unit type) at random point in region "region in event"