• 0

    posted a message on [Trigger] Unit enters (Variable Region)

    @s3rius: Go

    Hi,

    I just tested it out by adding more Stalker to my test map and blinking like no tomorrow, the regions went up to 386 and so far so good. I couldn't notice any laginess. It would require testing on a less than average computer and with a more complex map though, but it can't be worth than actually checking the Events in 300 different triggers, can it ?

    I also did found out how to manage the Unit leaves (Variable Region) and I will update my post as soon as I can.

    edit: oh and I didn't know for the array size, thanks for that!

    Posted in: Tutorials
  • 0

    posted a message on [Trigger] Unit enters (Variable Region)

    Hi everyone,

    I did a search on those forums and couldn't find anything explaining how to properly manage a Variable Region with the 'Unit enters Region' Event.

    This is a workaround (as you will see, the main Trigger does not use a proper 'Variable' Region). But it's a rather clean workaround, and it can be useful for 200 or more region management within the triggers.

    I'll list the steps but I also should have uploaded a tutorial map, so feel free to take a look at it.

    1/ Unit Enters (Variable Region)

    • Create the variables:
        Region Components = No Region <Region[500]>
        Size Of Components = 500 <Integer (Constant)>
        Main Region = (Empty region) <Region (Constant)>
        Index Of Added Region = 0 <Integer>
    
    • Initialize the Region Components (in the melee initialization, for example):
       General - For each integer Iteration from 0 to 500 with increment 1, do (Actions)
                  Actions
                      Variable - Set Region Components[Iteration] = (Empty region)
      
    • Trigger the Main Region entering Event:
      Unit Enters Variable Region
        Events
            Unit - Any Unit Enters Main Region
        Local Variables
            Iteration = 0 <Integer>
        Conditions
            ------- Just to be sure the neutral beacon does not trigger this event
            (Owner of (Triggering unit)) != 0
        Actions
            General - For each integer Iteration from 0 to 500 with increment 1, do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Triggering unit) is in Region Components[Iteration]) == true
                        Then
                            UI - Display ((Text(Iteration))) for (All players) to Subtitle area
                            General - Break
                        Else
    
    • Add Regions whenever needed:

             General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Index Of Added Region <= 500
                Then
                    Variable - Set Region Components[Index Of Added Region] = (Empty region)
                    Region - Add a Positive circle centered at (Triggering ability target point) with radius 1.0 to Region Components[Index Of Added Region]
                    Region - Add Region Components[Index Of Added Region] to Main Region
                    Variable - Modify Index Of Added Region: + 1
                Else
    

    To summarize the Entering part: This is just the management of a constant Empty region (The empty does matter a lot, a 'No-Region' constant will not be processed). Any Regions can be added to this constant and a Region Array keeps track of the added Regions.

    2/ Unit leaves (Variable Region)

    • Use everything above and add a variable:
          LeavingRegionTest = No Region <Region>
      
    • Trigger the Main Region leaving Event:

     Unit Leaves Variable Region
        Events
            Unit - Any Unit Leaves Main Region
        Local Variables
            Iteration = 0 <Integer>
        Conditions
        Actions
            General - For each integer Iteration from 0 to 500 with increment 1, do (Actions)
                Actions
                    Variable - Set LeavingRegionTest = (Empty region)
                    Region - Add a Positive circle centered at (Center of Region Components[Iteration]) with radius 1.5 to LeavingRegionTest
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Triggering unit) is in LeavingRegionTest) == true
                        Then
                            UI - Display ("The Stalker goes out of : " + (Text(Iteration))) for (All players) to Subtitle area
                            General - Break
                        Else
    

    To summarize the Leaving part: This is a test when any unit leaves the encompassing Main Region. For each Region component it is checked if the unit within on a wider Region placed at the location of this Region component. If it's the case the unit has effectively just left this particular Region component (It might be buggy when Two Regions are overlapping).

    So it is possible to work on a large number of Regions, create them on the fly, and manage units entering and leaving those specific Regions, without having to create an enormous amount of specific triggers!

    And here's the Variable Region Tutorial Map !

    Posted in: Tutorials
  • 0

    posted a message on [Data,Terrain,Actors] How to do Live/OTF Terrain Deformation + Demo

    @xhatix: Go

    Hey, i was looking to do something of the sort, but with cliffs and ramps (I even opened a new thread, without doing a search on these forums first)... Apparently you said it wasn't possible to add cliff/ramps, but as it was 2 months ago, I was wondering if anyone found anything on the matter?

    Anyway, considering what you did, I thought of something that could be used to mimic the High Cliff mechanism:

    • First create a trigger event called whenever the terrain deformer actor is used.
    • Then add 2 rectangle regions at the deformated terrain location. One of them should have a smaller radius. Let's call them LargerRegion and SmallerRegion.
    • In a trigger Any Unit Enters Larger Region, the point location of the triggering unit is saved.
    • And in a trigger Any Unit Enters Smaller Region, the unit is moved instantly to the point saved previously.

    This should block the unit from going into the Smaller Region at all time (Not bug free i would guess :p). I tried this 2 regions path blocking mechanism, without hooking it to the Terrain deformation actor, and it was working fine.

    Sadly, I am working on something else and I won't be able to develop this idea before a while, but I thought it could be useful to write it down somewhere !

    Posted in: Tutorials
  • 0

    posted a message on Moving map items and terrain [Help Request]

    @Proxius:

    I guess you just have to be careful about the initial placement of your selection; If you match the doodads selection and the Terrain selection, they should paste accordingly.

    I tried it for Terrain and Region and messed up a bit, but they were just off by a few pixels on the new map.

    With a bit of trial and error, may be you could get something perfect, I'll look into it in a few minutes.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Moving map items and terrain [Help Request]

    I only tried it for the terrain, but it should work for the doodads as well.

    Just select the Terrain layer, be sure you are in selection mode (space by default), select most of what you want to copy, copy it then open your new map and paste it.

    If anyone know a faster way, I'd love it :D

    Posted in: Miscellaneous Development
  • 0

    posted a message on Modifying Terrain in game

    Hi everyone,

    I was just wondering (nothing serious planned) if anyone had found a way to modify Terrain while the game is launched.

    I.E Adding a cliff, removing a cliff, adding a ramp, etc....

    I've done a quick search on the triggers functions and the galaxy API but I couldn't find anything of the sort.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Create Bunker with Marines inside

    @LordFartAway: What you need is not clear, could you reformulate it?

    anyway you can simplify your code with:

            Unit - Replace (Picked Unit) with a Bunker using Old Unit's Relative vitals
    
            Unit - Create 4 Marine as cargo in (Last created unit)
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on What's the difference between a point and a region?

    You can always switch from region to point anyway within the triggers:

    Point to Region:

    Variable - Set MyRegion = (Empty region)

    Region - Add a Positive circle centered at MyPoint with radius 1.0 to MyRegion

    Region to Point:

    Variable - Set MyPoint = (Center of MyRegion)

    Posted in: Miscellaneous Development
  • 0

    posted a message on What's the difference between a point and a region?

    @Daimon7:

    I just did a quick search, as I remembered having to do something of the sort (Killing some units in all the map) and it's actually more simple than what i thought at first !

    Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions) Actions

    Unit - Kill (Picked unit)

    You can of course change the filter 'Any' to match your building type, Entire map to the region you want, and 'Any Player' to your liking :)

    Posted in: Miscellaneous Development
  • 0

    posted a message on What's the difference between a point and a region?

    @Daimon7: You're basically asking what the difference is between an apple and a peach :) They both are fruits and can be used in similar recipes but they don't have the same flavor !

    Eheh, on a more serious basis, you are right, they can do the same thing and be used in the same ways.

    But you can use regions of complex shape by adding lots of circle/square and managing their influence (the negative check box on the editor will subtract their shapes).

    And if you know how to remove units from region and only have points on your map, just create a region at this point in the triggers with:

    Region - Add a Positive circle centered at Center with radius 1.0 to Region

    Then you can use this region to remove the units!

    Posted in: Miscellaneous Development
  • 0

    posted a message on need help with unit group.

    Hi, correct me if I am wrong, but you just want to check if a unit is in a unit group?

    There's a build in function that does just that and it's under the unit group label in functions.

    So in your idle triggers actions you would want to put an IF THEN ELSE action, add a condition, select the first part of this condition, go to the unit group subsection in function and select "Unit in Unit Group", then replace Unit with triggering unit and change the second part of the condition to true! VoilĂ , that's just about it.

    oh and add the second part for the second unit group, of course.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Where to write scripts when using editor

    Hi, I guess what you are looking for is the triggers editor (press F6 in the main Editor).

    If it's not what you want, there are a bunch of tutorials as well!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Vespene geysers and refinery placement are backwards.

    Actually, SiNiquity is right, placing a Refinery in the editor places both the Refinery and the geyser.

    @SquarelyCircle: if you want to put a Refinery with a geyser underneath within the editor, delete any vespene geyser at this location and place only the Refinery. Then launch the game, destroy the refinery and you should see the vespene geyser spawning naturally.

    P.S: if you want to remove the linked geyser, you can delete the behaviour "Harverstable Vespene Geyser Gas" from the Refinery in the data editor.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Minerals from building being in a region

    I am working on a map using control points and the solution i use is similar to what Randallized is suggesting

    As for mineral gain over time, i can think of two solutions in your case:

    • Through an ability

    Create a spell with auto-cast on that will give minerals to the player (I tried it but it was a little buggy on the auto-cast part)

    • Through Triggers

    Create a variable integer array in which you define which player owns a region.

    Then when a player takes control of a region, just index the array to the Triggering Player value.

    And then in a trigger with a periodic timer event, just add minerals to player owning the regions (by doing a For-loop on all the value of the array)

    And at last, don't forget to set the array to neutral when the player loses the region.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Access Turrets 'Yaw Arc'

    @ Ash4meD: Actually, you are right, I did manage to set the shooting in one direction, but it changes it for all the units.

    And I want a tank in siege mode only able to shoot west, another one shooting only south, another one shooting only south-east, etc.... (so this way I can also hugely modify the range of the siege tank, without creating some game imbalances)

    It should be possible as you can with the data editor modify the maximum life of, let's say a marine, and it is modified for all marines but through triggers you can change the maximum life of one specific marine.

    If something similar could be done with the Yaw Arc field of the turret, this would be perfect, but I don't quite know how to access something that isn't a part of the native triggers lib.

    Well anyway thanks for your help, and if i can not figure anything i'll just go with the duplicate solution !

    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.