HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

getting destroy last created to not overlap

06-19-2004, 04:26 PM#1
xtacb
i have an item binoculars, when you use it, a visibility modifiier is created for the owner of triggering unit, then destroyed 4 seconds later,

it works fine if only one person has binoculars, but if more than one person uses binoculars, destroy last created visibilty modifier only destroys one of them and there will be a permanant visibility modifier left

how would i make it so they dont interfere with each other?
06-19-2004, 05:01 PM#2
th15
The easy way is to assign the modifiers to a variable array. That way you keep track of one modifier per player.

The other way is to use local variables. This requires a little bit of custom script. Run a search for "local variable tutorial" and you'll find what you need to do this.
06-19-2004, 05:23 PM#3
xtacb
im using a variable array for the visibilty modifier
Code:
Actions
    Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility from (Position of (Triggering unit)) to a radius of 3925.00
    Set binoculars[(Player number of (Owner of (Triggering unit)))] = (Last created visibility modifier)
    Wait 6.00 seconds
    Visibility - Destroy binoculars[(Player number of (Owner of (Triggering unit)))]


even like this, it would overlap because once another unit uses binoculars, that unit becomes the new triggering unit, thus that unit's visibilty would be detroyed, not the first
06-20-2004, 04:01 PM#4
Cubasis
xtacb,

Do this:

Create a VisibilityModifyer variable, name it whatever (LocalVis in this example).

In your trigger, do this line at the top:

Custom Action: local fogmodifier udg_LocalVis

Then use LocaVis to create your visibility modifyer, and then wait, and destroy it again, It should work properly

~Cubasis