Page 1 of 1

need help with fly unit

Posted: Tue Jan 20, 2015 4:35 pm
by noir4
Hello.

need help in creating a flying unit, in fact - the flying tank.
I will be grateful if someone would write a part of code or tell what flags should be used for this.

PS: want create Battle Cruiser from Starcraft :)

Re: need help with fly unit

Posted: Tue Jan 20, 2015 4:44 pm
by FishSandwich
I'm pretty sure you could do this just by following the Modding Tutorial, then changing individual bits of code to suit your needs.

Re: need help with fly unit

Posted: Tue Jan 20, 2015 4:59 pm
by noir4
saw this tutorial but did not understand which parameter is responsible for flight :(

can you tell? not very good with English :)

Re: need help with fly unit

Posted: Tue Jan 20, 2015 5:19 pm
by FishSandwich
There's no parameter to control flight, you simulate it by not putting a collision box.

Re: need help with fly unit

Posted: Tue Jan 20, 2015 7:56 pm
by L0771
I understand this, i'm working in a "blood-steam", and i can't make this "unit" fly, i have a problem with collision with entities.

I need this unit without collisions, like a fly unit (the command of blood-steam isn't configured yet, but is the same)
basically is a unit without collision_box and without collision_mask.

Image

Re: need help with fly unit

Posted: Tue Jan 20, 2015 8:03 pm
by FreeER
L0771 wrote:basically is a unit without collision_box and without collision_mask.
I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.

Re: need help with fly unit

Posted: Tue Jan 20, 2015 8:17 pm
by L0771
FreeER wrote:I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.
Ok, i tried with

Code: Select all

collision_mask = { "not-colliding-with-itself", "water-tile" }
this don't work (i think this should work), and work fine with

Code: Select all

collision_mask = { "not-colliding-with-itself" }
I think the flying tank is similar.

Thank you and welcome back FreeER :)

Re: need help with fly unit

Posted: Tue Jan 20, 2015 10:03 pm
by Adil
I've done a bit of testing around.
What kovarex wrote on the wiki:
collision_mask
type: Types/CollisionMask

Default: Depends on Entity type

Two entities can collide only if they share a layer from the collision mask.
should be taken literally. The presence of "water-tile" doesn't mean entity will collide with water, it means it will collide with any other entity having that layer.
Having either "water-tile" in car mask makes it bump into transport belts. I presume that umodded car can't get in the water and collides with buildings because of "player-layer", while belt indeed has the "water-tile".
"not-colliding-with-itself" disables collisions with entities of the same type i.e. car will pass through tank.
"not-colliding-with-itself"-only or empty collision mask will allow you to drive out of the map borders into the empty blackness of cosmos. :D

Re: need help with fly unit

Posted: Wed Jan 21, 2015 7:36 am
by noir4
FreeER wrote:
L0771 wrote:basically is a unit without collision_box and without collision_mask.
I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.
Thank you very much, it's helped. whether it is possible to make what unit moved above the trees and, like robots, could be attacked only range-attack.

Re: need help with fly unit

Posted: Wed Jan 21, 2015 5:06 pm
by Adil
Flying robots can be attacked by melee units.
But they probably do have the collision mask and fly around because their collision box is zero.
See if your flying tank gets attacked at all.
edit: oh it will.

Re: need help with fly unit

Posted: Wed Jan 21, 2015 5:20 pm
by Adil
Adil wrote:Flying robots can be attacked by melee units.
But they probably do have the collision mask and fly around because their collision box is zero.
See if your flying tank gets attacked at all.
edit: oh it will.
And zero sized tank still collides with trees which collision box covers the center of tank.
edit: oh damn, that was meant to be edit. :?

Re: need help with fly unit

Posted: Thu Mar 05, 2015 9:44 am
by Stx3
omfg this is great!

Re: need help with fly unit

Posted: Thu Mar 05, 2015 10:17 pm
by Zuzak
I didn't see this, seems I was not first one to make flying unit help post. mayhaps a mod can merge the 2 threads.
anyways take a look at the comments in the entity file for zoomer they will save you trial and error time

as for proper flying without collision:
collision_box = {{0, 0}, {0, 0}}, -- still leaves a 1 pixel collisional zone
collision_mask = {}, -- never collide, needs this to be able to 'drive' without hitting anything

until render layer is read by all types, it will still look like it goes behind trees and buildings

Re: need help with fly unit

Posted: Thu Jun 04, 2015 8:51 pm
by Klonan
Would just like to say, it would be so useful to have render_layer working for all entities.

Re: need help with fly unit

Posted: Thu Jun 04, 2015 9:41 pm
by L0771
Zuzak wrote:until render layer is read by all types, it will still look like it goes behind trees and buildings
i'm using this for my flying units.

Code: Select all

collision_box = nil
collision_mask = { "not-colliding-with-itself" } 
but can use

Code: Select all

collision_box = nil
collision_mask = {} 
Or other collision_mask
Collision_mask works with collision_box = nil

I hope this be helpful.

NOTE: I don't know why, transport belts aren't in object-layer, i can't do a unit fly over it :x