• 0

    posted a message on Records inside a Record: How?
    Quote from hobbidude: Go

    When your referencing the record the variable of the record is not set to type record like records are done, instead to set the type to the name of the record instead which would now appears in the lists along with the other variable types. To claify slave should be a record, master should be a record, but slaverex should not be a record- just a varable with the types set to the name of the slave record.

    ????

    Posted in: Triggers
  • 0

    posted a message on Records inside a Record: How?

    Does anyone know how to create and call records within a master record? I've seen it mentioned a few times, but I have not been able to get it to work.

    EDIT:

    Solved: 5-step tutorial for anyone that doesn't know:

    1) Create a record, name it "Slave."

    2) Create a variable inside the record Slave, named SlaveInt, of type integer, array size 5

    3) Create a record, name it "Master."

    4) Go to the Master Record, and create a variable within it, type record, name it "SlaveRec" Array size 8. Make sure you select the Slave Record when you set this variable type to record.

    5) Create a global variable, type record, name it "MasterRec." Make it an array of size 10. Make sure you select Master Record when you set this variable type to record.

    --------------

    To reference this variable:

    Now create a trigger, and make a new action: Set Variable:

    MasterRec[index] . Slave Rec [ index 2] . SlaveInt [Index 3]

    Index 1 must be between 0 and 10. Index 2 must be between 0 and 8. Index 3 must be between 0 and 5.

    There is a total of (11)(9)(5) pieces of information contained within the master record (495 different integer variables). So be careful when you do this, the size of the record can grow quickly.

    EDIT 2:

    You may encounter a compilation error when you save. I discovered from other threads that you must physically place the Slave Records above the Master Record for it to compile correctly, as the script is compiled sequentially from the top to bottom of your triggers.

    It should appear like this in your trigger editor:

    Trigger 1

    Trigger 2

    Global Variable 1

    SLAVE RECORD

    MASTER RECORD

    MasterRecvariable

    Trigger 3

    etc

    Posted in: Triggers
  • 0

    posted a message on Very Simple traceline (Unit is Highlighted)

    @EdwardSolomon: Go

    One obstacle remains: If they player holds their left click down, in an attempt to select something, the highlight function becomes disabled until they release their left click, hmm how to fix?

    Solution 1:

    Do not use mouse event Left Click for shooting. Use Right click

    Make your Left Click the special fire ability, perhps some sort of projectile with slow a slow rate of fire, this way your player won't hold the Left Mouse down for more than a split second.

    Posted in: Triggers
  • 0

    posted a message on Very Simple traceline (Unit is Highlighted)

    Ever notice that when your mouse hovers over a unit, it changes from a pointer to a box. This is event is known as "Unit is Highlighted."

    So, besides for a few special cases, we can make a traceline that detects collision with units, collision with doodads and collision with terrain, all in one, very simple function.

    Ready?

    Event - Unit is Highlighted

    Set TraceTarget[unit variable] = Triggering unit

    -----------------

    Event 2 - Unit is Unhilighted

    Set Trace Target = No unit

    -----------------

    When shooting your weapon:

    Event 3 - [Player shoots their weapon]

    If/Then/Else- If: Tracetarget is NOT equal to No Unit

    Then: Order[weapon unit] to attack Trace Target

    Else: Create a Dummy Unit at (Point - Position of Camera) offset by Distance(Cosine(Pitch of Camera) towards (Yaw of Camera degrees)

    Set Last created unit Height to { Distance(Sine(Pitch of Camera)) - [Ground Height at Position of Dummy Unit - Ground Height at Position of Player Camera] + Height Offset of Player Cam }

    Else (same else): Set TraceTarget = Last Created Unit

    Else(same else): Order[weapon unit] to attack Trace Target

    --------------------

    Congratuations, You Won!

    (don't forget to have a system that deletes the dummy units after a particular time expiration)

    Each unit in the data editor has the flag "Cannot be Highlighted" be default. So every unit you intend to use (that can be shot at) needs to have this unchecked in Unit Flags.

    Posted in: Triggers
  • 0

    posted a message on (Solved) Cursor change when hovering over Unit (actor)

    @EdwardSolomon: Go

    Solved:

    Had to go to Data Editor and uncheck "Unit Cannot be Highlighted"

    Now it works fine and we have an in-game traceline.

    Use "Unhighlighted" to detect when no unit is in traceline. Actually, I should make a small thread about this in triggers.

    Posted in: Data
  • 0

    posted a message on (Solved) Cursor change when hovering over Unit (actor)

    I noticed that before you select a unit, the cursor changes from the racial pointer (terran/zerg/protoss) to a box of some sort. DOes anyone know how to detect when this effect occurs?

    I thought perhaps it was "unit is hilighted" but that turned out to be something different. So I'm looking to either detect this event or find some way of determing which unit on the map is "pre-selected" before being clicked.

    The reason is that I can rotate my camera to any position/angle/field of view and my cursor will light up when I hover over a unit. It seems that this is a built in traceline function, and I want to access it.

    Posted in: Data
  • 0

    posted a message on Multiplayer: Quadratic Regression 3D FPS Traceline

    Hello,

    This library contains a custom function that returns the unit that the player is currently looking at in accordance to their Yaw and Pitch (or no unit, if no valid units are in their line of sight).

    This traceline function reduces the computational load exponentially in comparison to a conventional traceline. Although this is intended for FPS style games or camera modes, if you have decent mathematical and scripting skills, you can easily convert the function for TPS use instead.

    The term "Quadratic Regression" is referring to a polynomial approximation of a set of points. This is used in order to greatly increase the accuracy of the traceline depending on the distance from the Target to the Player. For more information on this, go here:

    http://www.sc2mapster.com/forums/development/triggers/45700-tutorial-quadratic-regression-3d-traceline/

    Don't forget to check out the images that are attached. ----------------------------------

    This library also contains two triggers and a couple of variables and a record. You will need these in order to achieve the overall effect. Read the attached comments to know why you need these.

    In the attached map, the folder: TraceLibrary contains all of the triggers/functions/variables/records that you'll need to import into your map.

    YOU MUST READ THE BELOW INFORMATION: ---------

    YOU MUST READ THE BELOW INFORMATION: ---------

    YOU MUST READ THE BELOW INFORMATION: ---------

    In the traceline function itself, if there is no valid unit in your line of sight, it will create a dummy unit to shoot at. In this library, that dummy unit is a Mutalisk. In order to change this, go to the VERY END of the function where it says "Create 1 Mutalisk for Player 0..." and change this to your dummy unit (make it an invisible unit). These dummy units are deleted within 1.00 seconds of their creation by the main trigger that utilizes the trace function.

    You will have to create your own FPS camera, your own FPS unit, and your own units that shoot at the tracetarget. You will have to look at the variables in the Record and set them appropriately (Avatar = Your Player's Unit).

    If you want more than 6 player using the traceline, you will have to increase the arraysize of the Record Variable and the bounds of the Pick Each Integer Loop in the main trigger.

    Whichever weapon is being fired at the TraceTarget, this weapon's range must be greater than or equal to 75. You can control the operational max range of the weapon using the Trace function itself.

    Posted in: Trigger Libraries & Scripts
  • 0

    posted a message on [Triggers] Intro to Galaxy Editor- Triggering Edition

    @zeldarules28: Go

    Can we get more on Records/Presets/Custom Actions,Function,Events,Conditions?

    Posted in: Tutorials
  • 0

    posted a message on The "zero" wait
    Quote from SouLCarveRR: Go

    @EdwardSolomon: Go

    I would suggest you avoid trying to code in a manner that relies on tracking so many cycles per second.

    There are quite a few factors that will cause it to run different on different peoples computers and on bnet as well.

    There are functions that need to run in order to create smooth looking animations. Blizzard gave us a tool to assist us for Moving units or changing their facing (Move Unit instantly with BLEND) and face unit to angle over X seconds.

    However, those two tools don't always cut it for certain circumstances. Also, the jump from 16 fps ( frames per game second) to 32 fps (frames per game second) is TREMENDOUS and noticeable, whereas the jump from 32 to 64 fps is no where near as noticeable. So whatever toolbag at Blizzard decided on a 1/16 second clock instead of 1/32 should have his teeth kicked in.

    Posted in: Triggers
  • 0

    posted a message on The "zero" wait
    Quote from SouLCarveRR: Go

    @EdwardSolomon: Go Heres a test I just made for you

    it moves a unit across the map.

    The test shows that the periodic event will run even if the prior running of it has not yet completed.

    It preforms each action as they occur in the code.

    While loops that run hard with out waits will tend to lock up the game and you may not visually see what occurs during each cycle.

    What the user sees is not really handled by the script engine.

    Testing by pausing is kinda fail, imo

    Btw if your using game time... the game speed will effect that

    I would suggest you avoid trying to code in a manner that relies on tracking so many cycles per second.

    There are quite a few factors that will cause it to run different on different peoples computers and on bnet as well.

    I wasn't testing by pausing. Look at my fourth post, you can replicate it easily yourself. You can get odds only, but there's no way to get evens only (changing the initial value of Test = 1 instead of 0 doesn't qualify, because then you can't get odds only).

    Posted in: Triggers
  • 0

    posted a message on [Trigger][GUI] Keeping your code clean and organised. (Beginner Difficulty)

    @DarlD: Go

    What does this particular example mean about "Create Thread" :

    "Also for things like first and third person movement systems and shooters: "create thread" is what allows them to be possible at all. Do not underrate this aspect."

    Perhaps I'll gain a better understanding of the the significance of "Create Thread" if you can explain how FPS and TPS movement systems suffer from not having "Create Thread " checked.

    Posted in: Tutorials
  • 0

    posted a message on The "zero" wait

    @EdwardSolomon: Go

    Confirmation that it does not work. Although it might check the conditions every 1/32 of a second, it does not perform that actions until the expiration of the game loop. Here is the test that confirmed it:

    Test 2
        Events
            Game - Map initialization
        Local Variables
            clear = False <Boolean>
        Conditions
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                Actions
                    Variable - Set test = (test + 1)
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            clear == True
                        Then
                            Variable - Set clear = False
                            UI - Clear All Messages for (All players)
                        Else
                            Variable - Set clear = True
                    UI - Display (Text(test)) for (All players) to Subtitle area
                    General - Wait 0.0 Game Time seconds
    

    When you have "UI - Clear All Messages" it's supposed to display even numbers ONLY. However, it always displays 2n and 2n + 1 when I pause the game.

    HOWEVER. If you move that action to the Else, instead of the Then, then it only shows you odd numbers, 2n + 1 followed by 2n + 3.

    :(

    Posted in: Triggers
  • 0

    posted a message on The "zero" wait

    @EdwardSolomon: Go

    No, it's updating in chunks. Twice per game loop, instead of once per half game loop.

    I know this by spam pausing the game.

    Every time I paused, the variable "Test" was always on odd number (in the form 2n + 1). Thus, I'd either have the best luck in coin flipping in all of human history (more than 800 heads in a row, 0 tails), or it's only updating in chunks OR OR OR the game only pauses after one complete loop (event - key press).

    Anyone know of a way to test this?

    Posted in: Triggers
  • 0

    posted a message on The "zero" wait

    @EdwardSolomon: Go

    It is possible to get 32 updates per second using a while loop:

    Test 2
        Events
            Game - Map initialization
        Local Variables
        Conditions
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                Actions
                    Variable - Set test = (test + 1)
                    General - Wait 0.0 Game Time seconds
    

    However, it is possible that's updating twice per game loop (in chunks) instead once per half game loop. I'll find out in a moment though.

    Posted in: Triggers
  • 0

    posted a message on The "zero" wait

    I know in the past, the "Wait 0 game-time seconds" would allow you to update a trigger 32 times per second (0.03125 seconds) instead of 16 times per second.

    However, running tests upon the 0 wait, I haven't been able to achieve this effect, which leads me to believe it was patched for some aweful reason (why would blizzard remove functionality?). It is possible though that the triggers I'm using to test this theory aren't appropriate. I put the triggers below:

    Test
        Events
            Timer - Every 0.0 seconds of Game Time
        Local Variables
        Conditions
        Actions
            Variable - Set test = (test + 1)
    

    Then I had it display the integer variable in a separate trigger:

    Test check
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
        Conditions
        Actions
            UI - Display (Text(test)) for (All players) to Subtitle area
    
    Posted in: Triggers
  • To post a comment, please or register a new account.