Hi, I would like to know how to delete a ping once a unit walks in a region (I have 10 pings to remove) please add a screenshot or 2 to show me what it would look like.
if its a continuous looping ping simply re-script to "if(unit is not in region) Then {Ping} Else {}"
if its an infinitely long ping. create a global variable when you first make the ping set the variable to the last created ping, when the unit enters the region destroy the ping.
1. A way to create and register the pings and zones.
You'll need three variables:
An arrayed variable, dimensions 1, size 100, type region. We'll call it "Zones"
An arrayed variable, dimensions 1, size 100, type ping. We'll call it "Pings".
A non-arrayed variable, type integer, set to 0. We'll call it "Counter".
First we need to create a trigger that registers each zone (region) that you've created in the terrain module.
Create a trigger, map initialization.
Create the action Modify Variable. With this, modify the variable Counter to be +1 of it's self.
Create the action called Set Variable. Set the region variable called Zones variable to your first zone. For the integer value in the array, use the variable Counter that we created earlier.
Create the ping at the center of region, Zones [Counter].
Create another action called Set Variable. Set your ping variable we created to the last created ping. Use Counter again for the array.
Now we've created the actions for your first zone. Copy and paste all that you have so far and only change the variable containing the zone. Modify it to the second zone. Repeat until all 10 zones are assigned.
By doing this, we've assigned each ping and zone a number, and a way to retrieve the amount of zones. There are more efficient ways to do this but this is a nice place to start.
2. A way for the ping to be removed.
This is much simpler. We've taken care of most of the work in step one.
Create a trigger. For the event, use Unit Enters Region. (Any region).
Create the Pick Each Integer action. From 1 to your integer variable Counter.
Create an If-Then action in the Pick Each Integer loop. Set the condition to Triggering Condition = Zone [Picked Integer].
Under the then part, create the action destroy ping. Destroy the ping in our array of pings at the Picked Integer value. "Destroy Ping Pings[Picked Integer]
Now that the ping is gone, we need to keep this region from triggering this trigger again. Move it off map or something.
It worked perfectly, thanks to you. Your answer was great and easy to follow and the screenshots helped (you mised to explain the event for the second part, even if the screenshots show it so its fine)
I actually explained the events for the second part in an edit saying that I hadn't realized there was no "Unit Enters Any Region" thing, however it was lost when I changed something else in a different edit. Mapster's fault, not mine.
But I am really glad that you found it easy to follow and that I was able to help you.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi, I would like to know how to delete a ping once a unit walks in a region (I have 10 pings to remove) please add a screenshot or 2 to show me what it would look like.
Thanks
you can only remove pings that the game creates.
if its a continuous looping ping simply re-script to "if(unit is not in region) Then {Ping} Else {}"
if its an infinitely long ping. create a global variable when you first make the ping set the variable to the last created ping, when the unit enters the region destroy the ping.
@pokenoufl: Go
Several components of this system are needed.
1. A way to create and register the pings and zones.
You'll need three variables:
First we need to create a trigger that registers each zone (region) that you've created in the terrain module.
Now we've created the actions for your first zone. Copy and paste all that you have so far and only change the variable containing the zone. Modify it to the second zone. Repeat until all 10 zones are assigned.
By doing this, we've assigned each ping and zone a number, and a way to retrieve the amount of zones. There are more efficient ways to do this but this is a nice place to start.
2. A way for the ping to be removed.
This is much simpler. We've taken care of most of the work in step one.
@Charysmatic: Go
It worked perfectly, thanks to you. Your answer was great and easy to follow and the screenshots helped (you mised to explain the event for the second part, even if the screenshots show it so its fine)
Thanks again
@pokenoufl: Go
I'm very glad that it helped.
I actually explained the events for the second part in an edit saying that I hadn't realized there was no "Unit Enters Any Region" thing, however it was lost when I changed something else in a different edit. Mapster's fault, not mine.
But I am really glad that you found it easy to follow and that I was able to help you.