• 0

    posted a message on Reproducing the production tab

    @BasharTeg: Go

    My problem is that first part. I don't see any function that returns all units owned by player X. The best I can find is "Units in Region With Alliance to Player." Since the building units are not in a "region" then they are not returned by this function (at least that's my theory as to why I'm not seeing anything). Here's my code.

            Variable - Set allUnitsGroup = (Units in (Entire map) having alliance Ally with player player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
            Unit Group - For each unit unit in allUnitsGroup do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (unit is under construction) == True
                        Then
                            Bank - Store string "found a unit under construction" as "key" of section "data" in bank playerBank
                        Else
    

    If this route doesn't work, I suppose I could track the event "Unit - Any Unit construction progress is Started" and add that unit to an array (or data table - haven't played with either that much) and then check on the progress of the units in there every so often.

    Thoughts?

    EDIT: Took a stab at my alternate solution proposal and it seems units are not included in the Event "Any Unit construction progress is Started" and only buildings are:

        Events
            Unit - Any Unit construction progress is Started
        Local Variables
            unitPickedName = "" <String>
            unit = No Unit <Unit>
            playerBank = No Bank <Bank>
            player = 0 <Integer>
        Conditions
        Actions
            Player Group - For each player player in (All players) do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Owner of (Triggering progress unit)) == player
                        Then
                            Variable - Set playerBank = productionBanksArray[player]
                            Variable - Set unit = (Triggering progress unit)
                            Variable - Set unitPickedName = (Value of Units (Unit type of unit) Name for player Any Player)
                            Bank - Store string unitPickedName as "key" of section "data" in bank playerBank
                            Bank - Save bank playerBank
                        Else
    

    Looks like it's not possible to see how far along a unit is in production? Can this be true?

    Posted in: Triggers
  • 0

    posted a message on Reproducing the production tab

    Hi all, Is there any way to get the current production for a user? I'm talking about units/buildings/research as it is shown in the observer interface. This trigger would fire off every X seconds and just pull the data for the players in the player group that are currently playing. Data would be saved to a bank like:

    "barracks" : 0.74
    "barracks" : 0.64
    "marine" : 0.10
    "refinery" : 0.50
    "combat_shields" : 0.50
    

    I can imagine you might have to track buildings/units/research separately which is okay too. I've tried a few things including counting only units "Under Construction" but am unable to get any meaningful data out.

    Has anyone built anything like this and can shed some light on the direction I should go in?

    Thanks for the help! :)

    Posted in: Triggers
  • 0

    posted a message on [Solved] Trigger to write out "army tab" showing how many of each unit a player has

    @willuwontu: Go

    Ahh sorry - should've been clearer. This doesn't have to do with the Unit/Name stuff - that can easily be removed in the Editor or later on as I'm doing now.

    I meant currently I write out SCV, SCV, SCV, SCV, Command Center to my bank file. Is there any way to make it so I can write out SCV 6, Command Center 1, Marines 17, etc. Right now I just write out a list of every unit.

    I suppose I could do as I'm doing now, but for every unit type, get the total of that unit and write that, but then I'd still be writing N times if I have N units no?

    Posted in: Triggers
  • 0

    posted a message on [Solved] Trigger to write out "army tab" showing how many of each unit a player has

    @willuwontu: Go

    Thank you thank you thank you! That worked great! For anyone who stumbles upon this later, here is my trigger to get this working:

    When a unit is built write out current unit counts
        Events
            Unit - Any Unit creates a unit with ability Any or behavior No Game Link
        Local Variables
            player = 0 <Integer>
            xmlKey = 0 <Integer>
            unit = No Unit <Unit>
            unitPickedName = "" <String>
            allUnitsGroup = No Unit Group <Unit Group>
        Conditions
        Actions
            Player Group - For each player player in (All players) do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Owner of (Created unit)) == player
                        Then
                            Bank - Open bank "unitsBuiltBank" for player player
                            Variable - Set allUnitsGroup = (Any units in (Entire map) owned by player player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
                            Unit Group - For each unit unit in allUnitsGroup do (Actions)
                                Actions
                                    Variable - Set unitPickedName = (Value of Units (Unit type of unit) Name for player Any Player)
                                    Bank - Store string unitPickedName as (String(xmlKey)) of section "data" in bank (Last opened bank)
                                    Variable - Set xmlKey = (xmlKey + 1)
                            Bank - Save bank (Last opened bank)
                        Else
    

    This will write out data to the bank that looks like:

    <?xml version="1.0" encoding="utf-8"?>
    <Bank version="1">
        <Section name="data">
            <Key name="4">
                <Value string="Unit/Name/SCV"/>
            </Key>
            <Key name="6">
                <Value string="Unit/Name/SCV"/>
            </Key>
            <Key name="3">
                <Value string="Unit/Name/SCV"/>
            </Key>
            <Key name="0">
                <Value string="Unit/Name/SCV"/>
            </Key>
            <Key name="2">
                <Value string="Unit/Name/SCV"/>
            </Key>
            <Key name="7">
                <Value string="Unit/Name/CommandCenter"/>
            </Key>
            <Key name="5">
                <Value string="Unit/Name/SCV"/>
            </Key>
        </Section>
    </Bank>
    

    And at the next layer in my stack (I'll share this project once it's complete), I'm able to condense this into the desired format of: SCV : 7 CommandCenter : 1 Marine : 1

    I didn't see anyway to iterate over each type of unit and write this out directly from SC2 to the bank files without doing if (Marine ) if (SCV), etc. Does anyone know if there are any optimizations between my code and the final desired product?

    Thanks all!

    Posted in: Triggers
  • 0

    posted a message on [Solved] Trigger to write out "army tab" showing how many of each unit a player has

    @willuwontu: Go

    Cool! Thanks! Would appreciate that. I saw some code on this site for doing it for a specific unit, but doing it for every race and unit in that race seems a bit redundant, but if it's the only way I suppose it'll have to be done that way.

    Posted in: Triggers
  • 0

    posted a message on [Solved] Trigger to write out "army tab" showing how many of each unit a player has

    I am trying to get the player's army composition (e.g. 10 drones, 1 overlord, 3 larva, etc.) written out to a bank file when a new unit is created. What I have currently is pasted below. My current issue is I'm only able to get the total number of units, and I'm not able to get the unit name/identifier written out. Ideally, I'd be writing data out:

    "drones" : 10 "overlord" : 1 "larva" : 3

    Can anyone offer some direction on how to get this working properly? It's not critical I get the actual unit name. So long as it's some unique identifier, I can figure out what those identifiers are and then create a mapping between those and "human-readable" names farther down in my stack.

    Many thanks!

    When a unit is built write out current unit counts
        Events
            Unit - Any Unit creates a unit with ability Any or behavior No Game Link
        Local Variables
            i = 0 <Integer>
            unitPickedUnit = No Unit <Unit>
            unitPickedName = "" <String>
            unitPickedUnitTotalCount = 0 <Integer>
            allUnitsGroup = No Unit Group <Unit Group>
        Conditions
        Actions
            Player Group - For each player i in (All players) do (Actions)
                Actions
                    Variable - Set allUnitsGroup = (Any units in (Entire map) owned by player i matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
                    Bank - Open bank "unitsBuiltBank" for player i
                    Unit Group - Pick each unit in allUnitsGroup and do (Actions)
                        Actions
                            Variable - Set unitPickedUnit = (Picked unit)
                            Variable - Set unitPickedName = "how_do_i_get_this"
                            Variable - Set unitPickedUnitTotalCount = (Number of Living units in allUnitsGroup)
                            Bank - Store integer unitPickedUnitTotalCount as unitPickedName of section "data" in bank (Last opened bank)
                    Bank - Save bank (Last opened bank)
    
    Posted in: Triggers
  • 0

    posted a message on [Solved] For Triggers triggered on a timer, how do you get the player index

    @Ahli634: Go

    Thank you for the reply! I think I got the first part of your recommendation working!

    Write APM to every 1 second
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
            i = 0 <Integer>
            playerAPM = (Player i APM score) <Integer>
        Conditions
        Actions
            Player Group - For each player i in (All players) do (Actions)
                Actions
                    Variable - Set playerAPM = (Player i APM score)
                    Bank - Open bank "apmBank" for player i
                    Bank - Store integer playerAPM as "player_apm" of section "data" in bank (Last opened bank)
                    Bank - Save bank (Last opened bank)
    

    What would the bank code you described look like generally? Is what I'm doing now not correct or just not recommended/standard?

    Thank you!

    Posted in: Triggers
  • 0

    posted a message on [Solved] For Triggers triggered on a timer, how do you get the player index

    Hi all! Having some problems with a 2 player map I'm working on. Here's where I'm getting stuck...

    Write vespene collected/current count every time it changes
        Events
            Player - Player (Triggering player) Vespene changes 
        Local Variables
        Conditions
        Actions
            Bank - Open bank "vespeneBank" for player (Triggering player)
            Bank - Store integer (Player (Triggering player) Vespene) as "current_vespense_count" of section "data" in bank (Last opened bank)
            Bank - Store integer (Player (Triggering player) Vespene Collected) as "total_vespene_collected" of section "data" in bank (Last opened bank)
            Bank - Save bank (Last opened bank)
    

    This trigger works great because I'm able to use the (Triggering player) in the Actions because the event that triggers this is a player's vespene count changes.

    When I'm trying to record some attribute about the player every X seconds like APM:

    Write APM to every 1 second
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
            playerAPM = (Player 1 APM score) <Integer>
        Conditions
        Actions
            Bank - Open bank "apmBank" for player 1
            Bank - Store integer playerAPM as "player_apm" of section "data" in bank (Last opened bank)
            Bank - Save bank (Last opened bank)
    

    I don't have a notion of (Triggering player) anymore so I'm forced to use Player 1 APM score to get the APM and then player 1 to get the bank. This will record data on Player 1's computer, but Player 2's data won't be saved unless I make another trigger or duplicate some code to also get their APM.

    Is there any way around this Timer-triggered events/getting access to the player index? I don't particularly care about player indices in this case and I don't want to have 2 version of every trigger. Am I missing something obvious?

    Thanks in advance for the help!

    EDIT: Here's the most "concise" solution I can come up with:

    Write APM to every 1 second
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
            player1APM = (Player 1 APM score) <Integer>
            player2APM = (Player 2 APM score) <Integer>
        Conditions
        Actions
            Bank - Open bank "apmBank" for player 1
            Bank - Store integer player1APM as "player_apm" of section "data" in bank (Last opened bank)
            Bank - Save bank (Last opened bank)
            ------- TODO: make this more concise if possible by eliminating player index
            Bank - Open bank "apmBank" for player 2
            Bank - Store integer player2APM as "player_apm" of section "data" in bank (Last opened bank)
            Bank - Save bank (Last opened bank)
    

    Once I learn how to write share-able modules, this probably won't look to bad, but is there a better way?

    Posted in: Triggers
  • 0

    posted a message on [Request] map/mod that writes various game data to banks

    @SouLCarveRR: Go

    I made a prototype of my design already, writing out changes to minerals, vespene, and supply to different banks. I wrote my own XML parser using Ruby. The glue from XML parsing to the audio code is all done via OSC. I went into it thinking it would be terrible, but the latency across the entire system is not terrible. That said, I'm not sure what'll happen when we have 3-4 times more bank files. :)

    Gah! A bit out of my budget, but thank you for offering. I'm getting hung up most on going from triggers such as "minerals changed" to grabbing data for a particular player on a timer. Not to mention, the data isn't organized as one would expect and there is no documentation. I've tried the Galaxy Editor and recently just coding directly in the .galaxy file and using the Galaxy editor, but it's all too opaque for me to figure out right now. Hehe... oh wells! :)

    And I do like your replay idea and agree that it would be technically more feasible given we can "render" performances ahead of time, but I was hoping to make this a "live" performance piece!

    GGs!

    Posted in: Map Suggestions/Requests
  • 0

    posted a message on [Request] map/mod that writes various game data to banks

    Hi all!

    I've been lurking around the SC2Mapster website and forums for assistance in a project I'm working on and was wondering if someone could help me. I'm working on submitting a performance piece and the premise is that we would take a Starcraft 2 match and "sonify" it by adding sound to actions and attributes of the game. At a high-level I'd like a mod (or map with mod applied to it) that would write a bunch of data to different banks and then I'd have an XML parser parsing that data and passing it to the sound engine. Things I'm looking to capture:

    • every A milliseconds, write out standing army size
    • every B milliseconds, write out units in production
    • every C milliseconds, write out research production tab (could be grouped up with above production tab I suppose)
    • whenever a unit dies, write out to bank
    • every D milliseconds, write out APM
    • trigger - move/attack/etc - write out what units/the command/destination (e.g. 5 marines, move, 77, 233)
    • every E milliseconds, write out where the current player's camera is focused on (e.g. 77, 100 (main base) or 122, 100 (middle of map somewhere))
    • every F milliseconds, write out current economy data (minerals, gas, supply)
    • every G milliseconds, write out units lost for player

    I was wondering if anyone would like to help. I do understand that time is valuable so if anyone is interested, we could discuss anything I might've missed and compensation. From what I gather, I'm not trying to do anything too complicated here - it just seems there is a very steep curve to getting all this stuff working! :)

    Hope we can work on this together. Obviously, you would be credited in the paper/performance write-up for your contributions.

    Thanks!

    Posted in: Map Suggestions/Requests
  • 0

    posted a message on (Request)help creating some custom triggers+bank saving on existing maps

    Hi all, I'm working on a project that involves taking an existing map (2-player works) and mining data out of it into banks, which is then processed. I got a basic trigger in place that would write economy data to the bank every time minerals/vespene/supply changed, but have gotten stuck of late on getting more advanced triggers set up (mostly ones that I want to do in fixed intervals which I can't quite figure out how to do). I was wondering if anyone could help me set up the following:

    - every x seconds, write out the current unit/unit count to a bank (marines:10, marauders:20, etc)

    - every y seconds, write out units in production/their progress (marine:.50, marine:.25, marauder:.60)

    - whenever a unit dies, add that unit to a bank that tracks the number of units killed (e.g. marines:6, marauders:2, etc)

    - every z seconds, write out the APM (I suppose EPM now) to a bank

    - every a seconds, write out research being upgrade and progress (this might just be done in the unit progress task above?)

    - every b seconds, write out each unit and it's position on the map (e.g. marine1:201, 192, marine2:202,190, etc)

    - every time a user moves a unit/group of units, write the destination to a bank

    That's what I can think of off the top of my head - I might come up with more. I know this is asking a lot (or maybe, it's really easy and I'm just dumb), so I'd be willing to work out some sort of compensation for whoever can help me make this happen. If anyone is interested, please PM me and we can work out details over chat/Skype/preferred method of interwebs communication.

    Thanks and have a great one! :)

    Posted in: General Chat
  • 0

    posted a message on Retrieving APM for "triggering player"

    @gerSlikey: Go

    Hey! Thanks for the help. Very much appreciated! I have one issue though - I load your map and get these errors:

    [10/1/2011 6:26:33 PM] Warning: Orphaned trigger parameter removed from Function Call 'Status Of Player' (Parameter Value, 27932CEF, Lib: 0) [10/1/2011 6:26:33 PM] Warning: Orphaned trigger parameter removed from Function Call 'Remove Player From Player Group' (Parameter Value, E190D303, Lib: 0)

    Any idea what's going on?

    Screenshot: http://cl.ly/3c0t3U1T382M0h3L1Z1d

    Thanks!

    Posted in: Triggers
  • 0

    posted a message on Retrieving APM for "triggering player"

    @DogmaiSEA: Go

    I didn't say both were playing on the same machine. I'm saying they are on the map, playing the same game against each other. I don't want to write Player B's APM to Player's A bank - I only want to write Player's A info.

    Again - they are on 2 separate computers, playing against each other and I want to keep the data separate.

    Posted in: Triggers
  • 0

    posted a message on 101 Guide to Player Handles

    @DogmaiSEA: Go

    Mind chiming in here then?

    http://www.sc2mapster.com/forums/development/triggers/25773-retrieving-apm-for-triggering-player/#posts

    Could really use some help to make this happen for a project of mine. :)

    Posted in: Triggers
  • 0

    posted a message on 101 Guide to Player Handles

    If I have two humans, Bob and Alice, playing on my custom map - is it now possible to identify Bob as the current player on computer A and Alyce as the player using computer B?

    I'd like to get information about only Bob when Bob is playing on his computer, and the same for Alice. For example, only writing Bob's APM to an APM bankfile on Bob's computer and only writing Alice's APM to a file on her computer.

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