• 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.

Respawn problems

Status
Not open for further replies.
Level 3
Joined
Mar 23, 2010
Messages
46
I've got a traceline shooter and it's almost complete, but I am faced with a few problems...
1. Can I create an anti spawn region inside a spawning region?
2. Is there a way to spawn the unit in multiple different regions? (When my marine dies I want the system to pick a random region, not a random point in in one region...
Here is my current respawn trigger BTW:
  • Events
    • Unit - PlayerUnit[0] dies
  • Local Variables
  • Conditions
  • Actions
    • General - Wait 3.0 Real Time seconds
    • Unit - Create 1 Marine for player 1 at (Random point in map) facing (Center of map offset by (0.0, 0.0)) (No Options)
    • Variable - Set PlayerUnit[0] = (Last created unit)
    • UI - Set boss bar 1 boss to PlayerUnit[0] (Do refresh the boss bar)
3. Think there is a way to create a more advanced respawn trigger?

That's it for now, I may come across more problems as I test it so keep looking at the post. Thank you in advance for politely answering!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1. Can I create an anti spawn region inside a spawning region?
You need to define what a "spawning region" and an "anti spawn region" are.

2. Is there a way to spawn the unit in multiple different regions? (When my marine dies I want the system to pick a random region, not a random point in in one region...
Here is my current respawn trigger BTW:
Yes, you create a list of regions (using an array) and then randomly choose a region from the list. Be aware this approach would give all regions equal weight.

In an initialization trigger, you set indicies of a region array to all the respawn regions (leaving no blank indicies). Then when you need a random region, you look up a random index from the array (thus a random region). The random index is logically in the range of 0 and the last index used (inclusive).

I do not understand your current trigger. "Unit - PlayerUnit[0] dies" should be attaching it to null unless you somehow initialize your array to a unit before the event is hooked.

3. Think there is a way to create a more advanced respawn trigger?
Ofcourse there is. You can script a respawn system as complex as you want. You just need to set your aims for what your respawn system must do and then design an implimentation for it.
 
Think there is a way to create a more advanced respawn trigger?

Event -> (Unit) Dies
Condition ->
Action -> Create 1 Marine for Player# at (Centre of (SpawnRegion))

Event -> Every 1 Game Time Seconds
Condition -> (Abs(SetMove1)) = 1
Action -> Move (SpawnRegion) to (Position 2) immediately.

Event -> Every 1 Game Time Seconds
Condition -> (Abs(SetMove1)) = 1
Action -> Set SetMove1 = 2

-or-

Event -> Every 1 Game Time Seconds
Condition ->
Action -> Set SetMove1 = (Random Integer (Between 1 and 4))

The idea is (for example) you have 4 spots that your unit will be 'randomly' spawned at.
You create 4 regions (one for each spot) and label them Position 1 - 4.
Every 1 second move your spawning region to one of the position regions.
The effect is essentially random (more so if you use the -or- trigger).

I'm sure there are easier ways of doing it.. infact now that I think (lol) it could be also done with:

Event -> Every 1 Game Time Seconds
Condition ->
Actions -> Set SpawnPosition = (Random Integer (Between 1 and 4))

Event -> (Unit) Dies
Condition -> (Abs(SpawnPosition)) = 1
Action -> Create 1 Marine for Player# at (SpawnPoint1)

Event -> (Unit) Dies
Condition -> (Abs(SpawnPosition)) = 2
Action -> Create 1 Marine for Player# at (SpawnPoint2)

Etc.

My triggers tend to be crude but effective and reliable if done properly.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Rispetto, you just need to roll a new random every time you need a random region. Running it every second wastes time when no one needs to be respawned and can cause 2 respawns occuring at once to respawn at the same place.

Thus you basically need 1 trigger instead of the 3 you recommend.

Also remember that events are limited in SC2. I do not think you can have many any unit dies events.

You can get around this, I believe, by using specific unit events.
 
Level 3
Joined
Mar 23, 2010
Messages
46
You need to define what a "spawning region" and an "anti spawn region" are.

A spawning region meaning the region(s) a unit is going to respawn in. So I guess you could also call it a respawning region.

When I say anti-spawn I mean a created region inside the respawn region that does not let a unit respawn there.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Depending how complex the region is, a random point in the region should work. However there is always the chance it will get a 0,0 point in which case you would be best to spawn in a safe non-random point in the region.

Basically...
Get random point in region.
If random point fails,get safe constant point.
Spawn at point.
 
Level 3
Joined
Mar 23, 2010
Messages
46
Bump....
i'm gonna need more than two opinions for this...
BTW: I just came across another error. For some reason the game just created another marine, even though my current marine is still alive! The camera switched over but the gun trigger didn't switch to the new marine...
 
Level 3
Joined
Mar 23, 2010
Messages
46
Nevermind, I have solved the problem
The extra marine spawned due to an error with variables(variable2=variable1=playerunit)
I used Rispetto's trigger suggestion, edited it, and finally made the unit randomly respawn.
Thanks everyone!
 
Status
Not open for further replies.
Top