• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[REQUEST] Advanced Spawn System

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
[REQUEST] Spawn System

Basic explanation:
I need an spawn system where specific units spawn on specific regions, wich are located at an a specific distance from hero.

Complete Explanation

Lets say that we have a wood, and we have a beach, one next to the other. If the Hero is in the woods, spiders spawn at a random point in 800 AoE from the hero position and are ordered to attack The point in the center of the Hero's position (Not the hero). If the hero is in the beach, Murlocs spawn the same way.

BUT..

If the unit is between the Wood, and the Beach (Outside the areas, right in the middle of them) then Both spawn areas would be activated, so Spiders and Murclos should spawn.

This should happen every second one of the Spawning Regions are in 800 distance from the hero's position., and by chance (10% chance of spawning from any of the SpawningRegions in range)

Spawning is turned off if number of creeps at 800 distance from hero is equal to 2.

Also, creeps that are left behind, die. This means that if a creeps is standing doing nothing for 10 seconds, it gets removed from game.

ASKING

Is it possible? How can I do that?.


I've been trying to do this for a while but haven't found the way.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
I meant spawn Enemy Creeps :p The system would have to detect when any hero is inside an specific region and spawn enemies in a radius of 800 from the position of the unit, and order that unit to attack to the position of the unit (Not the unit) also the unit has to be created inside of the same region the hero is, and remove any enemy unit out of 1000 radius of any hero. :p. This has to work for various heros.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
you can use random point in region if you want to "suprise" the hero

  • Spawn trigger
    • Events
      • Unit - A unit enters Region 001 <gen>
      • Unit - A unit enters Region 000 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 001 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Create 5 Knight for Neutral Hostile at (Center of Region 000 <gen>) facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Create 5 Knight for Neutral Hostile at (Center of Region 001 <gen>) facing Default building facing degrees
        • Else - Actions
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It would only trigger on the entering of the unit, not while the unit is inside... I would have to set some variables: V=Variable
  • Event: Every 1 second of time.
  • Condition: Hero is in Woods <gen>
  • Condition: Units in V4 Owned by Neutral Hostile Less or Equal to 3 < This is the max quantity of hostiles allowed around heroes.
  • Set V1 Creep Spawn = Random point around 800 from the hero
  • Set V2 Position of Last Created Unit.
  • Set V3 Hero Position = Center of Region around the Hero
  • Set V4 Region around hero = Region of 1000 around the Hero.
  • Action: Create Unit at V1 facing X
  • Action: Create Special Effect at position of V2
  • Action: Destroy last created special effect.
  • Action: Order last created unit to Move-attack V3
  • Action: Pick everyunit in playable map area and do:
    • - If Unit is in V4 equal to False
    • - Then: Remove unit from game.
    • - Else: Do nothing.
  • Script: call RemoveLocation(udg_V1)
  • Script: call RemoveLocation(udg_V2)
  • Script: call RemoveLocation(udg_V3)
  • Script: set bj_wantDestroyGroup = true
Something like that... I guess.. What do you think about?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Maybe the other event, the Timer that runs out, and everytime it reaches to 0 it can trigger, and gets deactivated is no unit is in region.
 
Level 8
Joined
Apr 26, 2011
Messages
403
Code:
Try is this way :

Variable:
Forest_group
Beach_group
Temp_group
temp_point
temp_point2

Creep_group
Expired_group



Enter Forest Trigger:
Event
Unit - a unit enters Region_Forest
Condition
Triggering unit is a Hero equal true
Action
Add trigger unit to Forest_Group 


Enter Beach Trigger:
Event
Unit - a unit enters Region_Beach
Condition
Triggering unit is a Hero equal true
Action
Add trigger unit to Beach_Group 


// this trigger will spawn creep
// after spawn, it will remove hero group group so it only spawn once
// if hero repeat enter multiple time, it won't spawn more than 2 creep 
Period Event:
every 1 second
condition
(Or condition)
units in Beach_Group > 0  OR
units in Forest_Group > 0 
Action
for every unit in Beach_group
  temp_group = select all unit around 800 range of pick unit
  temp_point = random point around 800 range of pick unit
  temp_point2 = position of pick unit
  if unit in temp_group >=2
     remove pick unit from Beach_group //so it won't spawn if >=2
  else
     spawn 1 Murclos  at temp_point
     order last created unit attack move to temp_point2 //you said attack hero's position
     add last created unit to Creep_group
  destory temp_group
  remove temp-point
  remove temp_point2

for every unit in Forest_Grpip
  blah blah ... same code as above
 

// this trigger will remove unit that stand there doing nothing
Period Event:
every 10 second
condiction
(Or condiction)
units in creep_Group > 0  OR
units in expired_Group > 0 
Action
for every unit in expired_group
   remove unit from game
for every unit in creep_group
   if pick_unit's action with target = null
      add unit to expired_group


// this trigger will prevent unit from expired if hero come back to attack unit in 9 second
unit attack trigger
Event
Unit -a unit is attacked
Condition
Attacking unit is type of creep
Action
remove triggering unit from expired_group
add triggering unit to creep_group
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
EDIT:

There are some things I didn't found as HuanAk said, but tried my best to do this:

  • Unit enters Wood
    • Events
      • Unit - A unit enters Woods <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to Wood_Group
  • Creep Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Number of units in Wood_Group) Greater than 0
    • Actions
      • Unit Group - Pick every unit in Wood_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Group = (Units within 800.00 of (Position of (Picked unit)))
          • Set Temp_Point = (Random point in (Region centered at (Position of (Picked unit)) with size (1000.00, 1000.00)))
          • Set Temp_Point2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in Temp_Group) Greater than or equal to 2
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Wood_Group
            • Else - Actions
              • Unit - Create 1 (Random level (Random integer number between 1 and 5) creep unit-type) for Neutral Hostile at Temp_Point facing (Position of (Triggering unit))
              • Unit - Order (Last created unit) to Attack-Move To Temp_Point2
              • Unit Group - Add (Last created unit) to Creep_Group
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_Temp_Poin2t)
      • Custom script: set bj_wantDestroyGroup = true
  • AFK Creep Remove
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Number of units in Creep_Group) Greater than 0
          • (Number of units in Expired_Group) Greater than 0
    • Actions
      • Unit Group - Pick every unit in Expired_Group and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Pick every unit in Creep_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
            • Then - Actions
              • Unit Group - Add (Triggering unit) to Expired_Group
            • Else - Actions
  • Unit Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of (Attacked unit))) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from Expired_Group
      • Unit Group - Add (Triggering unit) to Creep_Group
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Finally, I found a way to solve the problems that the current spawn system in discussion carries. Solution = A different Spawn System. I'd like to ask you for help making this.

As you know, most RPG in SNES have a "World Map", and the Hero walks around and randomly gets into combat with random units from that area, but that combat takes place in a different screen. This screen has the enemy units, the player units, and the console to select the commands, etc. (Pokemon, Final Fantasy, Dragon Quest, Lufia, etc., they're all the same). The combat also takes place in a theme like the one you are standing it in the World Map. If you are in a beach, the combat scene looks like a beach, and so on. When the combat ends, Item and Exp are given, and the unit goes back to where it was in the World Map.

I want to simulate this in Warcraft. (From now on, i'll speak so the dumbest can understand)

In the World Map (Common play map) I made a Wood, but also made a little square in the bottom of the Playable map area with a "Wood theme", this is the "Wood Combat Zone". This area has a Region to move the heroes to, a region to spawn the creeps, and a region to leave that place.

Also in the World Map, made four little regions in the entrance and in the exit (two on each, one for "Enter Wood" and another to "Leave Wood"). When the Unit enters the wood, it's added to "Wood_Group". Every second, there's a 15% chance to engage a combat with "Wood_Creeps". When the units engage in combat, their positions inside the World Map are saved, and they're all moved to random point in 'HeroAppear Wood_Region' (The region in the WoodCombat zone where heroes are supposed to be moved to), and Creeps are spawned at the other side of the small island, in the 'CreepSpawn Wood_Region'. Behind that 'CreepSpawn Wood_Region' is the 'Escape/Exit'. When all the heroes in WoodGroup are in that 'Escape/Exit' region, they're all restored to their original positions in the world map. (Loot system, battle system, etc. are independent of this system, so, I won't discuss these here)

I'd like to know how you'd suggest me to make this work :) I have no idea about saving each hero in Wood_Group position, neither how to restore that position later xD

EDIT:

I made a trigger wich moves the heroes in Wood_Group to WoodHeroSpawn, also created the Hostile Units like this:
  • Unit - Create (Random integer number between 1 and ((Number of units in Wood_Group) x 2)) (Random level (Random integer number between 1 and 5) creep unit-type) for Neutral Hostile at Temp_Point3 facing Temp_Point2
in the right region, But doesn't work. It creates two units, but two of the same type, and in the same position. Need a fix please.

I can't make the "Escape/Exit" region work =/... I guess it's because I don't know how to save the Picked Units in Wood_Group positions, and how to Restore that position when Number of Units in Wood_Group is = to Number of Units in Wood_Escape =/
 
Last edited:
Status
Not open for further replies.
Top