• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Units movement

Status
Not open for further replies.
Level 6
Joined
Jun 4, 2017
Messages
172
I'm making a siege map where enemies attacks with a lot of soldiers. After some waves I want to make that the computer attacks with rams too. My problem is that I want rams to push units in their way and go straight ahead, not to rotate if there is some unit in front of them who blocks their way. Is it possible to make it without some type of knockback ability?
 
ghost skills allows others to walk through yourself;
to beeing able to walk through others you need some windwalk trick or disable pathing for the ram ( both have drawbacks)
or make the ram an flying unit and constantly set fyling height to 0.
(this one i just got, would break pathfinding for that unit, if this is for auto spawning wave units with predefined attackroutes might be a solution).
Then to disable others from standing insde you periodicly teleport anyone who is standing inside the ram outside, if you want that.
 
Last edited:
Level 6
Joined
Jun 4, 2017
Messages
172
Disable pathing could be a good solution but then all units go inside the ram.
Then to disable others from standing insde you periodicly teleport anyone who is standing inside the ram outside, if you want that.
I prefer don't make any periodic event because I think it could start lagging because there are already so many units, make some fast loop is going to start lagging probably, that's why I don't want some type of knockback ability, because it would require loop too.
 
ghost skills allows others to walk through yourself;
to beeing able to walk through others you need some windwalk trick or disable pathing for the ram ( both have drawbacks)
or make the ram an flying unit and constantly set fyling height to 0.
(this one i just got, would break pathfinding for that unit, if this is for auto spawning wave units with predefined attackroutes might be a solution).
Then to disable others from standing insde you periodicly teleport anyone who is standing inside the ram outside, if you want that.

@RG00

That would make the most logical solution to your problem.

By constantly resetting the height of the unit back to 0, you prevent (as much as possible) players from noticing that the unit is actually flying, while allowing your ramming unit to proceed onward.

Don't be afraid of periodic events. If it lags, it may be because of your interval or there are a lot of timers expiring at the same time (but not really, since the engine only ever runs a single thread (unless a TriggerSleepAction is used)). In fact, be more afraid of spamming a lot of them instead of stuffing everything into just one periodic trigger.
 
Level 6
Joined
Jun 4, 2017
Messages
172
@RG00

That would make the most logical solution to your problem.

By constantly resetting the height of the unit back to 0, you prevent (as much as possible) players from noticing that the unit is actually flying, while allowing your ramming unit to proceed onward.

Don't be afraid of periodic events. If it lags, it may be because of your interval or there are a lot of timers expiring at the same time (but not really, since the engine only ever runs a single thread (unless a TriggerSleepAction is used)). In fact, be more afraid of spamming a lot of them instead of stuffing everything into just one periodic trigger.
Ok, I will try to make a loop with like 0.05 or something like that, I think it should be enough. I could make the ram fly as Tasyen said but it will be weird seeing all the units starting to teleport when they go inside the ram, maybe I could try to create a terrain pathing blocker in the position of the ram every time.
 
Pathing blocker's not necessary, all you have to do is enumerate all units near the ram and initiate a knockback on them when they're near. To complicate things, you might need to check the angle from the ram to the units, and the facing angle of the ram, and check if they are in front. If so, knock them back and here's the tricky part, those that are in front should be knocked back until the ram stops.

To show you what I mean, here's an illustration:
Battle Ram.png
 
Level 6
Joined
Jun 4, 2017
Messages
172
Pathing blocker's not necessary, all you have to do is enumerate all units near the ram and initiate a knockback on them when they're near. To complicate things, you might need to check the angle from the ram to the units, and the facing angle of the ram, and check if they are in front. If so, knock them back and here's the tricky part, those that are in front should be knocked back until the ram stops.

To show you what I mean, here's an illustration:
View attachment 274539
I see, however last month I already tried to do a knockback system and it didn't end well XD, I can try to remake it but I'm not sure I'm good enough in triggering for make a knockback system. In the worst case however I think I can download a knockback system here in the hive, luckily there are a lot of these systems in this site.
I think I can consider this thread solved, thank all of you guys who helped me :) +rep
 
Status
Not open for further replies.
Top