I want to put a "random generator" in my map. When the game starts, there is 33% chance that the generator spawns a Zergling, 33% to spawn a marine and 33% to spawn something else.. Then the generator vanishes..
This could potentially be done in multiple ways. Here's the best. Create a unit with a behavior that triggers an Initial Effect (or an Expire Effect with a duration if you don't want itnto go off right away). This effect should be a Set, with three effects, each one a Create Unit that spawns a different unit. Then check the flag on the Set for "Random Effect". There might also be a setting to tell it how many effects from the set to execute, I forget. Then simply give the behavior to the spawner unit and place the unit somewhere on the map.
To make the unit vanish afterwards, add a Final Effect to the hehavior that executes a Damage effect. In the effect, flag "Kill Unit" "No Kill Credit" and set the death type to what yoy want (probably Remove).
This could potentially be done in multiple ways. Here's the best. Create a unit with a behavior that triggers an Initial Effect (or an Expire Effect with a duration if you don't want itnto go off right away). This effect should be a Set, with three effects, each one a Create Unit that spawns a different unit. Then check the flag on the Set for "Random Effect". There might also be a setting to tell it how many effects from the set to execute, I forget. Then simply give the behavior to the spawner unit and place the unit somewhere on the map.
To make the unit vanish afterwards, add a Final Effect to the hehavior that executes a Damage effect. In the effect, flag "Kill Unit" "No Kill Credit" and set the death type to what yoy want (probably Remove).
Thanks. Can you explain it step by step or more in detail?
What shall the Event, Condition and Action be?
Event, condition, and action are for TRIGGERS. This is the DATA EDITOR forum. You can do this with triggers, but doing it in the data editor is wiser and reduces lag. Re-read what I said while looking at the Data editor, and maybe it will make more sense.
Event, condition, and action are for TRIGGERS. This is the DATA EDITOR forum. You can do this with triggers, but doing it in the data editor is wiser and reduces lag. Re-read what I said while looking at the Data editor, and maybe it will make more sense.
Honestly, for this kind of one-time actions, I would just use a trigger here. The difference in performance will be absolutely insignificant and it won't justify creating stuff like a dummy unit, effects and behaviors. However, I agree that this is the data forum, which should provide a data solution.
The 2nd post explains a detailed data solution, and the 4th provides the complete trigger, choose your favourite ;)
Oh, you are right. I missunderstood. I thought it should be created as a trigger, for some reason. I will try to make it as a trigger.
1. I want to change the "point to spawn at" to a dummy unit on the map. If I place 5 dummy units on the map, the trigger will generate a unit at the location of each dummy unit. How can this be done?
2. Let say I add a total of 100 values. If value 0,1,2 spawns a unit, and value 4-99 spawns nothing, that will mean that there is a 3% chance to spawn a unit, right? If so, will that cause a lot of lag?
(Cause I want to have a chance that the trigger spawns nothing at all at a dummy unit.)
This will random for each point/dummy unit, if you want random types to be same per trigger run then:
UntitledTrigger001EventsTimer-Elapsedtimeis1.0GameTimesecondsLocalVariablesUnitTypeArray=NoGameLink<GameLink-Unit[2]>
intVar = (Random integer between 0 and 2) <Integer>
Conditions
Actions
Variable - Set UnitTypeArray[0] = Zergling
Variable - Set UnitTypeArray[1] = Marine
Variable - Set UnitTypeArray[2] = Zealot
Unit Group - Pick each unit in (Nova units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Create 1 UnitTypeArray[intVar] for player 15 at (Position of (Picked unit)) facing 270.0 degrees (No Options)
I want to have a small chance for each individual dummy unit to spawn a unit. Is the last trigger meant to do that or am I making something wrong? Because right now all dummy unit spawns the same thing, even though it is random.
(By the way, thank you so much for helping us with this!)
First trigger will spawn random unit per every dummy unit.
Second trigger will chose which unit to spawn and spawn that unit for all dummy units
Ok, hm.. The first trigger is good because it spawns a random unit per every dummy unit. But I need to add a chance that nothing gets spawned at all for every dummy unit. I have tried for a hour now but I can´t get it to work.
Let´s say there are 5 dummy units placed on the map. It may look like this when the game starts:
I want to put a "random generator" in my map. When the game starts, there is 33% chance that the generator spawns a Zergling, 33% to spawn a marine and 33% to spawn something else.. Then the generator vanishes..
How can this be done?
@Kabelkorven: Go
This could potentially be done in multiple ways. Here's the best. Create a unit with a behavior that triggers an Initial Effect (or an Expire Effect with a duration if you don't want itnto go off right away). This effect should be a Set, with three effects, each one a Create Unit that spawns a different unit. Then check the flag on the Set for "Random Effect". There might also be a setting to tell it how many effects from the set to execute, I forget. Then simply give the behavior to the spawner unit and place the unit somewhere on the map.
To make the unit vanish afterwards, add a Final Effect to the hehavior that executes a Damage effect. In the effect, flag "Kill Unit" "No Kill Credit" and set the death type to what yoy want (probably Remove).
Thanks. Can you explain it step by step or more in detail? What shall the Event, Condition and Action be?
he's talking about data editor not triggers.
If you want in triggers it would be something like:
Adjust Event, Point to spawn at, and player
@Kabelkorven: Go
Event, condition, and action are for TRIGGERS. This is the DATA EDITOR forum. You can do this with triggers, but doing it in the data editor is wiser and reduces lag. Re-read what I said while looking at the Data editor, and maybe it will make more sense.
Honestly, for this kind of one-time actions, I would just use a trigger here. The difference in performance will be absolutely insignificant and it won't justify creating stuff like a dummy unit, effects and behaviors. However, I agree that this is the data forum, which should provide a data solution.
The 2nd post explains a detailed data solution, and the 4th provides the complete trigger, choose your favourite ;)
Oh, you are right. I missunderstood. I thought it should be created as a trigger, for some reason. I will try to make it as a trigger.
1. I want to change the "point to spawn at" to a dummy unit on the map. If I place 5 dummy units on the map, the trigger will generate a unit at the location of each dummy unit. How can this be done?
2. Let say I add a total of 100 values. If value 0,1,2 spawns a unit, and value 4-99 spawns nothing, that will mean that there is a 3% chance to spawn a unit, right? If so, will that cause a lot of lag?
(Cause I want to have a chance that the trigger spawns nothing at all at a dummy unit.)
Then you need to iterate thru all your "dummy units" like this: (let's say 'Nova' is your dummy unit)
note "(Position of (Picked unit))"
This will random for each point/dummy unit, if you want random types to be same per trigger run then:
I want to have a small chance for each individual dummy unit to spawn a unit. Is the last trigger meant to do that or am I making something wrong? Because right now all dummy unit spawns the same thing, even though it is random.
(By the way, thank you so much for helping us with this!)
First trigger will spawn random unit per every dummy unit.
Second trigger will chose which unit to spawn and spawn that unit for all dummy units
Ok, hm.. The first trigger is good because it spawns a random unit per every dummy unit. But I need to add a chance that nothing gets spawned at all for every dummy unit. I have tried for a hour now but I can´t get it to work.
Let´s say there are 5 dummy units placed on the map. It may look like this when the game starts:
Dummy unit #1 spawns a Zergling.
Dummy unit #2 spawns a Hydralisk.
Dummy unit #3 spawns a Zergling.
Dummy unit #4 spawns nothing.
Dummy unit #5 spawns nothing.
Whatever you want to happen by chance you put inside IF with random number condition :
where 30 is your chance, here meaning 30% (you leave Else: empty)