HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

revealing an unrevealing an area. Need some basic help.

06-17-2004, 08:27 AM#1
perrry
Here's what I want to do:

I have a map with several scenic waterfall that arent visable because the units line of site can't see all the way up the cliff.

So what did is I made 2 regions, 1 at the base and one covering my scenic waterfall. I made 2 triggers, one if a unit enters it creates a visibility modifier for the controling player that shows the waterfall. Another trigger destroys the last created visibility modifier when a unit leaves that area.

I works good when I have one unit and one player and one waterfall. It starts getting buggy because I have more then one player, and several waterfalls.

What is the proper way to do this? This is my first trigger ever.
06-17-2004, 08:49 AM#2
GaDDeN
Well i guess the problem is that you use "last created visibilty modifier". Lets say one unit enters. Now it creates 1 modifier. If it leaves, it destroys it, but what if it doesnt leave? Another unit enters, now there are 2 visibilty modifiers there. The last created one if only the one the last unit created. So when both leave, only the 1st one is destroyed.

The second problem is if you have more waterfalls, the same problem with last created will happen. One enters at one waterfall, and another at another. Then the first unit laves ITS region, the other one cant delete his modifier. One way to do it is to make a Bolean array variable for each waterfall (true/false, array for each player) and then do a trigger like this:
Code:
E:Unit enters WaterFallBaseRegion
C:None
A:If Bolean_Variable[player number of owner of entering unit] equal to false, create visibilty modifier for (owner of entering unit) at position of WaterFallRegion. Set Visibility_Modifer_Region1[player number of owner of entering unit] = last created visibility modifier. Set Bolean_Variable[player number of owner of entering unit] = true

This checks if the bolean_variable is true (=there is a unit inside or not) and if there is no unit owned by that player inside, it creates a visibilty modifier and set's it to a variable. Hope you know what that is, otherwise this is gonna be impossible :)

Code:
If Bolean_Variable[player number of owner of entering unit] equal to true then do nothing

And if there is a unit inside the region, this does nothing.

Code:
E: Unit leaves Region1
C: None again
A: Destroy Visibility_modier_region1[playernumber of owner of leaving unit]
And the last one, if a unit leaves region 1, it destroys the visibilty modifier variable which is that modifier for the player that owns the leaving unit.

Lol im kinda tired, maybe i made this waaay to complicated then needed. But if i aint asleep, this shud work!
06-17-2004, 08:59 AM#3
PatruX
This is one way of doing it:

Code:
Waterfall
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        If ((Number of units in (Units in SeeWaterfall <gen> owned by Player 1 (Red))) Greater than or equal to 1) then do (Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across Waterfall <gen>) else do (Visibility - Create an initially Disabled visibility modifier for Player 1 (Red) emitting Visibility across Waterfall <gen>)

This is for 1 player (Red).
If condition = "Integer Comparison" if you didn't know.

Code:
Waterfall On
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If ((Number of units in (Units in SeeWaterfall <gen> owned by (Player((Integer A))))) Greater than or equal to 1) then do (Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Waterfall <gen>) else do (Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Waterfall <gen>)

And that is for all players.

Edit: Seems like GaDDeN was before me :D
06-17-2004, 09:24 AM#4
GaDDeN
hehe yeah your trigger looks alot simpler...

But it keeps creating a visibilty modifer each time a unit enters; doesnt that create lag?

Anyways, you can use both

gl with ur future triggering, perrry :D
06-17-2004, 03:28 PM#5
th15
Much easier way to do this.

Find the doodad in the object editor.

There should be a field that says either "Show in fog" or "extended line of sight". Make both true. (If there isn't such a field, feel free to whack me over the head)

What I DO know is that units have a field called "extended line of sight". This field, when set to true, causes the model of the unit to be displayed REGARDLESS of line of sight. That is to say that enemies can see units straight through line of fog.
06-17-2004, 06:40 PM#6
perrry
Thanks for yor sugesstions so far.

th15: if only it was so easy. I didn't see a line of sight for doodads, there is a visibility radius but it doesnt seem to work out (maybe because its up on a a cliff?)

Gadden I am trying as you suggested, but the code is a little bit beyond me. Is what you posted soemthing I can use line per line?
06-17-2004, 07:26 PM#7
GaDDeN
Yeah i understand you, i wudnt understand it either if somebody else posted it for me o_O

Ok lets just say when a unit ENTERS the region, you create a visibility modifier and then save it in a VARIABLE. But we should only create a visibility modifier if he has NO units in there allready, therefor we add a IF THEN ELSE before creating a variable. This variable is splitted up for each player (an ARRAY) so when a unit enters, you put:
Code:
If units owned by (owner of entering unit) in region 1 equal to 0, then:

Set Vis_Mod_Region1[player number of owner of entering unit] = last created special effect

So if, for example, the entering player is player 1, the computer will put this as:

Set Vis_Mod_Region1[1] = last created special effect

So what we have after that, is the special effect STORED in a variable for each player.

And then, when a unit leaves the region, we remove the special effect for the player:

Code:
Unit leaves region 1

Destroy visibility modifier Vis_Mod_Region1[player number of owner of leaving unit)

Got it this time? I think it should work... If somebody notice something wrong just tell me and ill correct!

GL again :D
06-17-2004, 10:39 PM#8
perrry
Thanks guys I got it to work.

I used a combination of 2 suggestions and a little insperation of my own. Here's what I did:

I used the array thing to create a visual modifier for each player, it only creates one for each area and it is default disabled. I assign each one to a variable.

Then I used the timed event thing to check if anyone is there to enable or disable it.

Thanks for the help with my first trigger!

06-18-2004, 04:47 PM#9
PatruX
Quote:
Originally Posted by perrry
Thanks guys I got it to work.

I used a combination of 2 suggestions and a little insperation of my own. Here's what I did:

I used the array thing to create a visual modifier for each player, it only creates one for each area and it is default disabled. I assign each one to a variable.

Then I used the timed event thing to check if anyone is there to enable or disable it.

Thanks for the help with my first trigger!
That's a very good first trigger :D
06-19-2004, 04:24 AM#10
perrry
Thanks hopefull doors will be easy after this, they are next. (I saw a tutorial on this site I'm going to check out).

I want the person to be able to open and close the doors if they have a key and only able to use the key 3 times.