• 0

    posted a message on convert string into gamelink

    @shocker455: Go

    Dynamic code is not the problem, more the bad behaviour of GUI. Gamelinks are actualy Strings, but the Trigger editor treats it as something different.

    Fortunately you can trick the TE using Custom Script

    String To Actor Gamelink
        Options: Function
        Return Type: Game Link - Actor
        Parameters
            gamelink = "" <String>
        Grammar Text: String To Actor Gamelink(gamelink)
        Hint Text: (None)
        Custom Script Code
        Local Variables
        Actions
            General - Return lp_gamelink
    

    Note: lp_gamelink is where the Custom Script comes to work

    Hope this helps

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on [Alliance] Trigger question/help - (Not Solved Yet)

    @Xevaria: Go

    To move one action, just click on it, hold the button and move your mouse with it. When it's not inside the For-Actions, it's outsid ethe loop ;)

    Your current Code makes them only Allied when one Player (the last one, No 6) is not Playing (cause the Make-Allied-Action is in Else-Node). This is obviously never the case. Use this Code instead:

            General - For each integer A from 1 to 6 with increment 1, do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Status of player A) == Playing
                        Then
                            Player Group - Add player A to Team
                        Else
            Player - Make all players in Team treat each other as Ally With Shared Vision
    

    Alternative:

            General - For each integer A from 1 to 5 with increment 1, do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Status of player A) == Playing
                        Then
                            Player - Make player A and player 6 treat each other as Ally With Shared Vision
                        Else
    

    By that te Players are only allied to Player 6 and not to each others...

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on Idle Unit as Condition

    @SBeier: Go

    The way of using multiple timers, one for each SCV, is propably one of the best ways to approach.

    But wouldn't it be much more efficient to use some kind of reuseable information about the unit/timer for dictionary keys instead of running through the entire list? I think that on a bigger amout of units or frequent stop and go commands the run-through method could create lags. You could for example use a custom value for the unit. But something similar for a timer? dunno.

    @nrtwenty: Go

    Just to clarify this:
    Is your goal that if at least one SCV is idle for 10sec, the owning player getting defeated?
    If so, there comes an other idea in my mind:

    Use one timer for each player.
    When a SCV gets idle and the timer for the owning player is not started, (re)start it.
    When a SCV stops being idle, check if number of idle workers for that player is zero. If so, stop the timer, otherwise not.
    When the timer expires, defeat the player.

    by that, the timer gets started when the first SCV becomes idle and stoped, when the last stops being idle. In other words, it runs as long as any SCV of that player is idle.

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on Idle Unit as Condition

    @nrtwenty: Go

    There could be a much easier way.

    There is a trigger event called "Unit becomes Idle". Use that to start your timer. When the timer runs out, use the "Unit is in Unit Group" Condition with Unit Group "Idle Units of Player" and Player "Owner of Init" to check if your Units is still idle

    You need Triggers similar to these three:

    Becomes Idle
        Events
            Unit - <My Unit> Becomes idle
        Local Variables
        Conditions
        Actions
            Timer - Start <Unit Timer> as a One Shot timer that will expire in 10.0 Game Time seconds
    
    Stops being Idle
        Events
            Unit - <My Unit> Stops Being idle
        Local Variables
        Conditions
        Actions
            Timer - Pause <Unit Timer>
    
    Timer run out
        Events
            Timer - <Unit Timer> expires
        Local Variables
        Conditions
            (<My Unit> is in (Idle <(Units or Workers - what ever you need)> for player (Owner of <My Unit>))) == True
        Actions
            ------- Time runs out - Acrions here...
    

    Note that the second trigger is just for stopping the timer when the units is not idle any more. You can use "Any Unit" instead of <My Unit>-Variablebut then the timer gets started when ever a unit gets idle.

    Hope this solves your problem.

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on Need help with advanced trigger(s)

    @Veta20: Go

    Thought about using Regions?
    You can store them in Variables, create or delete them via triggers and check for units within them.
    The only prob would be the event, AFAIK you can't trigger region events with variables...

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on Fire trigger when no unit nearby

    Edit: bit too late... ;)

    This could do your job:

            locunit = No Unit <Unit>
        Conditions
        Actions
            Unit Group - For each unit locunit in (<Unit Type> units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Number of Living units in (Any units in (Region((Position of locunit), <Range>)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) > 0
                        Then
                            ------- There is a unit in Range -> No Fireing...
                        Else
    

    Cheers
    Then

    Posted in: Triggers
  • 0

    posted a message on Teleport using pathing

    Well, I made my thoughts and came to the solution that you have to somehow set a flag for the unit which determines that the units is controlled by your trigger.

    A solution for that would be ading the unit to a global unitgroup before giving the orders and removing it after the orders are given.
    Then have a condition if the unit is not in the group:

    Movement
        Events
            Unit - Any Unit is issued an order to  Move
        Local Variables
            Target Location = No Point <Point>
            Start Point = No Point <Point>
            Close Station = No Unit <Unit>
            Target Station = No Unit <Unit>
        Conditions
            ((Triggering unit) is in Teleported Units) == false
        Actions
            Variable - Set Start Point = (Position of (Triggering unit))
            Variable - Set Target Location = (Target point for (Triggering order))
            Variable - Set Close Station = (Closest unit to Start Point in (Units in (Get Stations()) owned by player (Triggering player), with at most Any Amount))
            Variable - Set Target Station = (Closest unit to Target Location in (Units in (Get Stations()) owned by player (Triggering player), with at most Any Amount))
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            (+ ((Real((Pathing cost between Start Point and (Position of Close Station)))), (Real((Pathing cost between (Position of Target Station) and Target Location))))) < (Real((Pathing cost between Start Point and Target Location)))
                            Target Station != Close Station
                Then
                    Unit Group - Add (Triggering unit) to Teleported Units
                    Unit - Order (Triggering unit) to ( Move targeting (Position of Close Station)) (Replace Existing Orders)
                    Unit - Wait until (Triggering unit) Becomes idle
                    Unit - Move (Triggering unit) instantly to (Position of Target Station) (No Blend)
                    Unit - Order (Triggering unit) to ( Move targeting Target Location) (Replace Existing Orders)
    
                    ------- Maybe a wait here to give the engine time for fireing the events and terminate corresponding triggers
    
                    Unit Group - Remove (Triggering unit) from Teleported Units
                Else
    

    Alternative would be to set the custom value of the unit to a specific value. This would have the same effect.

    Dark side of this is that you have to remove this kind of "flag" if the teleport is canceled or finished, which results in other triggers to check this situations...
    Does someone have an better idea for this (at least a bit) bad way?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Teleport using pathing

    @ParanoidPenguin: Go

    Sorry to ask, but I dont know what's the problem here except that you use the variable Movement - Ordered By Trigger as global which could cause problems with multiple units ordered by the player at the same time (thinking about a better solution myself right now :) )

    So please explain what's going wrong

    Cheers
    Then

    Posted in: Miscellaneous Development
  • 0

    posted a message on Teleport using pathing
    Quote from Helral: Go

    1. You didn't store the Triggering Unit, so it might be altered/lost after the wait.

    Sorry for being so fussy but thats somethig many people on sc2mapster believe (probably old wc3 mapper? ;) )
    In wc3 times, functions like Ordered Unit, Dying Unit etc referred to global (internal) variables, which were overriden each time such a event occurs.

    But blizz done in better in sc2. They linked those variables with each execution of a event (probably with the thread itself).
    So the result of Triggering Unit, Target Of Ability Being Cast etc wount change anymore (tested it including multiple trigger instances and waits, no change of the results)

    Quote from Helral: Go

    3. If a player wants to move somewhere, you select a station for it, player cancels the order (unit becomes idle). Now the unit(s) get ported to the end-station and continue movement.

    Quote from ParanoidPenguin: Go

    3. I don't actually get what you mean by canceling the order. Stopping the unit does not the instant port as it is probably a new order.

                    Unit - Wait until (Triggering unit) Becomes idle
                    Unit - Move (Triggering unit) instantly to (Position of Target Station) (No Blend)
    

    What Helral meanes is that clicking the stop button will order the unit to stop (and therefore get idle).
    But then the Condition for the Wait is true so the unit gets ported.
    Better solve this by checking if the unit is in range of the portal.

    Quote from ParanoidPenguin: Go

    - If I included a condition that would somehow check if the unit received the order from the trigger, it wouldn't be able to recognise the order and fire the event anyway, producing the lag, right?

    It would be executed once and then no more.
    Cause by Unit - Order (Triggering unit) to ( Move targeting Target Location) (Replace Existing Orders) the trigger event fires again (like Helral said)
    So it calculates the path again and orders the unit again - which fires the event again... and so on

    Adding a condition if the order comes from user or trigger should inhibit this.
    Cause after the first Order Triggering Unit the Triger event will fire once but the trigger wont run through so there will no new order given -> no new trigger execuion.

    Quote from ParanoidPenguin: Go

    - Does the simple recognition of an event execute a new thread? Or does the trigger have to actually do something, eg get past the conditions to be a new thread?

    Looking into the generated galaxy code showed me that the conditions of a trigger get translated into a if-statement at top of the trigger function.
    This means that every event starts a new thread running this function, but if the conditions are not true, the thread will terminate shortly after start.

    So far from my side and knowledge, someone corect me if I'm wrong ;)
    Cheers
    Then

    Posted in: Miscellaneous Development
  • 0

    posted a message on Teleport using pathing

    @ParanoidPenguin: Go

    You could trigger a path calculation youself to include the portals.

    There's the function Pathing Cost Between Points, which gives you the real walk way between two points.
    Then you only need to get the station nearest to your unit and the one near to the goal and check, if those two ways added are less than the direct way.
    If so, give the unit a new move/attack/what ever order to the station, port it and let it move from station to goal.
    This could be triggered by Unit Is Issued Order Event or something like that...

    Done so, the teleportation can be triggered, aswell...

    Cheers
    Then

    Posted in: Miscellaneous Development
  • 0

    posted a message on Teleport using pathing

    @Dresnia: Go
    I think he wants something like the old Portals in WC3, which teleport "path" where included in unit's movement calculation.

    @ParanoidPenguin: Go
    AFAIK there's nothing as simple as those portals available in sc2 since there are already a few threads about it and none got very good solution.

    Cheers
    Then

    Posted in: Miscellaneous Development
  • 0

    posted a message on Trigger Exercise #3 - Tower Defense Spawning System

    never done something like that before but wouldn't it be possible with multi-dimensional arrays?

    eg. first dimension for the choosen map, second for the path and third for the point of the path.
    Then you have to size the array only to the max values you need

    Cheers Then

    Posted in: Triggers
  • 0

    posted a message on Terrain editor bug, need help!

    @Vexal: Go

    dunno, maybe for better texture eding...

    Posted in: General Chat
  • 0

    posted a message on Terrain editor bug, need help!

    @Vexal: Go

    you maybe have View->Show Terrain->Show hidden Terrain Cells activated

    Posted in: General Chat
  • 0

    posted a message on Create new unit inside Nydus

    Sorry, I overread that Data Secton *shame* ;)

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