Change Movement Type

makakai

New Member
Reaction score
1
Hopefully this is simple but I just need it so certain units can't travel over water during day but can at night.

Tried changing movement type from foot to fly but cant via triggers I don't think plus they would then fly over barricades meant to stop them. :D

(The main thing i want is a way to make it so units can only get to the other units by night)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
this can be done rather easy if your units are NO heroes. if they are it will be alot more complicated.

here is how to do it with non-hero units:
create 2 versions of your units, the first version for day with "foot" as movement type, the second version for night with "amphibious" as movement type.
now go to the ability editor and copy the ability "Chaos" (its an ability of the human and orc race, its purpose is to morph one unit type into an other, like in the orc campaign with the fel orcs)
create 2 copys of the chaos ability, one which will turn the first unit type into the second and vice versa for the other.
add these chaos abilities to the proper versions of your units.

now create 2 dummy units, call one of them "Day" and the other "Night" (or whatever you want). Dont give these dummys any model nor attack nor anything.
Go back to the ability editor and select your custom chaos abilities.
Set the requirements for the chaos ability which morphs the "foot" version to the "amphibious" version to "Day" (our new dummy unit), same goes for the other chaos ability, just set the requirement to "Night".

now you will need 3 triggers:
Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Night for (Picked player) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
          • Set DayNightIndicator[(Player number of (Picked player))] = (Last created unit)

this trigger will run at map initialization and create a "Night" dummy for every player. by default the game time at start is 0.00 therefor its night but you can change it if you like.
Trigger:
  • EnableDay
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Replace DayNightIndicator[(Player number of (Picked player))] with a Day using The old unit's relative life and mana
          • Set DayNightIndicator[(Player number of (Picked player))] = (Last replaced unit)

Trigger:
  • EnableNight
    • Events
      • Game - The in-game time of day becomes Greater than or equal to 18.00
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Replace DayNightIndicator[(Player number of (Picked player))] with a Night using The old unit's relative life and mana
          • Set DayNightIndicator[(Player number of (Picked player))] = (Last replaced unit)

this 2 are needed to change the dummy unit propriate to the game time. currently it works for all players but you can change it if you like.

i attach a demo map if you didnt understand all of this.
 

Attachments

  • [Z]UnitMorphOnDayTime.w3x
    14.8 KB · Views: 92

makakai

New Member
Reaction score
1
Thanks heaps did it a bit different tho because i needed each unit produced to be like that but wouldn't have done it without ya :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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