So I'm making an rpg map, and I'm trying to make a structure (lets say a spawning pool) auto-cast an ability to create a zergling when the Hero is near it, this way I can avoid writing numerous triggers for spawning. I'm a novice when it comes to the data editor, but I was looking through some of the categories trying to imagine how to make this effect occur. I tried making an ability with auto-cast, and made it and instant-effect ability. The effect of course would be to create a zergling. Unfortunately this did not work, and cant seem to figure what I'm missing. Perhaps someone with more knowledge than I, could help me with this one. Does the unit need to have a specific AI? Also I noticed there are some effects that do an area search, as well as a whole other Data category called Finders. Is anyone familiar with any of this stuff that might be able to tell me if I'm on the right track? Thanks for reading, happy mapping. :)
1. Create a new create unit effect that creates spawnable unit.
2. Create a validator that checks if a enemy hero is in range (or anything else that would detect a unit you control)
3. Create a new behaviour with
duration of 0 (means that it stays for ever)
set a period-duration of the interval in which you want the building to spawn the needed units (maybe zerglings)
add your previous create effect to the periodic effect
add your validator to the disable validator array
If you want the building to really "train" units then you have to exchange point 1 with an order effect that orders the unit to built your needed unit.
Alternatively it's quite easy with triggers too. You don't need to make a trigger for every spawning pool. Just one.
Create a trigger that fires on a periodic timer. Use the "Pick all units in unit group" event where the unit group is all units of type "Spawning Pool" owned by whatever player you want.
Create an "If Then Else" event with an If condition of "Closest Enemy Unit" where the distance is how far you want the range of this to be.
Lastly, the "Then" event should be how you want the zergling to spawn. Personally I'd recommend attaching larva to the spawning pool and having the trigger morph the larva into an egg, which would hatch into a zergling.
So I got the duration effect to work, but Im having trouble with the validator. I don't know exactly how to make one that detects my hero unit. Any ideas?
Thanks for the idea, I was trying my best to avoid triggers, and I hear that periodic timer triggers cause a lot of lag, that was one of my other reasons for trying to use the data editor only. I didn't know about pick unit before though and Im sure I'll use it in the future.
Well if you hero is "a hero" as unit typ then you need only a new EnumArea Validator.
Cause i have a non-english version i will sometimes use the raw data names to avoid same lingual issues.
So:
Go under Validator in the Data
Right click create new validator with validatortyp: CValidatorLocationEnumArea(raw data)
Under area declare an 360 degree area that search for more then 0 targets
Set the search filter to need heroic and enemy
only thing left should be to add this validator to your behaviour (and also add it to the unit)
Hope this helped you a little
P.S:
If you want only one unit typ to trigger the behaviour you can ignore the search filter and add an additional "sub" validator to area value of your validator. A validator for unit type is CValidatorUnitType in raw data. Should be selfexplaining
Edit: Awesome, that worked. That is going to save me a lot of trouble, now I want to add another feature to it, thought you might be able to help. I'd like it to spawn a different amount of enemies based on the number of players, would I be able to do that with validators? If so, would I need to make multiple validators?
Do you want it to spawn like 5 zerglings if one hero nearby but 10 zerglings if two heroes nearby?
Or do you want it to spawn 10 zerglings if there are 2 players playing and one or both of the heroes are nearby?
But if you planed only one hero per player it will be pointless and you can check simply for the amount of players in a region. The needed work for this is up to max amount of hero's on the map.
So if you want only to player with 1 hero each then you have only to do 2 validators and 2 effects per player + 1 switch effect.... if you play with up to 8 players with 1 hero each then it seems like you also need 8 validators and 8 effects + 1 switch effect.
The problem is that the data editor doesn't support mathematics & variables, as long blizzard don't implement such things it will always be a little messy with data.
Additional: switch effects does only support up to 8 different values... so you get only 8 different reponses for (8) different situations. Well in the end you can merge several switch effects so that you can expand them to 15 > 22 > 29 > 36 and so on (7*x-1+8 ;P)...
That is the point where the trigger editor starts to be needed...
Well there is one... other posibility in only data that hopefully will save some time.
You already have your effect in your behaviour that searches for nearby heroes remove the create zergling effect from it.
So you need:
an new behaviour that only stays for lets say 2 seconds.
an validator that checks if a unit isn't affected by your new behavior
an add behaviour effect that adds your new behaviour to a targeted unit
a set effect that merges the create 5 zerglings effect on the caster with the add behaviour effect to the target-unit.
an search area effect that searches for nearby heros that arent affected by your new behaviour it only searchs for 1 target and adds run's your new set effect.
An persitant effect that has periodes to the max amount of heros for your map and is able to finish all periodes in 2 seconds. This should triggers the search area effect for each periode.
So that you have saved creating 10 additional things ;)
So I'm making an rpg map, and I'm trying to make a structure (lets say a spawning pool) auto-cast an ability to create a zergling when the Hero is near it, this way I can avoid writing numerous triggers for spawning. I'm a novice when it comes to the data editor, but I was looking through some of the categories trying to imagine how to make this effect occur. I tried making an ability with auto-cast, and made it and instant-effect ability. The effect of course would be to create a zergling. Unfortunately this did not work, and cant seem to figure what I'm missing. Perhaps someone with more knowledge than I, could help me with this one. Does the unit need to have a specific AI? Also I noticed there are some effects that do an area search, as well as a whole other Data category called Finders. Is anyone familiar with any of this stuff that might be able to tell me if I'm on the right track? Thanks for reading, happy mapping. :)
1. Create a new create unit effect that creates spawnable unit.
2. Create a validator that checks if a enemy hero is in range (or anything else that would detect a unit you control)
3. Create a new behaviour with
If you want the building to really "train" units then you have to exchange point 1 with an order effect that orders the unit to built your needed unit.
Alternatively it's quite easy with triggers too. You don't need to make a trigger for every spawning pool. Just one.
Create a trigger that fires on a periodic timer. Use the "Pick all units in unit group" event where the unit group is all units of type "Spawning Pool" owned by whatever player you want.
Create an "If Then Else" event with an If condition of "Closest Enemy Unit" where the distance is how far you want the range of this to be.
Lastly, the "Then" event should be how you want the zergling to spawn. Personally I'd recommend attaching larva to the spawning pool and having the trigger morph the larva into an egg, which would hatch into a zergling.
@Demonette: Go
So I got the duration effect to work, but Im having trouble with the validator. I don't know exactly how to make one that detects my hero unit. Any ideas?
@Eiviyn: Go
Thanks for the idea, I was trying my best to avoid triggers, and I hear that periodic timer triggers cause a lot of lag, that was one of my other reasons for trying to use the data editor only. I didn't know about pick unit before though and Im sure I'll use it in the future.
Well if you hero is "a hero" as unit typ then you need only a new EnumArea Validator.
Cause i have a non-english version i will sometimes use the raw data names to avoid same lingual issues.
So:
only thing left should be to add this validator to your behaviour (and also add it to the unit)
Hope this helped you a little
P.S:
If you want only one unit typ to trigger the behaviour you can ignore the search filter and add an additional "sub" validator to area value of your validator. A validator for unit type is CValidatorUnitType in raw data. Should be selfexplaining
Thanks a lot! I'm gonna go try that out now. :)
Edit: Awesome, that worked. That is going to save me a lot of trouble, now I want to add another feature to it, thought you might be able to help. I'd like it to spawn a different amount of enemies based on the number of players, would I be able to do that with validators? If so, would I need to make multiple validators?
@Southpaw444: Go
Do you want it to spawn like 5 zerglings if one hero nearby but 10 zerglings if two heroes nearby? Or do you want it to spawn 10 zerglings if there are 2 players playing and one or both of the heroes are nearby?
Yeah... Helral is right that is very important.
But if you planed only one hero per player it will be pointless and you can check simply for the amount of players in a region. The needed work for this is up to max amount of hero's on the map.
So if you want only to player with 1 hero each then you have only to do 2 validators and 2 effects per player + 1 switch effect.... if you play with up to 8 players with 1 hero each then it seems like you also need 8 validators and 8 effects + 1 switch effect.
The problem is that the data editor doesn't support mathematics & variables, as long blizzard don't implement such things it will always be a little messy with data.
Additional: switch effects does only support up to 8 different values... so you get only 8 different reponses for (8) different situations. Well in the end you can merge several switch effects so that you can expand them to 15 > 22 > 29 > 36 and so on (7*x-1+8 ;P)...
That is the point where the trigger editor starts to be needed...
Well there is one... other posibility in only data that hopefully will save some time.
You already have your effect in your behaviour that searches for nearby heroes remove the create zergling effect from it.
So you need:
So that you have saved creating 10 additional things ;)
I hope i don't forget anything...