Tutorial Double Click System GUI

Weegee

Go Weegee!
Reaction score
102
Hi there :D. Have you ever wondered how extreme candy wars (if you have ever played it) or how when you double select a unit you get the unit? Well I am going to show you a noob way to make it. Now lets start and don't get lost :thup:

Variables:
You need an Integer array set to 12 (were gonna call it Has_Picked_Integer_Player), A boolean array (were gonna call that Has_Picked), And were going to be using a point variable (called TempPoint)

Ok Now I will walk through with you step by step...

Trigger

Code:
Events
    Player - Player 1 (Red) Selects a unit
    Player - Player 2 (Blue) Selects a unit

These are my events. You can add more but since this is just a demo I will only have 2

Code:
Conditions
    Has_Picked[(Player number of (Triggering player))] Equal to False

Now you may be wondering but we never set that variable to anything. We will set it later but for now this is used to check if the variable is false and if the player has not already picked a character.

Code:
Actions
    [COLOR="Green"]Set TempPointCenter = (Center of (Playable map area))
    Set Has_Picked_Integer_Player_1[(Player number of (Triggering player))] = (Has_Picked_Integer_Player_1[(Player number of (Triggering player))] + 1)[/COLOR]
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
         And - All (Conditions) are true
          Conditions
           Has_Picked_Integer_Player_1[(Player number of (Triggering player))] Equal to 2
           ((Triggering unit) is A Hero) Equal to True
           (Owner of (Triggering unit)) Equal to Neutral Passive

           [COLOR="Red"] Has_Picked_Integer_Player_1[(Player number of (Triggering player))] Equal to 2
            ((Triggering unit) is A Hero) Equal to True
            (Owner of (Triggering unit)) Equal to Neutral Passive[/COLOR]
        Then - Actions
            [COLOR="DarkOrange"]Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at TempPointCenter facing Default building facing degrees
            Camera - Pan camera for (Triggering player) to TempPointCenter over 0.00 seconds
            Selection - Select (Last created unit) for (Triggering player)
            Unit - Remove (Triggering unit) from the game[/COLOR]
            [COLOR="Purple"]Set Has_Picked[(Player number of (Triggering player))] = True
            Set Has_Picked_Integer_Player_1[(Player number of (Triggering player))] = 0[/COLOR]
         Else - Actions

The first green text is setting the TempPoint Variable to the center of the map (for your map just set it where ever you want). The second green text sets the variable to the current value of the variable +1. This is needed for the game to check if you have selected twice and the array is needed to make things easier for the game to refer to and making it MUI (or so I think :p).

The red text does a couple of things. First it checks if the integer array we had set before is at 2 yet. If it is then it checks if the selected unit is a hero and is owned by the player neutral passive. We check if the units a hero so it can only be a hero and we check if the owner is Neutral Passive (you can change this if you have an AoS map that uses team colors) because our units have to be Neutral Passive so we cant select our allies hero

The orange text start the whole process and creates the selected hero at TempPoint, pans the camera to the TempPoint, selects the last created unit, and removes the selected unit so no one can have 2 of the same hero (you can change this if you want)

The purple text then sets the variable Has_Picked to true so you cant keep creating heroes and you set the Has_Picked_Integer_Player variable to 0 (which you don't need to do but I did anyway :D)


Don't forget to also add custom script with this code "call RemoveLocation (udg_TempPoint)" (without quotes). If the name of the variable is different then change TempPoint to the name of your variable

Here are my pictures of my system in action...





Thank you to Flare for improving my system. If you have any questions just post them and I will help you. Enjoy =D

Edit: can I get a mod to remove my old Double Click System Map?
 

Flare

Stops copies me!
Reaction score
662
Has_Picked_Integer_Player_1 Equal to 2
Arrays are much more viable in this situation (use Player number of (Triggering Player) as the array index)

(which I will add tmrw) and tmrw I will also make the trigger more sufficient by adding that stuff
You should try and get most/all of the stuff covered at once, rather than splitting it up over a few days, since you may just end up confusing people if you change the existing triggers
 

Weegee

Go Weegee!
Reaction score
102
@Flare
Yep updated my post, and gave you credit and rep

Btw is it possible for me to be able to remove the map I posted up and put the better map I have?
 

Sevion

The DIY Ninja
Reaction score
413
Go to Edit then click Advanced and the Attachments. Then click Remove or whatever it's called. And upload the new one.
 

Flare

Stops copies me!
Reaction score
662
Code:
Conditions
    Has_Picked[(Player number of (Triggering player))] Equal to False
You should indicate that the array must be sized to (Last applicable player slot number) or that you must manually initialize the array to False, since if the array's defaulted size isn't adequate, that condition won't return true for some players (since the value of the boolean would be neither true nor false, but blank, I believe)

Simplest way to test that would be something like
Code:
E:
   Player 1 skips a cinematic sequence
C:
   -
A:
   If conditions are true:
     Has_Picked[5] == True ---The array index can be anything >1, assuming you didn't define a size for defaulted array values---
   Then:
     Display the text: "True" to (All players)
   Else:
     Display the text: "Not true" to (All players)

   If conditions are true:
     Has_Picked[5] == False ---Same as above applies---
   Then:
     Display the text: "False" to (All players)
   Else:
     Display the text: "Not false" to (All players)
I think that would display both Not true and Not false, if you didn't specify a suitable Array Size value when creating the variable

Also, TempPoint is leaking (setting a point to a variable doesn't automatically mean the leak is fixed, you must 'call RemoveLocation (udg_TempPoint)' to get rid of it completely)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top