• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[TRIGGER] Spawn system.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Spawn System / Loot system.[/b]
  • Hi!
  • I made a basic creep spawn system for RPG purpose, but i'm having trouble setting the custom drops for each unit.
  • [TRIGGER]Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in (Units in (Region centered at (Position of Spawner) with size (1000.00, 1000.00)) owned by Neutral Hostile)) Less than or equal to 2
    • Actions
      • -------- ----------------------------------------------------------------------------------------- --------
      • -------- Position of the Hero (Spawner) and the Creep (Spawned) --------
      • -------- ----------------------------------------------------------------------------------------- --------
      • Set Point1 = (Position of Spawner)
      • Set CreepPosition = (Position of (Last created unit))
      • -------- ----------------------------------------------------------------------- --------
      • -------- SpawnRegions and Creeps that spawn there. --------
      • -------- ----------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((WoodA1to3 <gen> contains Spawner) Equal to True) or (((WoodB1to3 <gen> contains Spawner) Equal to True) or ((WoodC1to3 <gen> contains Spawner) Equal to True))
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Unit - Create 1 (Random level (Random integer number between 1 and 3) creep unit-type) for Neutral Hostile at (Random point in (Region centered at (Position of Spawner) with size (600.00, 600.00))) facing Default building facing degrees
          • Special Effect - Create a special effect at Point2 using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
          • Unit - Order (Last created unit) to Attack-Move To (Position of Spawner)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spawner is in (Units in WoodD1to5 <gen>)) Equal to True
        • Then - Actions
          • Unit - Create 1 (Random level (Random integer number between 1 and 5) creep unit-type) for Neutral Hostile at (Random point in (Region centered at (Position of Spawner) with size (600.00, 600.00))) facing Default building facing degrees
          • Special Effect - Create a special effect at Point2 using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
          • Unit - Order (Last created unit) to Attack-Move To (Position of Spawner)
        • Else - Actions
      • -------- -------------------------------------------------------------- --------
      • -------- Removing Creeps Outside Spawn Area --------
      • -------- -------------------------------------------------------------- --------
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at (Position of Spawner) with size (800.00, 800.00)) contains (Picked unit)) Equal to False
              • ((Picked unit) is in (Units in Fire extinct <gen>)) Equal to False
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • -------- --------------------- --------
      • -------- Leak remove --------
      • -------- --------------------- --------
      • Custom script: call RemoveLocation (udg_Point1)
      • Custom script: call RemoveLocation (udg_Point2)
So, whenever the unit is in the woodsA, B, or C regions (Three regions inside the same wood), random creeps from that level range will have a chance to appear in a random point of 600 around the hero, and automatically attack to the center of the area (wich is nearly the position of the hero)

If any unit is outside the 800 range, They will be removed. If the unit is in Region D of the wood, the range increases to lvl 5 (including some stronger mobs).

Its pretty basic, if someone want to suggest a better way to do it, or to fix some issue, i would be please, but what i'm really asking for is for a way to set the drops that each creep drop.
 
Last edited:
Level 4
Joined
Aug 8, 2011
Messages
84
As for dropping items, you should create items at the position of a unit when it dies. I like to use an array of item types I want dropped, and use a random integer to figure out which item in that array should be dropped.

For example:

Just check if a unit is controlled by a player whose units should drop items when it dies, if it does, decide via a random integer if it should drop something, if it should, then decide via another random integer what it should drop.
 
Level 4
Joined
Aug 8, 2011
Messages
84
I don't know why you'd need to add the units to an array. Just the items. This way you could do:

A unit Dies:

if an item should drop:

set random = 1 to ItemArraySize
create 1 ItemArray[random] at position of dying unit
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I understand, but don't understand, both at the same time, and viceversa =)
Would you create demo map for this? I would really appreciate it. (I'm not very good with variables yet)

Right now I was thinking on making sorts of triggers for each drop type, and making categories by item levels.

Trigger to: (By same chance)
- Creeps between lvl 1 and 8 drops Healing Potion (level1), (Would exclude, and Add in a If/Then/Else with lower chance other items between same level range.)
- Creeps between lvl 9 and 17 Drops Healing Potion (level 2), (Would exclude, and Add in a If/Then/Else with lower chance other items between same level range.)
- Creeps between lvl 18 and 27 drops Healing Potion (level 3), (Would exclude, and Add in a If/Then/Else with lower chance other items between same level range.)
- Creeps between lvl 26 and 35 drops healing potion (level 4), (Would exclude, and Add in a If/Then/Else with lower chance other items between same level range.)
- Creeps between lvl 36 and 50 Drops Healing Potion lLevel 5), (Would exclude, and Add in a If/Then/Else with lower chance other items between same level range.)

- I could also exclude items by region (Dying unit is in region 'Wood)
- I Could exclude specific special items, and add them with lower chance, etc..

All triggered the ol' way :p

Etc... =) I know that variables would do a better job, i just need to know how to =)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok maker, I remade the Trigger, but i'm having some trouble, i'd like you (or someone else) could help me.

This is what I have:
  • Creep Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- Random Point Around the Hero -------- Used to spawn creeps. --------
      • Set RandomPointAroundHero = (Random point in (Region centered at (Position of Heroes[(Integer A)]) with size (1000.00, 1000.00)))
      • -------- Position of the Hero -------- Used to order creeps attack that point. --------
      • Set HeroPosition = (Center of (Region centered at (Position of Heroes[(Integer A)]) with size (1000.00, 1000.00)))
      • -------- Region Aroudn the Hero -------- Used to remove creeps that are far away from heroes. --------
      • Set RegionAroundHero = (Region centered at (Position of Heroes[(Integer A)]) with size (1000.00, 1000.00))
      • -------- Number of units in region around the hero -------- Used to set the max amount of monster that can be created around each heroe. --------
      • Set MaxUnitsAroundHero = (Number of units in (Units within 800.00 of (Position of Heroes[(Integer A)]) matching (((Matching unit) belongs to an enemy of (Player((Integer A)))) Equal to True)))
      • -------- The Hero --------
      • -------- I DONT KNOW HOW TO MAKE THE ARRAY TO INCLUDE THE HERO EACH PLAYER HAS --------
      • -------- Spawn Action --------
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MaxUnitsAroundHero Less than or equal to 2
              • (Random integer number between 1 and 100) Less than or equal to 15
            • Then - Actions
              • Unit - Create 1 (Random level (Random integer number between 1 and 3) creep unit-type) for Neutral Hostile at RandomPointAroundHero facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To HeroPosition
              • Special Effect - Create a special effect at PositionOfLastCreatedUnit using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in (Units owned by Neutral Hostile)) Equal to True
              • (RegionAroundHero contains (Picked unit)) Equal to False
              • ((Picked unit) is in (Units in Fire extinct <gen>)) Equal to False
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • Custom script: call RemoveLocation(udg_RandomPointAroundHero)
      • Custom script: call RemoveLocation(udg_PositionOfLastCreatedUnit)
As you can see, I don't know how to include each player hero inside a Variable to be used later. I guess that Heroes[(Integer A)]) is wrong, as other stuff too.

I didn't include the Call RemoveLocation[udg_Heroes[bj_LoopAIndex] because I don't even have The Heroes Index... I'm really blowing my mind here.

What's left to do to make the trigger work as it's intended?: Create max 2 creeps for each hero, at a random point around 800 of each hero, order to Move-Attack the center of the region (Near to the hero), and remove creeps that are further away than 1000 from any of the heroes... =.( :goblin_cry:
 
Status
Not open for further replies.
Top