Visibility Triggers

Stretch

New Member
I have made it so when a unit enters a specific region, they gain control of a circle of power and get full vision of that base, but I am having difficulty triggering it so when they lose control of that circle they also lose vision of the base, I have tried using "Visibility - Disable (last created visibility modifier)" but if someone gains vision of two bases at same time, no matter which circle they lose they will lose vision in the last base they claimed.

Example:

Player 1 gains vision of base 1
Player 1 gains vision of base 2
Player 2 gains vision of base 1
player 1 loses vision of base 2 (not 1 like he should)

If it requires variables to do can you please explain clearly as I do not have a great knowledge of variables at this time, still trying to learn.

Thanks in advance :)
 

Accname

2D-Graphics enthusiast
you need variables therefor.
declare a visible modifier variable to be the last created visibility modifier when creating one.

or maybe even better in this case would be using a hashtable to link the circles of power directly to the modifier.
 

Accname

2D-Graphics enthusiast
how did you do it till now?

This is an example in which a base is taken when attacked:
Trigger:
  • Init Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set MyHashtable = (Last created hashtable)

Trigger:
  • TakeBase
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal CircleOfPower
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashtable)
      • Visibility - Create an initially Active visibility modifier for (Owner of (Attacking unit)) emitting Visibility across (Playable map area)
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashtable


how this works:
the first trigger will create a hashtable at map initialization, pretty easy.

the second trigger will run when a circle of power is attacked.
it will first destroy any visibility modifier attached to the key of that circle and thence create a new modifier for the owner of the attacking unit.

change that event to your needs.
 

Accname

2D-Graphics enthusiast
in this case just use this trigger in combination to the first trigger i posted in my last reply:
Trigger:
  • TakeBase
    • Events
      • Unit - A unit Changes Owner
    • Conditions
      • (Unit-type of (Triggering unit)) Equal Circle of Power
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashtable)
      • Visibility - Create an initially Active visibility modifier for (Owner of (Triggering unit)) emitting Visibility across (Playable map area)
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashtable


By the way, you dont need to use screenshots, you can copy triggers as text and paste them here within
Trigger:
  • tags.
 

Stretch

New Member
I am struggling to find the "key modifier" bit can you please tell me where it is :(

Edit: also thanks for the copy triggers bit I didn't know :)
 

Accname

2D-Graphics enthusiast
a hashtable is nothing but a two dimensional data storage.
you need 2 values to specify the data you want to store / load.
both values are actually numbers but you can still use strings which will be converted to numbers internally.

so much for the theory.

when you want to save / load something from the hashtable it should look like this:
"Save Handle of [...] as value of value in [...]"
if you click one of the "values" another drop down menu should pop up in which the first function would be:
"Hashtable - Get Handle ID"
this function will get an individual number (Handle ID) of an object. every object in the game has its very own handle id, every unit, structure, special effect, destructable, point, etc, etc.
the next function in that list will be:
"Hashtable - Get String ID"
this function will create a number out of a given string. thats what i did, the string i chose was "Modifier".

you dont have to use a string id, thats basically a useless function, its only purpose is to make things easier to identify.
you could just use:
Trigger:
  • Hashtable - Save Handle Of(Last created visibility modifier) as 0 of (Key (Triggering unit)) in MyHashtable

but a blank 0 is not saying us as much as the string "Modifier" is. this way you can keep track of what you are saving more easily.
 

Stretch

New Member
I have set it up as you showed above with the "key modifier", finally got it working :)

The problem I am experiencing now is I can't get Base 1 and base 2 to be recognised as different.

Example:
Player 1 enters Base 1's circle
gets vision of both Base 1 and Base 2

All I did to make it for base two was copy and paste the triggers you told me to do and edited relevant information such as which circle etc...

I have tried changing the "key modifier"'s name to a different one and tried creating another hashtable and putting it there but either way it still puts vision across both.

Here is my triggers:

Trigger:
  • Base 1
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (Unit-type of Circle of Power (large) 0020 <gen>)
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashTable)
      • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Region 002 <gen>
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashTable


Trigger:
  • Base 2
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (Unit-type of Circle of Power (large) 0024 <gen>)
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashTable)
      • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Region 003 <gen>
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashTable
 

Accname

2D-Graphics enthusiast
because the triggers i posted where MUI, the single trigger was ment to work for all circles, no need to copy/paste them.

however, you have to define the rect you want to become visible.


there are basically 2 options for you:
1). in case every base got the same size and form (a square for example) you can create a rect within the trigger.

2). if every base got an own individual form and size you would have to index preplaced rects within an array and somehow relate them to the circles.

solution 1).
Trigger:
  • Set TempPoint = (Position of (Triggering unit))
    • Set TempRect = (Rect centered at TempPoint with size (1024.00, 1024.00))
    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across TempRect


solution 2).
Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Base_Rects[0] = Rect 000 <gen>
      • Unit - Set the custom value of Circle Of Power 0000 <gen> to 0
      • Set Base_Rects[1] = Rect 001 <gen>
      • Unit - Set the custom value of Circle Of Power 0001 <gen> to 1
      • Set Base_Rects[2] = Rect 002 <gen>
      • Unit - Set the custom value of Circle Of Power 0002 <gen> to 2
      • Set Base_Rects[3] = Rect 003 <gen>
      • Unit - Set the custom value of Circle Of Power 0003 <gen> to 3
      • ...
      • ...

Trigger:
  • Base
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (Unit-type of Circle of Power (large) 0020 <gen>)
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashTable)
      • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Base_Rect[(Custom Value of (Triggering Unit))]
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashTable
 

Stretch

New Member
How do you do the "Set Base_rect" part, sorry I know its a variable but which one did you use for it?

Sorry to be so much a pain Accname but I really appreciate all the help your giving :)
 

Stretch

New Member
that is what i thought but I can't find no "rect" variable, unless that is the short name of something.

Sorry sounding so idiotic but I am still learning Variables ^^
 

Happy

Well-Known Member
its a region variable xD rect is just the short form for it because when you remove it its not region its rect xD
 

Stretch

New Member
Yay I have seemed to got it working thanks loads guys, I will post my triggers below so you can see how it was done for anyone else who needs a similiar thing. Huge thanks to Accname for all his help :)

Trigger:
  • Base 1c
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set MyHashTable = (Last created hashtable)


Trigger:
  • Base 1a
    • Events
      • Unit - A unit enters Region 001 <gen>
    • Conditions
    • Actions
      • Unit - Change ownership of Circle of Power (large) 0020 <gen> to (Owner of (Triggering unit)) and Change color


Trigger:
  • Base 1b
    • Events
      • Unit - A unit leaves Region 001 <gen>
    • Conditions
    • Actions
      • Unit - Change ownership of Circle of Power (large) 0020 <gen> to Neutral Passive and Change color


Trigger:
  • Base Regions
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Base_Rect[0] = Region 002 <gen>
      • Unit - Set the custom value of Circle of Power (large) 0020 <gen> to 0
      • Set Base_Rect[1] = Region 003 <gen>
      • Unit - Set the custom value of Circle of Power (large) 0024 <gen> to 1
      • Set Base_Rect[2] = Region 005 <gen>
      • Unit - Set the custom value of Circle of Power (large) 0025 <gen> to 2


Trigger:
  • Base 1
    • Events
      • Unit - Circle of Power (large) 0020 <gen> Changes owner
    • Conditions
    • Actions
      • Visibility - Destroy (Load (Key Modifier) of (Key (Triggering unit)) in MyHashTable)
      • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Base_Rect[(Custom value of (Triggering unit))]
      • Hashtable - Save Handle Of(Last created visibility modifier) as (Key Modifier) of (Key (Triggering unit)) in MyHashTable
 

Accname

2D-Graphics enthusiast
you can merge the first and the third trigger into one. they are running with the same event.

@happy:
rect is not an abbreviation for region, a rectangle is just a two dimensional geometrical form with 4 corners.
and i didnt know how it is called in english since i havent gotten an english editor, i am sorry. i just assumed it was called rect.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    it is all percolating man
  • The Helper The Helper:
    TheHelper.net #1!
  • Wizard Wizard:
    #1
  • The Helper The Helper:
    LOL I love this place
  • Wizard Wizard:
    ;D
  • Wizard Wizard:
    We all do.
  • O Old Mountain Shadow:
    So what is next for thehelper.net? Is there a new set goals yet?
  • The Helper The Helper:
    yes we are going to be expanding
    +1
  • The Helper The Helper:
    help more people
  • The Helper The Helper:
    thank you for asking Old Mountain Shadow hell ya@
  • The Helper The Helper:
    Look at Mountain Shadow in the chat!
  • The Helper The Helper:
    welcome to thehelper.net
  • O Old Mountain Shadow:
    thanks although I'm really kind of regretting this name lol ... is there a way to change it out or will I need to make a new account?
    +1
  • Wizard Wizard:
    One of us can change it for you, I believe. Just send me a PM on what you want.
  • Ghan Ghan:
    Some day we should get the feature where you can change your own name.
  • Wizard Wizard:
    Soon!
  • The Helper The Helper:
    did the mountain shadow get his name changed? personally I think Old Mountain Shadow is a kickass name
  • The Helper The Helper:
    but what do i know lol
  • Wizard Wizard:
    No they haven't had their name changed, it is badass xD
    +1
  • O Old Mountain Shadow:
    Thanks, lol! I haven't quite come up with a good new one yet. I was gonna default to one of my older usernames: Cha Zui = tea drunk in Chinese but then decided it too didn't quite fit right. I'm not asian lol... But I am tall, and old spirited which is sort of where the Old Mountain Shadow came about.
  • O Old Mountain Shadow:
    Either way I appreciate the willingness to help me change it! Should I discover something better I'll swap it, but for now ill stay with what I got.
  • The Helper The Helper:
    If you want a change like they said earlier just let us know
    +1
  • Ghan Ghan:
    Patched and rebooted the server this morning.
  • Ghan Ghan:
  • The Helper The Helper:
    dam pwnkit what a name probably perfectly describes it

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top