• 0

    posted a message on [Solved] Creating a structure that can be "captured" by moving a certain amount of units near it

    I got the floating text to appear as I wanted to through triggers. It's kind of a messy, impractical solution, but it works. It's a shame, as I wanted to do it with data, but I don't really have time to waste on this part of my project anymore.

    Posted in: Data
  • 0

    posted a message on [Solved] Error regarding saving the target of a load ability in a variable

    I'm trying to make a dialogue window that pops up when a unit is loaded into another unit with specific information about the cargo unit. I'm doing this through a trigger that fires when a unit uses the load command, then sets the loaded unit in a variable and goes through a switch statement with cases for each unit type to decide what to show.

    I'm having trouble getting around a particular bug, though: despite the trigger firing on a "unit uses ability (Load) at the Generic6 - Complete stage" even the game refuses to acknowledge that the loading unit has a cargo unit, and has instead decided to gurgle Array Index Out Of Bounds errors at me. Here's the trigger in question:

        Events
            Unit - Any Unit uses  Load (Command Center) at Generic6 - Complete stage (Ignore shared abilities)
        Local Variables
            p = 0 <Integer>
            cargo unit = No Unit <Unit>
        Conditions
        Actions
            UI - Display "[show window] running..." for (All players) to Subtitle area
            Variable - Set p = ((Owner of (Triggering unit)) - 1)
            Variable - Set cargo unit = (Cargo unit in (Triggering unit) at slot 1)
            General - Switch (Actions) depending on (Unit type of cargo unit)
                Cases
                    General - If (Infantry)
                        Actions
                            UI - Display "[show window] in Infantry switch case..." for (All players) to Subtitle area
            Dialog - Show unitCarriedDialog[p] for (Player group((Owner of (Triggering unit))))
    

    the line that's giving me the problems is

            Variable - Set cargo unit = (Cargo unit in (Triggering unit) at slot 1)
    

    it returns the following error whenever the trigger fires:

    00:00:11.25 Trigger Error in 'gt_changeunitcarriedwindowshow_Func': Parameter out of bounds in 'UnitCargo' (value: 0, min: 0, max: -1)
    

    This error leads me to believe the trigger doesn't believe the unit has cargo at the moment, as the parameter requirements for the UnitCargo call are impossible to satisfy. I don't really know how to get around this! I've tried changing the line to get the unit from a conversion from unit to unit group of from the Triggering Unit's Cargo unit group, which doesn't throw errors but also doesn't work as the found unit only triggers the default switch block. Is there any other way to deal with this?

    Posted in: Triggers
  • 0

    posted a message on [Solved] Creating a structure that can be "captured" by moving a certain amount of units near it

    I'm stuck again! For the visualization effect, I decided the best way to do it would be to use the floating text actor to show counts for how many of each buff type is on the structure. So, if the structure had 3 capture stacks from red team, there's be a floating red "3" to the left of the structure, and if it had 2 capture stacks from blue team, it'd also show a floating blue "2" to the right. I'm pretty shaky doing anything with actors but I think I can do this if I just make enough of them for each case.

    What I'm wondering is whether or not there's a way to reference the number of stacks a buff has in the text field of the floating text actor, which would save me from having to make 2 colored unique floating text actors for each number. If I find out how to do it like this I can probably just have a generic floating text actor for each stack, rather than a mountain of periodic effects applied to the unit checking whether or not it has [x] stacks of a buff and showing the appropriate actor.

    As always, advice is greatly appreciated. At this point my project is mostly done and I'm just doing these cosmetic things, but I do think they matter for the player's comprehension.

    edit: to be clear, I'm thinking of the Starcraft 2 floating text actor text field equivalent of the kind of something like

    Console.WriteLine(redCaptureStack.count() + " : " + blueCaptureStack.count());

    instead of what I have now, which is a bunch of hardcoded things like

    Console.WriteLine("3:2"); Console.WriteLine("4:1"); Console.WriteLine("0:2");

    Posted in: Data
  • 0

    posted a message on [Solved] Creating a structure that can be "captured" by moving a certain amount of units near it

    I've got it mostly working through a combination of trigger, behaviors, orders, and effects now. I have the structure do a periodic search for the capturing unit, which when found is issued an order to use a dummy instant effect ability Capture. When this order reaches the completion stage, it flags a trigger event, which then proceeds to remove the unit and apply a "capture stack" buff corresponding to the owner of the capturing unit. If, after adding the capture stack, 5 stacks of one of the player capture stacks have been applied in total, the structure changes ownership to that player.

    The only thing left to do then is achieve a visualization of this behavior! I'll try doing the sphere model thing you suggested, I guess. Thanks for the help!

    Posted in: Data
  • 0

    posted a message on [Solved] Creating a structure that can be "captured" by moving a certain amount of units near it

    I guess I could do it with triggers. I have avoided resorting to them for most of the other things I wanted to do in Data, so I suppose I could afford one mechanic that doesn't activate very frequently.

    If I do end up doing it with triggers, is there a way to make a struct-like set of variables for each capturable structure? Is this done with records? If it is, will I have to manually make them for every capturable structure on the map?

    As always, the help is very much appreciated.

    Posted in: Data
  • 0

    posted a message on [Solved] Creating a structure that can be "captured" by moving a certain amount of units near it

    @Khalanil1: Go

    Following your suggestion, I'm trying to do this through behaviors and no cargo. I currently have a persistant Buff placed on the structure that searches for nearby capturing units, then removes each found unit and applies a corresponding "capture stack" Buff to the structure. The problem is I don't know how to design it so it keeps track of different players' buffs; that is to say that the structure can tell the distinction between how many capturing units owned by player 1 have been removed and how many from player 2 have been removed.

    I'll probably end up making a visual representation through attaching the capturing unit's actor to a part of the structure, so that the unit appears to be visually "garrisoned" in the structure. I don't know how to do this either but I've found several good examples of attachments that I intend to study further.

    Posted in: Data
  • 0

    posted a message on [Solved] Issuing unit train orders to a structure from another unit

    I was able to have it validate generic queued units by leaving it blank. With that, I'll consider the problem solved, unless I need to optimize it further to speed up the map. Things are pretty smooth right now, though, so I'll leave it at this. Thanks!

    Posted in: Data
  • 0

    posted a message on [Solved] Issuing unit train orders to a structure from another unit

    Thanks to your help, I've got it almost entirely working!

    This is the design I used:

    The Training Structure has a constant Buff behavior called Stop Build Orders, which has a disable Validator that only enables the behavior when there's at least 1 slot free in the cargo. Every 0.05 seconds, this behavior has a periodic effect Search for Hero and Suppress, which searches a range of 500 for units matching the hero's traits and applies the effect Apply Build Order Suppression.

    The Hero Unit receives this effect, which in turn gives it the Buff behavior Can't Issue Build Orders, which has a duration of 0.04 seconds. This behavior's stack count is examined by the requirement Can Issue Build Orders, which checks to see if the stack count is 0. The unit's aforementioned specialize ability now checks this requirement for each train command, and successfully disables commands if it's not met.

    Fantastic! The only real problem left is that I need a much more sophisticated Validator tree to deal with the cases of unit queues, which are: one unit in cargo and one queued, or two units queued. I looked at the Unit Compare Order Count and Unit Order Queue types but they both require a specific unit type for validation, which makes me think I'm going to need to make two Validators for every unit that can be trained to deal with all cases. While I admittedly don't have very many units and this could be done through some braindead copypasting, it'd probably result in a huge Validator tree at the end of the day and I don't want to waste too much processor time on it, especially considering this check is made every 0.05 seconds by at least two structures on the map. Am I worrying too much about the perceived inefficiency here, or should I look into other ways of validating training queues?

    Posted in: Data
  • 0

    posted a message on [Solved] Issuing unit train orders to a structure from another unit

    I guess I should be completely transparent as to the nature of the problem, as I haven't been accurate in describing it.

    Basically, I have a computer-controlled structure that trains units, which are then loaded into its cargo through an Issue Order effect on unit completion. The Train Unit ability for the structure has a Requirement that the unit has no more than 2 units Queued or Better at the unit; thus, it can hold up to 2 units in its cargo, and once this is true the train unit buttons are greyed out until the structure unloads at least 1 of the units. This all works fine, but the problem is with the specialize command.

    The hero unit I was describing has a specialize ability as you described; it has a command for each of the units the structure can train, and the effect associated with each command is a Search Area effect that finds the allied nearest training structure and issues an order to train a unit. This works appropriately as well, but the problem is that the train unit command buttons can still be pressed when the training structure has a full cargo, which, while not training another unit, will still deduct the resources associated with the specialize command from the player. I'd like to make some sort of Requirement for each command that works similarly to the structure's Requirement so that the button is greyed out on the hero unit as well, but I'm not sure how to do this.

    I've thought about creating a buff on each structure that has a periodic Search Area effect that is validated similarly to the Requirement for the structure. The buff would look for the hero unit and applies a brief buff that can be examined through a Requirement, thus allowing the buttons to be greyed out. The problem I see with this approach is that it'd need to search the entire map extremely frequently to create the quickest response for when the hero is allowed to issue another train unit order, and that doesn't strike me as the most efficient way to do things.

    Should I just bite the bullet and try that approach, or is there anything else I can do? What I'd really like to do is just be able to make a Requirement for the specialize commands that checks if the found structure meets its own Requirement, but I don't see a way to do this.

    Posted in: Data
  • 0

    posted a message on [Solved] Issuing unit train orders to a structure from another unit

    Thanks, got it working through your first suggestion, this is much cleaner than doing it through triggers!

    Is there a way to craft a Requirement such that it prevents the hero from using the specialize skill if the player doesn't have enough supply? I realize I can block the actual train command on the structure through a supply check but I'm pretty sure the specialize command will still deduct the mineral cost of training in that case.

    edit: to clarify, the player does not actually own the structure the order is being issued to, nor the unit produced, so the built-in supply check doesn't really apply to the specialize command.

    Posted in: Data
  • 0

    posted a message on [Solved] Issuing unit train orders to a structure from another unit

    Hello again!

    I need to implement a way to order a structure to train a specified type of unit without selecting the structure; ideally, the player never unselects his or her hero unit, and is able to issue the order to train either from the hero's own command card or from a custom-built UI dialogue with buttons and labels.

    I can do the latter through triggers, but I'm more interested in the former approach. I think one way I might be able to do it is to give the hero unit a specific ability for each unit that can be trained, that applies a mapwide search effect for the training structure and then puts an appropriate Issue Order effect on the found structure. Is this an efficient approach, or is there a better way to do this? I haven't actually tried implementing this yet, so I don't even know if it's possible, but I'd be interested in hearing any other ideas how to do this.

    Posted in: Data
  • 0

    posted a message on [Solved] The Lost Viking projectile - modifying SS_Fighter Shooting's target point to be on the same Z axis point as the caster

    Got it working!

    As you mentioned, it turns out the driver I wanted to use was the Throw driver, instead of Generic.

    Inside the mover SS_Fighter Missile, I modified the Driver type for both phases to Throw, and then the Throw Vector to (0, -1, 0). This causes both missiles to behave appropriately, although there is a minor bug where they converge into a single missile as they travel away from the source unit. This can be fixed by making separate movers for the left and right missile with slightly different X values in their throw vector.

    Thanks a ton!

    Posted in: Data
  • 0

    posted a message on [Solved] The Lost Viking projectile - modifying SS_Fighter Shooting's target point to be on the same Z axis point as the caster

    I've tried checking "Ignore Terrain Height" in the mover flag, but it just ends up clipping through the ground while heading to the same destination point. What do you mean by changing the height, though? Do you mean the Periodic Offset coordinates? I guess I could try that, but I think it'll just make them always shoot up. Still, I'll poke around a bit.

    Posted in: Data
  • 0

    posted a message on [Solved] The Lost Viking projectile - modifying SS_Fighter Shooting's target point to be on the same Z axis point as the caster

    Hello again SC2Mapter, it's time for another terrible LaurenI question!

    I'm trying to give a unit a shooting function similar to one in Asteroids, wherein the unit fires a projectile directly in front of it which damages anything it hits. Naturally, this has already been done for me through The Lost Viking's SS_Fighter Shooting ability. Everything's working well except for one big problem: the missiles fired appear to target a point relative to the ground, which causes them to angle upwards or downwards when the firing unit is near a cliff. Here's some visual examples of what I'm talking about:

    What's supposed to happen, and what does happen when the target point is located somewhere on the same cliff height: Everything's A-OK!

    What happens when the target point is located on a different cliff height: Shooting down for some reason!

    Shooting up for likely the same reason!

    I've spent the last day looking at the complicated effect tree for SS_Fighter Shooting and I think the field I need to change is in the "Shooter - SS_Fighter Shooting Straight" Effect. This is an effect of type Create Persistant, which appears to call the two effects to spawn the basic left and right missiles, and assigns them their respective target points relative to the source unit in the Effect: Periodic Offsets field. What confuses me about this is that the Z value of both points ((0.5,-20,0), (-0.5,-20,0)) is 0, which would imply no Z offset from the source unit's Z value, so everything SHOULD work appropriately!

    I know I keep asking from this community and not really giving much back, and as always I really appreciate the help you folks have given me. If you have any suggestions where in the effect tree I should be looking, I'd be most interested in hearing them, but if not I do understand and apologize for not sharing what I've learned over the last few weeks beyond posting what approach I used to solve each problem.

    Posted in: Data
  • 0

    posted a message on [Solved] "train unit" ability that builds units directly into the owner's cargo

    I got the desired effect using Kueken's map as an example. Thanks!

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