Stumped with spell logic

Dmshu

New Member
Reaction score
9
The original post before I fixed it:
So I have a spell called Battle Orders. It is based off war stomp and does absolutely nothing just to be used for ability level comparison and a trigger event.

When this spell is learned TempGroup is assigned to be matching units in playable map area non hero, non structure, alive. Then given Normal Order, told to cast it, then remove it from them.

When Battle Orders is cast it sets TempGroup again to the same as above. Then there are three if/then/elses if the unit has normal order buff then it gives them offensive order, levels it to the level of battle orders, casts it and removes it. If they have the offensive buff they get a defensive one instead. It they have the defensive one then they get the normal buff. So effectively it cycles between 3 combat styles.

Now here is the problem I'm stumped on:

Only units present when the spell is learned receive the Normal Order spell to use to get the normal buff the whole system revolves around. how do I get the trained units to be updated to the current order and keep it MPI.

I thought about having the trigger check all units alive and decide to give them the current order matching the other units of the same owner, but what if all units are dead and there is nothing to compare to? I think I figured out a way while typing this....When a unit is finished training pick all units matching the same owner and check for all 3 buffs and give it the same one and the final else will default it to normal should cover if all units are dead. Anyone see a problem with that?

Then there is a second problem (now the current problem). When I learn Battle orders all units get the normal buff, but I have to cast the spell exactly three times before the buffs start revolving. :banghead: What's up with that? How can I fix it? They do in fact receive the bonuses from the buffs, and they revolve correctly, but unless I cast it 3 times they don't have a buff icon.

Triggers:
Code:
Battle Orders Learned
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Battle Orders 
    Actions
        Set TempGroup = (Units in (Playable map area) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False)) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit)))))
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Unit - Add Normal Order  to (Picked unit)
                Unit - Set level of Normal Order  for (Picked unit) to (Level of Battle Orders  for (Triggering unit))
                Unit - Order (Picked unit) to Orc Troll Berserker - Berserk
                Unit - Remove Normal Order  from (Picked unit)
        Custom script:   call DestroyGroup (udg_TempGroup)
Code:
Battle Orders
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Battle Orders 
    Actions
        Set TempGroup = (Units in (Playable map area) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False)) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit)))))
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Normal Order ) Equal to True
                    Then - Actions
                        Unit - Add Offensive Order  to (Picked unit)
                        Unit - Set level of Offensive Order  for (Picked unit) to (Level of Battle Orders  for (Triggering unit))
                        Unit - Order (Picked unit) to Orc Troll Berserker - Berserk
                        Unit - Remove Offensive Order  from (Picked unit)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked unit) has buff Offensive Order ) Equal to True
                            Then - Actions
                                Unit - Add Defensive Order  to (Picked unit)
                                Unit - Set level of Defensive Order  for (Picked unit) to (Level of Battle Orders  for (Triggering unit))
                                Unit - Order (Picked unit) to Orc Troll Berserker - Berserk
                                Unit - Remove Defensive Order  from (Picked unit)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) has buff Defensive Order ) Equal to True
                                    Then - Actions
                                        Unit - Add Normal Order  to (Picked unit)
                                        Unit - Set level of Normal Order  for (Picked unit) to (Level of Battle Orders  for (Triggering unit))
                                        Unit - Order (Picked unit) to Orc Troll Berserker - Berserk
                                        Unit - Remove Normal Order  from (Picked unit)
                                    Else - Actions
                                        Do nothing
        Custom script:   call DestroyGroup (udg_TempGroup)
Update: The updating buff trigger is it fool proof?
Code:
Update Trained Units
    Events
        Unit - A unit Finishes training a unit
    Conditions
        And - All (Conditions) are true
            Conditions
                VeterancyArray[(Player number of (Owner of (Trained unit)))] Equal to True
                ((Trained unit) is A Hero) Equal to False
    Actions
        Set TempGroup = (Units in (Playable map area) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A Hero) Equal to False)) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit)))))
        Unit Group - Remove (Trained unit) from TempGroup
        Set TempGroup2 = (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Random unit from TempGroup) has buff Normal Order ) Equal to True
            Then - Actions
                Unit - Add Normal Order  to (Trained unit)
                Unit - Set level of Normal Order  for (Trained unit) to (Level of Battle Orders  for (Random unit from TempGroup2))
                Unit - Order (Trained unit) to Orc Troll Berserker - Berserk
                Unit - Remove Normal Order  from (Trained unit)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Random unit from TempGroup) has buff Offensive Order ) Equal to True
                    Then - Actions
                        Unit - Add Offensive Order  to (Trained unit)
                        Unit - Set level of Offensive Order  for (Trained unit) to (Level of Battle Orders  for (Random unit from TempGroup2))
                        Unit - Order (Trained unit) to Orc Troll Berserker - Berserk
                        Unit - Remove Offensive Order  from (Trained unit)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Random unit from TempGroup) has buff Defensive Order ) Equal to True
                            Then - Actions
                                Unit - Add Defensive Order  to (Trained unit)
                                Unit - Set level of Defensive Order  for (Trained unit) to (Level of Battle Orders  for (Random unit from TempGroup2))
                                Unit - Order (Trained unit) to Orc Troll Berserker - Berserk
                                Unit - Remove Defensive Order  from (Trained unit)
                            Else - Actions
                                Unit - Add Normal Order  to (Trained unit)
                                Unit - Set level of Normal Order  for (Trained unit) to (Level of Battle Orders  for (Trained unit))
                                Unit - Order (Trained unit) to Orc Troll Berserker - Berserk
                                Unit - Remove Normal Order  from (Trained unit)
        Custom script:   call DestroyGroup (udg_TempGroup)
        Custom script:   call DestroyGroup (udg_TempGroup2)
The condition is a boolean array and switches the value from false to true if they pick this hero.
 

Dmshu

New Member
Reaction score
9
try using "unit starts the effect of ability"

hmmm... i read the triggers, maybe the problem is that the skills are all based on the berserk ability.

what is the duration of the buffs?

I am using the starts because it is the most recent trigger, it was initally using start the affect of.

I've based them all off berserk so the most recent cast overrides the old one so they don't have multiple buffs and thus a super trooper :D

The buff duration was shift clicked and set to I think 1000000 or whatever the largest value the normal we can use (I just entered the maximum number of 9s).

So I think I have fixed the updating trained units to the current order, but I still have no clue as to why I have to cast the spell three times before the buffs start showing up, and rotating on the units. (I think they are getting the bonuses from the buffs, but I am about to check that and will update on if they are)
 

Dmshu

New Member
Reaction score
9
maybe the spell conflicts with some of the systems in your map...

that happens to me sometimes...

The verdict is in!

It always takes 3 casts for the units to start showing the buff, but they do in fact receive the appropriate bonuses.

Anyone know how I can fix this although it is only superficial I think it is unprofessional if I just mark it off as unfixable.
 

vypur85

Hibernate
Reaction score
803
Code:
Unit - Remove Offensive Order  from (Picked unit)
What about trying to remove all of these from the trigger and see whether it works or not. This could be the reason, because the unit doesn't have time to cast the spell, and it's removed before casting is successful.
 

Dmshu

New Member
Reaction score
9
Code:
Unit - Remove Offensive Order  from (Picked unit)
What about trying to remove all of these from the trigger and see whether it works or not. This could be the reason, because the unit doesn't have time to cast the spell, and it's removed before casting is successful.

Well I applied a quick fix, on the unit that preloads this heros stuff I put the spells on them and have the dummy cast use them at the very beginning of the game and I'm sure they don't get the buffs icons on them but they cast it once so that it works for all the real units. I don't know why they do it, they do cast it before it gets removed because they would get the buff bonuses, it just wouldn't show that they had the buff on them you know the little icon. All in all I'd say it's fixed even though I don't know why the first cast of each order don't show. Just from the Battle Order's rotation, it would always show when my hero learned the skill and it put normal on them all (always showed even though it was 'technically' the first cast. I would think it's related to the Battle Orders trigger, but just having my preloading dummy have it fixed it which meant it wasn't the problem.

Woah that was a lot wordier than I expected it to be...

Unrelated question that probably should have its own thread but I'm thinking of adding a mercenary hero that uses gold instead of mana for his spells. Where would I change the mana icon to a gold icon for just this single hero, not all mana icons. I haven't really dug into it yet so don't go searching if you don't know it off the top of your head.
 

vypur85

Hibernate
Reaction score
803
>would get the buff bonuses, it just wouldn't show that they had the buff

Buildings do not show buff icon at status bar readily. You'd need to enable it first. This can be found in Gameplay Constant (go to 'Advance' tab --> select 'Gameplay Constant'). Not sure if this is the problem though.


> Where would I change the mana icon to a gold icon for just this single hero, not all mana icons.

As far as I know, I don't think it's possible. :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top