• 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    Hi all, thanks for your suggestions. I sort of figured out how to make it work for 1 zergling.

    I found a very useful function "Angle between points", which returns the angle from point 1 to point 2 as a real value in degrees. I changed the trigger "Change Marine Angle" accordingly to get this:

            Unit Group - Pick each unit in nearby units and do (Actions)
                Actions
                    Unit - Set (Picked unit) custom value 0 to (Angle from (Position of (Picked unit)) to (Position of Marine))
                    Variable - Set angle = (Angle from (Position of (Picked unit)) to (Position of Marine))
                    Variable - Set nearby units angles = (nearby units angles + (Angle from (Position of (Picked unit)) to (Position of Marine)))
            Handle Marine Angle(angle)
    

    It seems like it doesn't make sense, especially this line "Variable - Set angle = (Angle from (Position of (Picked unit)) to (Position of Marine))". Why am I setting the angle between the Zergling and the Marine as the angle for the Marine to turn?

    Well, this is something I found that was interesting when I use the Angle between points function with point 1 as the position of Zergling and point 2 as the position of the marine:

    Basically the Angle Between Points function sort of returns the opposite angle as compared to Make Unit Face Angle. So with this I sort of found the opposite of an angle. So the map works, but only with 1 zergling.

    I don't know how to move on for more than 1 zergling, but I hope you guys will continue to give me advice. Thanks.

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @Trieva: Go

    Hi, Trieva, thanks for your response. Unfortunately Im not too good at using this map editor. Actually I was doing this earlier and I sort of gave up very quickly as I didn't know how to continue. (I use GUI btw)

    This only useful action I found was "Make Unit Face Angle". It makes a unit face an angle that you specify.
    A function I found called "Facing angle of unit" gets the facing angle (in a real) of a unit.

    What I found interesting was the "angle mechanics". In the terrain editor to change the rotation of any unit you specify an angle between 0 and 360 degrees. The function "Facing angle of unit", however, returns a value of between -180 and 180 degrees. Figured out using a simple trigger:

    And the result is a marine looking at the left and gradually turning in anti-clockwise direction. Here's a simple visualisation I made from what I understand:

    Here is the trigger Change Marine Angle I made but it doesn't work.

    Change Marine Angle
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
            nearby units = (Empty unit group) <Unit Group>
            number of nearby units = 0 <Integer>
            nearby units angles = 0.0 <Real>
            angle = 0.0 <Real>
        Conditions
        Actions
            Variable - Set nearby units = (Zergling units in (Region((Position of Marine), 2.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
            Variable - Set number of nearby units = (Number of Living units in nearby units)
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    number of nearby units == 0
                Then
                    Variable - Set angle = 270.0
                    Handle Marine Angle(angle)
                    General - Skip remaining actions
                Else
            Unit Group - Pick each unit in nearby units and do (Actions)
                Actions
                    Unit - Set (Picked unit) custom value 0 to (Facing of (Picked unit))
                    Variable - Set nearby units angles = (nearby units angles + (Facing of (Picked unit)))
            Variable - Set angle = ((number of nearby units * 360.0) - nearby units angles)
            Handle Marine Angle(angle)
    

    Basically everything is already working correctly and well set, just that I don't know what to set the variable "angle" as and I'm trying to figure it out. Just need to think of some mathematical thing to achieve this...

    By the way, this is the "Handle Marine Angle" action definition:

    Handle Marine Angle
        Options: Action
        Return Type: (None)
        Parameters
            angle = 0.0 <Real>
        Grammar Text: Handle Marine Angle(angle)
        Hint Text: (None)
        Custom Script Code
        Local Variables
        Actions
            Unit - Order Marine to ( Turn targeting ((Position of Marine) facing angle degrees)) (Replace Existing Orders)
            UI - Display (Text(angle) with 2 decimal places) for (All players) to Subtitle area
    

    That's all I have. What I'm thinking is that the variable "nearby units angles" is completely useless and probably won't have any use in calculating the variable "angle". I think what I really need is a way to find the zergling's position relative to the marine in terms of angle. Like I need to find a way to get the number 0 when a Zergling is directly on the right of the Marine.

    I hope you can help me :)

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    Does anyone know how to make something like the angle test?

    EDIT:

    The video's angle test seems a little vague, I think this one seems more in-depth:

    Also see this post: http://www.sc2mapster.com/forums/development/triggers/79964-dargleins-marine-ai/#p3 It shows what I have tried and found out.

    Basically I need the Marine to face the "safest" place, so that later the angle that was used to make the Marine face this position will be very very useful to implement a kiting bot. The factors that will affect where the Marine is facing:

    - Number of Zergling(s)

    - Position of Zergling(s)

    - Distance between Zergling(s) and the Marine (ignore this as a start)

    - Terrain ( also ignore this as a start)

    Posted in: Triggers
  • 0

    posted a message on Changing race of UI in-game

    @FunkyUserName: Go

    Lol troll? Serious...

    Posted in: Triggers
  • 0

    posted a message on Changing race of UI in-game

    @FunkyUserName: Go

    ZZZZZZ...... is there a faster and simpler way...?

    Posted in: Triggers
  • 0

    posted a message on Changing race of UI in-game

    @FunkyUserName: Go

    Sorry, I'm new to dialogs. So which elements and which type of dialog item (is it button, portrait, etc.) do I hookup?

    Posted in: Triggers
  • 0

    posted a message on Changing race of UI in-game

    Hi all,

    Is there a way to change the race of the UI in-game using pure triggers preferably?

    For example, how do I change the UI of

    Terran UI

    to

    Protoss UI

    (ignore the terrain D: )

    Or basically how do I change Terran UI to Protoss UI, including the resource symbols.

    Posted in: Triggers
  • 0

    posted a message on What is the setting to get the unit to move if out of range?

    Hi

    How do I get the caster of an ability to move towards the target point if the target point is out of range?

    Thanks

    Posted in: Data
  • 0

    posted a message on Game speed increase

    Thanks a lot! Just to clarify, the lower the global time scale, the slower the game?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Game speed increase

    Bump. I need this too. Is there a way to do this only using triggers?

    Posted in: Miscellaneous Development
  • 0

    posted a message on How do I hide the health bar of units using triggers?

    Using triggers, how to hide the health bar of a unit? If impossible to do with triggers, how to do it with data?

    Posted in: Triggers
  • 0

    posted a message on Why Galaxy Editor always not responding when I try to save?
    Quote from Labingo: Go

    There is some specific Setting related to Saves: Preferences > Documents > "Optimizing Saving for..." you might try if this results in any difference.

    Hi, I tried changing the setting to the other option (smaller files) and there wasnt much difference

    Posted in: Miscellaneous Development
  • 0

    posted a message on Why Galaxy Editor always not responding when I try to save?

    @Labingo: Go

    Thanks, I'll try it later. To answer ur questions:

    - The project file isnt that large, even if I dont modify any data, it stills take a LOOOONG time to load

    - Maps in general take long to save...

    - Using a Core i3 Windows 7 computer

    Posted in: Miscellaneous Development
  • 0

    posted a message on Why Galaxy Editor always not responding when I try to save?

    @Labingo: Go

    Thanks for your reply, but when I save it to my computer (not thumbdrive) this problem still remains...

    Posted in: Miscellaneous Development
  • 0

    posted a message on Why Galaxy Editor always not responding when I try to save?

    Im using a Windows 7 computer. So i have a Galaxy Editor file in my thumbdrive and whenever I save it (using Ctrl+S), Galaxy Editor will not respond for about 1 minute and I have to wait that 1 minute before I can continue with my work. Anyone else experience this glitch? How do i fix this?

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