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.]
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.
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.
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.