Unit Battalions

S

Skitz_24

Guest
Well I have somewhat created a Hero Squad.

What you have is a hero, and you can add or remove units from their squad, and when any of the units in the squad move, all the others follow...somewhat.

My problem right now is that not all of the units move with the squad all the time. I can't post the triggers right now because I am at school so you will have to wait maybe 2 hours for me to get home :p

Anyway it wasn't that hard to do, so I will work on making the battalions next.

If everything gets done well I will work on making a System for the Repository so taht people can make use of this :p
 

San-D

New Member
Reaction score
15
Id like to see that system of urs, Ive been wandering about this for the last few days, using GUI I did lots of "interesting" stuff, while trying to create it, including crashing the game
 
S

Skitz_24

Guest
Sorry I have been busy for the past couple of days...

I will post my current codes when I get the chance, I got to go to bed right now XD

Anyway I almost have the thing figured out, my only problem is that is doesn't work properly or it crashes the game :p

Let us hope someone can help fix it XD
 
S

Skitz_24

Guest
Okay, I finally got some time to myself, so I am posting the codes for what I have so far [yes I know this is really over due :p]

Please note I am just experimenting so places where I should have variables...probably don't have variables :p

Now...CODES AWAY!!!!

Code:
Unit Groups
    Events
        Map initialization
    Conditions
    Actions
        Unit Group - Add Commander 0000 <gen> to Unit_Group
        Set UnitsInGroup = (Number of units in Unit_Group)
This is the setup for the unit groups, on a multiplayer map it'll obviously be bigger, but this is all that is needed for now.

Code:
Attatch to Squad
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Attatch to Squad 
    Actions
        Set Cast_Point = (Position of (Triggering unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Target unit of ability being cast) Equal to (Random unit from Unit_Group)
                UnitsInGroup Less than 3
            Then - Actions
                Unit Group - Add (Triggering unit) to Unit_Group
                Set UnitsInGroup = (Number of units in Unit_Group)
            Else - Actions
                Floating Text - Create floating text that reads Unit Squad is full at Cast_Point with Z offset 10.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        Custom script:   call RemoveLocation(udg_Cast_Point)
This trigger makes it so units can attach to my heros squadron. This trigger works fine [I think :p]

Code:
Move
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        ((Ordered unit) is in Unit_Group) Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Equal to (Order(move))
                (Issued order) Equal to (Order(smart))
    Actions
        Unit Group - Pick every unit in Unit_Group and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Picked unit) Not equal to (Ordered unit)
                    Then - Actions
                        Set Moving_Unit = (Picked unit)
                        Trigger - Turn off (This trigger)
                        Unit - Order Moving_Unit to Move To (Target point of issued order)
                        Trigger - Turn on (This trigger)
                    Else - Actions
This is my problem trigger. What it does is one of 2 things:
1. Crash the game T__T
2. Not all units in the squadron move
Now I do not know what my problem is so help would be appreciated

There is my sneak peek at what I have been doing XD

Battalions begin after Squadrons r done :p
 

WolSHaman

knowledgeably ignorant
Reaction score
51
It crashes the map because it creates an infinite loop, because each time a unit in the squad is ordered to move, then the other squad members are ordered to move, so then the first unit is ordered to move, ordering the other members and so on.
 

WolSHaman

knowledgeably ignorant
Reaction score
51
Well, if you want only the hero to be able to order his units to move, then you'd add a condition checking if the ordering unit was a hero. But I'd do the squad system in an entirely different way, using custom values, but that's just me.
 

Ghostwind

o________o
Reaction score
172
Like in Rise of Nations I guess. Well maybe make two locust units that follow the main unit around and make it so when the main unit gets to 66% HP one of them dies, at 33% the other one dies, and then at 0% the main unit dies (of course)
 
S

Skitz_24

Guest
Ya I was considering using Custom Values.

But no I am making nit so that if any unit in the squadron moves, the whole squadron moves with them.
 

Samael88

Evil always finds a way
Reaction score
181
I think you can do it by using custom values.
We can take footman as an example.
You could take one unit with the model of a "circle of power" or something.
That will be the only unit in the squad that is selectable, the others does not need to be.
That selectionunit is the only one wich need to hade customvalue, the other ones can be in a unitgroup and copy its movement.
Then you do like this:
Selectionunit moves
The others attack move to specified locations, like the way San-D wrote.
Set Point[1] = (Position of (Casting unit))
Set Point[2] = (Point[1] offset by (200.00, 0.00))
Set Point[3] = (Point[1] offset by (-200.00, 0.00))
Set Point[4] = (Point[1] offset by (0.00, 200.00))
Set Point[5] = (Point[1] offset by (0.00, -200.00))
Set Point[6] = (Point[1] offset by (200.00, -200.00))
Set Point[7] = (Point[1] offset by (-200.00, -200.00))
Set Point[8] = (Point[1] offset by (200.00, 200.00))
Set Point[9] = (Point[1] offset by (-200.00, 200.00))
Set Place = (Place + 1)

The locations will of course have to be calculated, but i think each unit has a special formation value that you can change. I can't remember the name of it, but it decides the distance between the units in the standard formation.
You know, when you select more than one and move them.
However, that value can be used.

And let's say that you want 20 units in the foramtion, then you can like have 20 life for the selectionunit and make it lose 1hp for each unit in the group that dies.

All you need to do this is atleast to variables, one for each formation, a unit array, and one for the array for the groups.

And also, if you want to have spells on the units like defend for example, then all you need is a dummy spell for the selectionunit, and maybe you can make it easier with some kind of library trigger that uses array spell variables or something like that.

Just a thought that hit me when I read thru this. hope it helps:D
 
S

Skitz_24

Guest
Thanks for the suggestion.

I think I should point out with that my current system I am trying to make it so you can select ANY unit in the squad and give it commands that effect the rest of the squad, this is because each attachable unit has its own special abilities and what not.
 

Samael88

Evil always finds a way
Reaction score
181
Thanks for the suggestion.

I think I should point out with that my current system I am trying to make it so you can select ANY unit in the squad and give it commands that effect the rest of the squad, this is because each attachable unit has its own special abilities and what not.

That is actually not that much of a problem this way either.
You can add abilities to the selection unit when a new unit comes along
and remove when one goes away.
If you want it to be many abilities you can use spellbooks.:thup:
 
S

Skitz_24

Guest
Okay, I have been messing with my triggers all week, and I have made it so that it doesn't crash the game, however it doesn't work properly either.

My current Coding for movement is:
Code:
Move
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Equal to (Order(move))
                (Issued order) Equal to (Order(smart))
    Actions
        Unit Group - Pick every unit in Unit_Group and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Ordered unit) is in Unit_Group) Equal to True
                        Or - Any (Conditions) are true
                            Conditions
                                (Issued order) Equal to (Order(move))
                                (Issued order) Equal to (Order(smart))
                        (Picked unit) Not equal to (Ordered unit)
                    Then - Actions
                        Set Moving_Unit = (Picked unit)
                        Trigger - Turn off (This trigger)
                        Unit - Order Moving_Unit to Move To (Target point of issued order)
                        Trigger - Turn on (This trigger)
                    Else - Actions

This is what happens...

I have a Paladin as the original Squad unit, the squad 'hero' I guess. The following is what happens:

1. Attach a footman
2. Attach Rifleman
3. Move Paladin: Footman follows, Rifleman doesn't move
4. Move Footman: Paladin follows, Rifleman doesn't move
5. Move Rifleman: Paladin follows, Footman doesn't move

Anyone know what my problem is?
 
S

Skitz_24

Guest
Yes and I need to get this puzzle figured out to finish the map I am working on =\
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,712
Not to be saying much in any way, but you could add that as a key puzzle to your map, or an easter egg, and let other players try to solve that puzzle out for you in-game.

It's fun and cool, if there's a timer and some actions that endangers the trio.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,712
Oh well. Try using "Display All Players the text:" action for each of the units, as to debug the actions in the if/then/else action. If one or two shows up, then try re-tracing by asking yourself "Where did that come from?".

Who knows, the answer might be either be unnoticable, or amusingly funny!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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