Ok Mapster wizards, I have another issue that needs some solving.
I would like to have an item that, when carried, spawns 2 tanks at the position of the item carrying unit and orders them to follow that carrying unit.
It needs to check every 15 seconds to see if the tanks are still alive or not, if they are it should do nothing and if they are not it should re-spawn them. It should never allow for more than 2 tanks to be alive at the same time.
It also needs to work for more than one player, so if 2 players carry the item each should be spawning their own tanks.
What I tried to do was set up an item, Tank Beacon, with the behavior "Tank Beacon", that did nothing. Then, I figured that there could be a trigger to check to see if a unit has that behavior and if it does then spawn the tanks.
However, I'm stuck at that, and it doesn't seem to be working. Any suggestions?
first off, is it a single hero map? aka will a single player have more then 1 unit that can carry the beacon.
the biggest problem here is the test if there are 2 tanks in range of the unit carrying the item, well what are the limits? what if the hero is teleported? should it spawn 2 more tanks and kill the old ones? how far from the hero can the tanks get before they are no longer counted ect.
the easiest solution would be if there is only 1 person who can have the beacon, make a trigger that picks each unit in region entire map for player and add 1 to a counter variable for each unit found with type tank.
then if the counter = 2 do nothing, if it = 1 spawn 1 tank if it = 0 spawn 2 tanks ect.
the problem i see is when you involve multiple units who have the beacon, or if the tanks are controlled by a different player ect.
can you give some more info on exactly how you want it to work?
first off, is it a single hero map? aka will a single player have more then 1 unit that can carry the beacon.
the biggest problem here is the test if there are 2 tanks in range of the unit carrying the item, well what are the limits? what if the hero is teleported? should it spawn 2 more tanks and kill the old ones? how far from the hero can the tanks get before they are no longer counted ect.
the easiest solution would be if there is only 1 person who can have the beacon, make a trigger that picks each unit in region entire map for player and add 1 to a counter variable for each unit found with type tank.
then if the counter = 2 do nothing, if it = 1 spawn 1 tank if it = 0 spawn 2 tanks ect.
the problem i see is when you involve multiple units who have the beacon, or if the tanks are controlled by a different player ect.
can you give some more info on exactly how you want it to work?
It will be a single hero map. The player who has the beacon should not be able to command the units (maybe a flag that makes them unselectable).
I think the way I want this to work is going to be a bit too much to implement. An alternative might be that instead of the beacon spawning defenders that need to be checked over and over, it could spawn attack waves the go from the point of the hero to the enemy base. It would fit in with my map and would be much easier to implement.
For that would I just run a trigger that checks to see if the item behavior is present on a hero, and if so, creates units at that point and orders them to attack?
make an array of ur players heroes <this is type unit>
make an array of tankunitgroup <this is type unit group>
In the periodic event use
pick each player loop
an if statement condition heroArray[picked player] inventory item carried for your beacon item.
then a while loop with condition unit count for player (tanks <2)
the actions in the loop is spawn tank and
add last created unit to tankUnitGroup[picked player]
then after the loop just order the tankUnitGroup[picked player] to scan move to the heroArray[picked player]
ugh, im not satisfied with my answer. And for this post, sry for all the spaces. for some reason I cant get the forum to just go to the next line for me. hmm
Global Variables
heroArray[4] = no unit;
tankUnitGroup[4] = no unit; The number 4 should be changed according to how many players you have
Map Initialization Trigger
Pick Each Player in (All Players)
{
spawn hero unit for (picked player);
heroArray[picked player] = (last created unit);
}
Periodic Tank Check Trigger
Event(Every 15 game seconds)
Actions->
pick each player in (all players)
{
if (heroArray[picked player] is carrying in inventory *your item*)
{
while(unit count for player (picked player) - define the unit as your tank - < 2)
{
create tank unit for player (picked player);
add (last created unit) to tankUnitGroup[picked player];
}
Issue order (scan move) to (tankUnitGroup[picked player];
}
}
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Ok Mapster wizards, I have another issue that needs some solving.
I would like to have an item that, when carried, spawns 2 tanks at the position of the item carrying unit and orders them to follow that carrying unit.
It needs to check every 15 seconds to see if the tanks are still alive or not, if they are it should do nothing and if they are not it should re-spawn them. It should never allow for more than 2 tanks to be alive at the same time.
It also needs to work for more than one player, so if 2 players carry the item each should be spawning their own tanks.
What I tried to do was set up an item, Tank Beacon, with the behavior "Tank Beacon", that did nothing. Then, I figured that there could be a trigger to check to see if a unit has that behavior and if it does then spawn the tanks.
However, I'm stuck at that, and it doesn't seem to be working. Any suggestions?
Thanks in advance!
@Kreusser: Go
this will largely depend on a couple things.
first off, is it a single hero map? aka will a single player have more then 1 unit that can carry the beacon.
the biggest problem here is the test if there are 2 tanks in range of the unit carrying the item, well what are the limits? what if the hero is teleported? should it spawn 2 more tanks and kill the old ones? how far from the hero can the tanks get before they are no longer counted ect.
the easiest solution would be if there is only 1 person who can have the beacon, make a trigger that picks each unit in region entire map for player and add 1 to a counter variable for each unit found with type tank.
then if the counter = 2 do nothing, if it = 1 spawn 1 tank if it = 0 spawn 2 tanks ect.
the problem i see is when you involve multiple units who have the beacon, or if the tanks are controlled by a different player ect.
can you give some more info on exactly how you want it to work?
It will be a single hero map. The player who has the beacon should not be able to command the units (maybe a flag that makes them unselectable).
I think the way I want this to work is going to be a bit too much to implement. An alternative might be that instead of the beacon spawning defenders that need to be checked over and over, it could spawn attack waves the go from the point of the hero to the enemy base. It would fit in with my map and would be much easier to implement.
For that would I just run a trigger that checks to see if the item behavior is present on a hero, and if so, creates units at that point and orders them to attack?
Dont give up man. You can make this happen.
Here is a summarization
make an array of ur players heroes <this is type unit> make an array of tankunitgroup <this is type unit group>
In the periodic event use
pick each player loop an if statement condition heroArray[picked player] inventory item carried for your beacon item. then a while loop with condition unit count for player (tanks <2) the actions in the loop is spawn tank and add last created unit to tankUnitGroup[picked player]
then after the loop just order the tankUnitGroup[picked player] to scan move to the heroArray[picked player]
ugh, im not satisfied with my answer. And for this post, sry for all the spaces. for some reason I cant get the forum to just go to the next line for me. hmm
Global Variables
heroArray[4] = no unit; tankUnitGroup[4] = no unit; The number 4 should be changed according to how many players you have
Map Initialization Trigger
Pick Each Player in (All Players)
{
spawn hero unit for (picked player);
heroArray[picked player] = (last created unit);
}
Periodic Tank Check Trigger
Event(Every 15 game seconds)
Actions->
pick each player in (all players)
{
if (heroArray[picked player] is carrying in inventory *your item*)
{
while(unit count for player (picked player) - define the unit as your tank - < 2)
{
create tank unit for player (picked player);
add (last created unit) to tankUnitGroup[picked player];
}
Issue order (scan move) to (tankUnitGroup[picked player];
}
}