• 0

    posted a message on [Solved] Using action functions or triggers for initialization actions?

    Actions are slimmer, I suppose, since an action is simply a function and a trigger is, I believe, 2 functions and a trigger object. I'm not sure the difference is quantifiable though.. haven't come across any benchmarking for sc2 stuff.

    I guess my only advantage to using a trigger over an action here is that it doesn't add even more items to the already very lengthy action list.

    If you're really concerned with performance, you should keep it all in a single map trigger (or better yet, write directly in galaxy using native functions).

    I would prefer triggers in this case but I can understand the argument for actions trying to be a compromise between performance and organization. I'll just say, until I can see benchmarking on it, the difference is likely a fraction of a millisecond on something that's only called once so how much does it really matter. :)

    Do what looks best and makes sense to you.

    Posted in: Triggers
  • 0

    posted a message on How can I Level my Hero Through Triggers?
    Quote from abvdzh: Go

    For custom exp bar you will need to screw the data completely, as SoulTaker said, cuz there is no function to easily track % of xp needed to proceed on the next level.

    Who needs it to be easy? It's certainly possible.

    I've attached a working example of a custom xp bar using dialog items which tracks based on veterancy. Note: I didn't make the original map, this was grabbed from another forum post. I forget who did it. I just redid how the xp calculations are done so that it uses veterancy rather than a custom trigger-based xp system.

    It's actually not too complex. I used a lot of variables to help anyone looking at it to follow along, but it can certainly be simplified and streamlined. This is just for demonstration purposes.

    The thick of it is thus:

    On Gain XP
        Events
            Unit - Any Unit gains experience
        Local Variables
            player = 0 <Integer>
            xp = 0.0 <Real>
            prev_xp = 0.0 <Real>
            needed_xp = 0.0 <Real>
            xp_into_level = 0.0 <Real>
            xp_for_level = 0.0 <Real>
            remaining_xp = 0.0 <Real>
            percent = 1.0 <Real>
            level = 0 <Integer>
        Conditions
        Actions
            Variable - Set player = (Owner of (Triggering unit))
            Variable - Set level = (Experience level of (Triggering unit))
            Variable - Set xp = (Total experience of (Triggering unit))
            Variable - Set prev_xp = 0.0
            Variable - Set needed_xp = 0.0
            General - Pick each integer from 0 to level, and do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Picked integer) < MAX_LEVEL
                        Then
                            Variable - Set needed_xp = (needed_xp + (Real((Value of Behaviors GainExperience VeterancyLevelArray[(Picked integer)].MinVeterancyXP for player player as an integer))))
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Picked integer) == (level - 1)
                                Then
                                    Variable - Set prev_xp = needed_xp
                                Else
                        Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    prev_xp < needed_xp
                Then
                    Variable - Set xp_into_level = (xp - prev_xp)
                    Variable - Set xp_for_level = (needed_xp - prev_xp)
                    Variable - Set percent = (xp_into_level / xp_for_level)
                Else
            General - Custom Script: UIDisplayMessage(PlayerGroupAll(), c_messageA...
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    percent == 0.0
                Then
                    Dialog - Hide Experience Bar for (Player group(player))
                Else
                    Dialog - Set Experience Bar size to ((Integer((XP_BAR_WIDTH * percent))), 50) for (Player group(player))
                    Dialog - Show Experience Bar for (Player group(player))
            Dialog - Set Experience Bar tooltip to (Text(((String(xp) with 0 decimal places) + ("/" + (String(needed_xp) with 0 decimal places))))) for (Player group(player))
    
    Posted in: Triggers
  • 0

    posted a message on [Solved] Using action functions or triggers for initialization actions?

    @Truun: Go

    I would only create actions for things that need to be run multiple times and have different parameter sets (or need to return a value but that's not important in this context).
    For example, I might create an action that respawns a hero.. complete with fancy graphics and sounds and camera movement. Heroes die a lot.. this would be ran multiple times. And the parameter of the action would be which hero needs to be respawned... or possibly the player who's hero needs respawning depending on how I set it up.

    I think triggers are better suited to the task here. Triggers may or may not run multiple times, but the defining difference is they have no parameters (and they take events but that's not important in this context either). I would create an Init folder and put an Init trigger as the first item then a trigger for each block - one for the dialog setup, one for bridges, one for AI, etc.
    Your Init trigger would have the Event: Map Initialization. And all it would do is call Run Trigger on the rest of the triggers.. in the appropriate order that they should be called in.
    Your other triggers in the Init folder would have no event and rely on the Init trigger to run them.
    If you have a trigger that doesn't depend on anything from any other trigger.. ie, it doesn't matter if the ai is setup before or after the bridges.. then you can say "Don't Wait" when you use the Run Trigger action.

    Posted in: Triggers
  • 0

    posted a message on Assigning Random Points

    @fishy77: Go

    These sound like design questions...

    if anyone is marked as a spectator (more info on this below) - pick a random area, assign the spectator and a random player to the area

    if there are at least two players that haven't been placed yet
    - pick a random area, pick 2 random players - this ensures everyone is facing off against someone

    if there's only 1 player that hasn't been placed yet
    - use a variable or player group or something to mark the player as a spectator for the round

    if you want to actively prevent facing the same opponent twice, you'd have to track who's faced who and when picking the second random player pick from those that he hasn't faced yet.

    Posted in: Triggers
  • 0

    posted a message on How can I Level my Hero Through Triggers?

    I found an example of this online but it was really bad using variables to track xp on a unit that was using veterency and the unit's xp bar and the custom one didn't match. Working on fixing it but only have a few minutes.

    In the meantime, xp is apparently a real. So if you create a real variable then assign it to the experience level of triggering unit, that's your unit's level. Assign it to total experience of triggering unit, that's their current xp. Haven't figured out how to get how much xp is needed for their level yet.

    Posted in: Triggers
  • 0

    posted a message on Cost Shield OR Life?

    Just a thought.. to make it look nice, could go to the button flags and remove the show cost flags and then make them part of the description. Would look reasonable so long as there's nothing between where the cost usually displays and where the description is. Could even make a custom icon or color-coded text.

    <d ref="Cost" /> Shield or Life
    
    Description...
    
    Posted in: Data
  • 0

    posted a message on How can I Level my Hero Through Triggers?

    I believe he said he has the leveling part working using veterancy. He's trying to create an experience bar to show on the screen.

    Obviously this would require a dialog with some items to represent the current/needed xp, the bar, whatever else the OP wants as per his visual requirements. But I believe the remaining question is how to determine the current/needed xp and the level number.

    Posted in: Triggers
  • 0

    posted a message on How can I Level my Hero Through Triggers?

    @ZionSC2: Go

    There's a Unit Gains Experience event. I was looking through actions, but I couldn't figure out how to determine the current xp / xp needed to level / current level. But if you use that event, then check which unit, that's a start.

    Sorry I can't be more help on my way to bed have work tomorrow but I can try to look into it more later if nobody else has a more complete answer for you before then. :)

    Posted in: Triggers
  • 0

    posted a message on How can I Level my Hero Through Triggers?

    @ZionSC2: Go

    I haven't done it myself but I believe that's typically done through veterancy. https://www.google.com/search?q=sc2+editor+how+to+level+heroes&oq=sc2+editor+how+to+level+heroes&aqs=chrome..69i57j0l2j69i64l2.11829j0j7&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8#es_sm=122&espv=210&q=sc2+editor+how+to+level+heroes+veterancy

    To make the bar, you'll need to make a dialog and do all the visuals yourself using images and labels and whatever you want. Then monitor a hero's veterancy stats and update your xp bar however you wish.

    Posted in: Triggers
  • 0

    posted a message on change pitch of sounds running in loops

    @DemoniacMilk: Go

    I'm having a similar issue trying to use the catalog triggers to adjust a model scale and an SOp local offset.. which are also a comma-separated values (2.0000000,2.00000000,2.00000). As far as I can tell, the game doesn't yet support editing any fields that are in this format. It's very frustrating. :(

    Posted in: Triggers
  • 0

    posted a message on Piercing Line AOE - Need Help With Splat and Visuals/Audio

    @DrSuperEvil: Go I really appreciate your help, I'm just having a hell of a hard time figuring it all out... been staring at this stuff for hours and not getting anywhere.

    Goal

    To provide the big picture... The concept is that heroes have different stats and they can spend xp to upgrade them.. ideally to an unlimited degree, but there's practical limitations since the game only lasts 20 minutes. Spending XP on their power stat will increase damage (that part is super easy).. I was hoping that spending XP on their mastery stat could increase range for some abilities, like this one.

    By defining all 32 period offsets in the persistent and then setting the period count to 10, I'm able to then use catalog triggers to increase the period count up to 32 in order to change the range from 10 to 32... not unlimited, but good enough for practical reasons.

    So that just leaves getting the visuals working...

    Splat Guide

    If the splat can't grow, that's not the end of the world I can have a tiny splat for all line attacks just to show the initial direction and people will just know that it goes from there to where the cursor is at (or further).. but it would be really nice if it could grow.

    I looked at the dark protoss upgrade stuff. There seems to be a lot of pieces here... multiple validators, multiple events with terms. I'm not sure what I need and don't need. I tried very simply to say on Zergling - Metabolic Boost Added, Set Scale 2.000000... it had no effect. I also noticed that when I change the scale of the actor, it has no effect. I think I have to change the scale of the model? Or I'm not understanding something.

    I'm also wondering, if the range can grow from 10 to 32, one yard at a time, do I have to create 23 versions of this stuff, one for each upgrade?

    This seemed so easy conceptually.. if only Blizz had enabled the ability to modify model scales through the catalog triggers.

    Projectile Beam

    The beam model that fires out also isn't growing because I'm also unable to modify the Local Offset for the SOp. I assume this might be done similarly to above but I didn't see a Set Offset or Set Local Offset action.

    Blood Splatter on Targets

    I found the colossus tree killer but I can't figure out how it works. I'm not understanding the query region and how that ties into something else (I assume?) to create the effect.

    Original Raynor's snipe set a 0.125 duration buff which, once expired, had a blood splatter event to trigger it. That much I could understand, but it uses a global::Raynor reference for the vector which, I assume, is why it's not working for me and I assume why you're recommending this alternate approach.. but yeah, I'm not understanding the query region stuff.

    Current State

    I stripped out everything I have for the piercing round ability thus far and put it in its own map to reduce file size and load times. Maybe you or someone could take a look?

    I have the default sniper on there for comparison, and I've noticed that when the default sniper fires his shot the splat guide disappears as soon as the weapon starts to charge... sometimes mine disappears right away, sometimes it stays visible for a bit. I can't figure out why that is. I tried adding an event to destroy it immediately when cast starts and I tried when cast finishes but it doesn't seem to have any effect.

    Posted in: Data
  • 0

    posted a message on Piercing Line AOE - Need Help With Splat and Visuals/Audio

    I didn't really understand how to do the SOp* stuff, but I googled your terms and found this thread and I got the arc actor working with a few tweaks.. sort of:
    http://www.sc2mapster.com/forums/general/general-chat/40857-1-5demo-lets-just-attach-raynors-big-railgun-on-everything/

    I have the guide defined as such:
    Type: CActorArc
    Parent: GuideVisualArc
    Events:
    - Abil.PiercingRound.Guide
    - - Create
    - ActorCreation
    - - Create GuideRegionArc
    - ActorDestruction
    - - Destroy Immediate
    - ActorOrphan
    - - Destroy Immediate

    Just having one issue.. after I cast, sometimes the line disappears right away and sometimes it sticks around for a second or two... seems to be a timing issue. If I target and then cast right away, it stays around. If I wait almost as long as it stays around and cast, it disappears right away. Wait a little longer, it stays for a bit.

    I tried adding this event:

    - Abil.PiercingRound.SourceCastStart
    - - Destroy Immediate

    But it doesn't seem to have any effect. Ideally it'd be awesome if it stayed until the ability finished casting and Raynor starts to stand, but I'd be happy with making it disappear right away as well.

    I also have another question... is there any way to dynamically change the size of the beam? I made a separate model just for it and I can change it's scale min/max but for my game the hero will be able to increase the range of the ability by purchasing stat upgrades. So it might start at a range of 10 yards but be able to upgrade all the way to 32, 1 yard at a time (32 is the max number of period offsets in the persistent effect otherwise I could go further). I have the cast range and persistent and everything else working by using the Set Catalog Field Value trigger actions.. the only part not working is the splat's visual. I get an error when I try to change the model's scale - "Catalog field 'ScaleMin' could not be written (Core: access designed to require object or service)" - I can change the actor's scale without causing an error; however, it doesn't actually change the size of it.

    Getting close. I'll post a vid when I'm done. Just need to get the sound and blood splatter. And a projectile actor. :)

    Posted in: Data
  • 0

    posted a message on Piercing Line AOE - Need Help With Splat and Visuals/Audio

    @TheSC2Maniac: Go Oh I didn't notice the stand work animations, thanks! I got that working it looks much better now. :)

    @DrSuperEvil: Go Global, huh? That might explain why when I assigned the original ability to my new unit, the splat still came from the original raynor not my new one that was casting it.

    Thanks for the responses, trying to figure everything out. :)

    Posted in: Data
  • 0

    posted a message on Piercing Line AOE - Need Help With Splat and Visuals/Audio

    I'm using the Raynor Lab (MarineRaynorEx1) model for a hero and trying to create an ability similar to Raynor Commando (MarineRaynorHEV) Snipe where it shows a line on your cursor for the direction of the projectile and then launches a projectile in a straight line. In addition, I'd like for the range of the ability to be upgradeable from a range of 1 to 32, in 1 yard increments.

    I was looking at the snipe ability to see how it worked and I got the damage component all working using a search area and a buff marker but there's no visual. Raynor just stands there with his gun pointed at the air in his default standing pose as things go dying before him.

    And when I'm targeting, I can't get the splat to show up. I created the splat just like the other one using the laser pointer model, but I don't see how I connect the splat with the targeting of the ability. The tooltip on the ability just said to use a search area effect and splat but not how to relate them.

    I know this model doesn't have a nice aiming animation like the commando one but I'd like at least for him to point his gun, maybe using the attack animation, and then to have a projectile come out, ideally from the barrel or near it, and shoot across the screen for the desired range (currently 10). Not sure what model to use for the projectile but preferably something that'd move really quick but still be visible.. the one the commando uses is barely visible. I'd also like for a little blood splatter to appear on each target's chest.. I've seen there's a way to make a model appear on the target and I've seen the blood splatter model but haven't figured out how to make it happen.

    Audio would be nice too. Something for the projectile leaving the barrel. Sounds like there's already sound when each enemy is hit.

    Thanks a ton for any help! I've followed ability tutorials before but they seem to focus more on the effects less on the visuals. Hopefully if I can get this all working I can figure out the other abilities for myself. :)

    [Update] Can read my latest post for details, but I've got the basics of the ability working now and the damage and range are upgrading how I want, but I still can't figure out how to adjust the visual parts for the range upgrade (making the splat reach further and the projectile shoot further).

    Posted in: Data
  • 0

    posted a message on Custom CommandTooltip - How to Modify Resource/Vital Cost To Text (No Icons)?
    Quote from GlornII: Go

    Another thought; in the UI editor; couldnt you use a picture of your font style in whatever color, and replace the icon with the picture of text; then just move the "icon" in the UI editor to the other side of the cost value?

    That's a thought. It wouldn't color the number but could still look good. :)

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