Snippet My Aircraft System

Accname

2D-Graphics enthusiast
Reaction score
1,463
[Progress: Currently working on an upgrade]

As the title says this really small snippet is about making air units which somewhat look much more realistic then the normal ones. Instead of a snippet i think you could rather call it a turtorial because it only consists of a single primary trigger, a conditional trigger for some animations and some fields which got to be set in the object editor.

what does this snippet offer?
-realistic aircraft movement
-aircrafts which attack while moving
-aircrafts which can take off and alight

What do i need?
-There is 1 (more or less) GUI trigger which will move all air units
-There is 1 GUI trigger which is responsible for the animations of alight air units
-there are few configurations of your units in the object editor which need to be done

Are you serious this is a useful snippet?
I myself use this for all of my modern warfare maps and i like it very much, it makes big fun to see the units fly in circles shooting at the enemys with machine guns or rockets.
I also think it is useful because it will make your map special and fun to play though it might make balancing more harder

How is this working and what do the object editor data mean?
-The aircrafts got 2 different versions. 1 at the ground and 1 in the air though both are flying units. Using a morph spell (like metamorphosis in the demo) you switch between both versions.
-the primary trigger picks all units of the actual flying type and moves them a bit forward similar to a sliding trigger.
-The important difference is that this trigger is not moving the unit but setting its position to other coordinates. thats why the orderstring is not refused aborted and the unit is able to change directions/ attack enemys and stuff like this.
-to create the nice smooth effect of flying circles curves the units orientation interpolation value got to be set to a high number ( 8 in the demo map)
-Setting the altitude adjustment and landing delay as well as the duration normal of the metamorphosis spell will create the nice animation of a starting/landing plane.
-the duration hero of the metamorphosis spell can be used to simulate fuel of the aircraft.
-with a little additional triggering you can create airports or units which can refill the fuel of your aircrafts. (removing and re-adding the ability to reset ability cooldown) (this is not featured in the demo map, I might add it on request.)

Sounds good, what do i have to do?
-If you got your air unit already its recommended to change its movement speed in the object editor to a small value (like in the demo map where it is 1.00) the units will be moved by the trigger.
-set the orientation interpolation of your air unit to a high value (8 is a good value here)
-copy your unit to have the alight form and change its movement type/speed/turnrate to 0/none as well as the attacks to none and the other data as you like
-copy the metamorphosis ability and change the alternate form unit to your initial air unit and the normal form to the copy (alight) form. you can set the landing delay/altitude adjustment/duration normal/duration hero as you like but it looks quite nice with the settings of the demo map.
-give your custom ability to both versions of your air unit
-copy the triggers below into your map and change them as following:

[Uses 2 variables. TempPoint[] which is a point variable with array and TempGroup[] which is a unitgroup variable with array.]
Code:
Flying
    Events
        Time - Every [COLOR="Green"]0.03[/COLOR] seconds of game time [COLOR="Green"]You can change this data to a bigger value but its recommended to keep it below 0.05 because it wont look that nice anymore.[/COLOR]
    Conditions
    Actions
        Set TempGroup[0] = (Units of type [COLOR="Red"]Aircraft[/COLOR]) [COLOR="Red"]Change this data to your initial air unit (NOT the copy)[/COLOR]
        Unit Group - Pick every unit in TempGroup[0] and do (Actions)
            Loop - Actions
                [COLOR="Green"]Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed[/COLOR] [COLOR="Green"]This is conditional and only needed if you use the second trigger for the animation[/COLOR]
                Set TempPoint[0] = (Position of (Picked unit))
                Set TempPoint[1] = (TempPoint[0] offset by [COLOR="Red"]6.00[/COLOR] towards (Facing of (Picked unit)) degrees) [COLOR="Red"]This is the movement speed of your air unit. increase the data to make them fly faster.[/COLOR]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        [COLOR="Blue"]((Playable map area) contains TempPoint[1]) Equal to True[/COLOR] [COLOR="Blue"]This is a vital part of the trigger, if it is removed the aircrafts can move outside the map which causes an instant crash![/COLOR]
                    Then - Actions
                        Custom script: call SetUnitX( GetEnumUnit(), GetLocationX(udg_TempPoint[1]))
                        Custom script: call SetUnitY( GetEnumUnit(), GetLocationY(udg_TempPoint[1]))
                    Else - Actions
                        [COLOR="Green"]Set TempPoint[2] = (TempPoint[0] offset by -256.00 towards (Facing of (Picked unit)) degrees)
                        Unit - Order (Picked unit) to Move To TempPoint[2]
                        Custom script: call RemoveLocation (udg_TempPoint[2])[/COLOR] [COLOR="Green"]This orders your aircrafts to circle around the sky if they hit the edge of the map, can be changed or deleted.[/COLOR]
                Custom script: call RemoveLocation (udg_TempPoint[0])
                Custom script: call RemoveLocation (udg_TempPoint[1])
        Custom script: call DestroyGroup (udg_TempGroup[0])

And this simple trigger is setting the animation speed of your alight aircrafts to 0.00%. its only for animations and can be deleted if not needed.
Code:
Landing
    Events
        Time - Every 0.25 seconds of game time
    Conditions
    Actions
        Set TempGroup[1] = (Units of type [COLOR="Red"]Aircraft (Land)[/COLOR]) [COLOR="Red"](Set this value to the unittype of your alight aircraft)[/COLOR]
        Unit Group - Pick every unit in TempGroup[1] and do (Actions)
            Loop - Actions
                Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
        Custom script: call DestroyGroup (udg_TempGroup[1])

thats it. i hope its not too little to be submitted because i like it very much.

of course this snippet is MUI MPI and leakless.
Have fun. Accname.
 

Jesus4Lyf

Good Idea™
Reaction score
397
>of course this snippet is MUI MPI and leakless.
Well actually this system leaks a couple of hundred handles per second.

I needed this system so badly 6 years ago, can you go back in time and email it to me?

We were gonna make a Battlefield 1942 map. o.o
Me and... DMC something... Gosh it's been a while.

I like your colour coding, but someone will probably tell you to use WC3 tags.

How about using phoenix fire ability to do the attacks instead of normal WC3 attack? ;)
 

UndeadDragon

Super Moderator
Reaction score
447
It laggs really bad for me.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
i am sorry but there's no lagg for me.

Well it's coded badly, so no surprises there.

It should have a global unit group that it adds and removes units when they cast the metamorphisis thing, and it should run on 0.03125 of a second instead of 0.01. :)

of course you can do it that way but this would need some more triggers. (add units at map init / add new created units / etc)
this is more like a turtorial instead of a snippet, its not the way you have to do it but its more like pushing you in the right direction. the important part of this post is anyway the object editors data as well as using the SetXofUnit instead of moving the unit.

and i said already you can change the time of the event to a higher number, as long as it doesnt exeed 0.1
 

Romek

Super Moderator
Reaction score
964
That lime-green colour is horrible.
I changed every 'Lime' to 'Green' for you. My eyes were burning. ._.

The default values shouldn't be too extreme, and should generally be 'ideal' values.
0.01 seconds doesn't fit there. :p

Why is TempGroup an array? o_O
 

Jesus4Lyf

Good Idea™
Reaction score
397
i am sorry but there's no lagg for me.
I don't think that's relevant.
0.01 seconds doesn't fit there.
I think that is.

>you can change the time
Of course we know that. But let's not encourage newbies to leave something like this leaking 200 handles a second, huh? What's the point of a Warcraft III map that lags in an unplayable way on half the computers playing it?

>How about using phoenix fire ability to do the attacks instead of normal WC3 attack?
If this is meant to be a tutorial of some sort, this is worth touching on. It allows units to "attack" drive-by style. Just a thought, though.

>Why is TempGroup an array? o_O
He should be recycling a global group. And moving one location instead of spamming them. That would stop so much leakage...
 

SerraAvenger

Cuz I can
Reaction score
234
phoenixfire is not what you want. It attacks any target within range that is visible to you, whether you face it or not, and cannot be dodged (100% hit chance).
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
i ll upgrade this system as fast as possible but i am not at home over the weekend and on monday i am working till 19pm so it might take awhile.
the next version will include variations on how to make the aircrafts as well as some bonus add-ins like ammo/helipads/different movement speed for different unit-types/etc

as for the phoenix fire ability:
using the phoenix fire ability will mess up the nice movement. if the unit is using the normal attack it will circle around the air and attack its target, if using phoenix fire it will just attack random targets passing by what its not supposed to do.
 
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