• 0

    posted a message on Mimicing the pull of gravity and orbits [SOLVED]

    Hey there SC2mapster, long time no see. Etc, etc, etc.

    I am at a serious loss. All searches have either turned up nothing or simply partial answers to my bigger puzzle. I need to know how to mimic the force of gravity via triggers. So that I can have some set massive objects that ARE NOT MISSILES orbit around, and then as they move they can suck other objects into orbit/into them.

    Preferably, this doesn't need to be super realistic because, while I LOVE realism in these sc2 maps, having objects smacking into each other simply because one is moving and one isn't, or what have you, is kind of a bummer. So really I just need a way to mimic the gravitational pull to a point. At said point they will orbit, instead of smacking or being deflected. If they are close enough they can be smacking into each other or what have you. However I'll work with what I can get TBQH.

    I already have the orbitting down, through some very simplistic code.

    Orbit
        Options: Action, Create Thread
        Return Type: (None)
        Parameters
            Orbiting Unit <Unit>
            Unit Being Orbited <Unit>
            Speed of Orbit = 0.1 <Real>
        Grammar Text: Orbit(Orbiting Unit, Unit Being Orbited, Speed of Orbit)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            Rotation Center = (Center of (Unit group(Unit Being Orbited))) <Point>
            Current Angle = (Angle from (Position of Orbiting Unit) to Rotation Center) <Real>
            Rotation Distance = (Distance between (Position of Orbiting Unit) and Rotation Center) <Real>
        Actions
            Variable - Set Rotation Center = (Center of (Unit group(Unit Being Orbited)))
            Variable - Set Current Angle = (Angle from (Position of Orbiting Unit) to Rotation Center)
            General - While (Conditions) are true, do (Actions)
                Conditions
                    (Orbiting Unit is alive) == True
                Actions
                    Variable - Set Rotation Center = (Center of (Unit group(Unit Being Orbited)))
                    Unit - Move Orbiting Unit instantly to (Rotation Center offset by Rotation Distance towards Current Angle degrees) (Blend)
                    Variable - Modify Current Angle: + Speed of Orbit
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            Current Angle >= 360.0
                        Then
                            Variable - Modify Current Angle: - 360.0
                        Else
                    General - Wait 0.0 Game Time seconds
    Rotate on Axis
        Options: Action, Create Thread
        Return Type: (None)
        Parameters
            Rotating Unit <Unit>
            Speed of Rotation = 0.1 <Real>
        Grammar Text: Rotate on Axis(Rotating Unit, Speed of Rotation)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            Rotation Center = (Center of (Unit group(Rotating Unit))) <Point>
            Current Rotation = 0.0 <Real>
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                    (Rotating Unit is alive) == True
                Actions
                    Unit - Make Rotating Unit face Current Rotation over 0.1 seconds
                    Variable - Modify Current Rotation: + Speed of Rotation
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            Current Rotation >= 360.0
                        Then
                            Variable - Modify Current Rotation: - 360.0
                        Else
                    General - Wait 0.0 Game Time seconds
    

    While pretty, this isn't very practical. Not only does it require me to do some real headache-inducing math for every. Individual. Instance. But it simply isn't accurate or smooth enough. Units will orbit on what I can only assume is a grid, or not orbit at all, or start their orbits on the opposite side of the orbited unit. It's just a pain. Plain and simple.

    So does anyone know either:

    • Where I can find a comprehensive guide(s) to create and mimic the force of gravity in the ways specified?
    • How to mimic the force of gravity in the way specified?
    • How to mimic the force of gravity at all?

    Thanks in advance.

    Posted in: Triggers
  • 0

    posted a message on Sc2Mapster Dead?

    Not really dead, just...lacking.

    It would be nice to have people answering your questions all the time but the fact of the matter is people aren't as active as you'd like sometimes.

    For instance I like to help whoever I can whenever I can, but there is still alot I've never needed to know and thus don't know, besides the fact if you're trying to help everyone you're going to get strung out. Then the people who do know these things don't really care for browsing the forums (I imagine), I guess because they already know what they need to thus there is no need to browse the help forums? I wouldn't know.

    So give it a few days then bump your thread, if you're really itching for help IRC is the best place for fast and informative help. As well you can ask lurkers like me for help and generally it will be reciprocated.

    Posted in: General Chat
  • 0

    posted a message on [Closed] Unit Spawning Trigger

    @iMisu: Go

    Well first of all I thought you wanted to to start at 5 minutes? 300 seconds.

    Regardless make sure you pick all players in active players, and then MOVE the repeating function out and pick all players in the repeating function.

    As well, make sure you move the modification of the variable out of the pick each player in the repeating so it is only changed once.

    Past that I'll have to get back to it later.

    Posted in: Triggers
  • 0

    posted a message on [Closed] Unit Spawning Trigger
    Quote from Oparcus: Go

    That wouldn't work, the pick each play action would only run through once, and would stop at the repeat forever loop.

    I've actually used while loops in a pick each units function and it worked fine, but all you really need to do otherwise is make a pick each player function in the forever loop if this is the case.

    Although having the number of players in a variable as well as only running the modify variable function once is crucial, I didn't really feel it was necessary though as this was a "rough draft" if you will.

    Posted in: Triggers
  • 0

    posted a message on [Closed] Unit Spawning Trigger

    @iMisu: Go

    Umm, I think something like this:

    Melee Initialization
        Events
            Timer - Elapsed time is 300.0 Game Time seconds
        Local Variables
            Unit Count = 0 <Integer>
        Conditions
        Actions
            Variable - Set Unit Count = (1 * (Number of players in (Active Players)))
            Player Group - Pick each player in (Active Players) and do (Actions)
                Actions
                    Unit - Create Unit Count (Commentator Bot 1) - Artosis Bot 2000 for player (Picked player) at YOURPOINT facing YOURFACING (No Options)
                    General - Repeat (Actions) forever
                        Actions
                            Variable - Modify Unit Count: + (Number of players in (Active Players))
                            General - Wait 15.0 Game Time seconds
                            Unit - Create Unit Count (Commentator Bot 1) - Artosis Bot 2000 for player (Picked player) at YOURPOINT facing YOURFACING (No Options)
    

    ?

    Posted in: Triggers
  • 0

    posted a message on Get the kill resources - Minerals and Vespene?

    @Demtrod: Go

    Works for me

    //code//
            Debug - Display (Text((Value of Units UltraliskCavern KillResource[Minerals] for player Any Player))) as debug output using Type 01, and Do display it in the game window
    
    //debug message//
    00:00:00.00 1
    

    The [Minerals] has to be of Preset "Resource Type".

    Posted in: Triggers
  • 0

    posted a message on Acces denied when I try to modify energy cost of a morph ability?

    @Demtrod: Go

    Some catalog values cannot be changed by you. I think this is an arbitrary restriction placed on you by Blizzard for god knows what reason.

    Suffice it to say this is probably one of them.

    Posted in: Triggers
  • 0

    posted a message on Edit Boxes

    @lemmy734: Go

    As far as I know the "text" in an edit box is already a string.

            string = (Edit value of (Used dialog item) for 1) <String>
    
    Posted in: Triggers
  • 0

    posted a message on Doodads not spawning....

    @willuwontu: Go

    Actually the problem is they aren't spawning at all. However I'll give it a try sometime tomorrow and get back to you.

    EDIT: been real busy, will get around to it eventually.

    Posted in: Triggers
  • 0

    posted a message on Doodads not spawning....

    @BasharTeg: Go

    I actually did. I, personally, need the map revealed (if even for a short period) before they will spawn. Similarly setting to "grey mask" instead of "black mask" works.

    As well this is a problem across the board meaning I have tried other maps and the same thing happens.

    Posted in: Triggers
  • 0

    posted a message on Doodads not spawning....

    @BasharTeg: Go

    I was considering that it's just a pain in the butt to do as I plan to make use of many doodads at once.

    I'll keep it in mind but I am hoping for an option that involves fixing the doodads spawning.

    Posted in: Triggers
  • 0

    posted a message on Doodads not spawning....

    @Yaksmanofage: Go

    Still nothing, anyone?

    Posted in: Triggers
  • 0

    posted a message on Trigger Recreation Help Please? [Trigger Setup Shown]

    @hobbidude: Go

    I was able to help him with an action definition that worked similarly. He just hasn't locked the thread.

    Posted in: Triggers
  • 0

    posted a message on Doodads not spawning....

    @Yaksmanofage: Go

    Anyone? This is very annoying as some of my game features require a black mask....

    Posted in: Triggers
  • 0

    posted a message on Trigger Recreation Help Please? [Trigger Setup Shown]

    @xXPwnerOfNoobsXx: Go

    back at-cha

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