Entity attachement

Post Reply
User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Entity attachement

by azekill_DIABLO » Post

Is it possible to make a player ALWAYS ride an entity, like a car of my mod???

sofar
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Entity attachement

by sofar » Post

Yes, you can do this several ways:

1 - attach on login, attach on respawn, and disallow detaching.
2 - change the player model

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Entity attachement

by azekill_DIABLO » Post

precision on the first way??

with some code pls

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Entity attachement

by azekill_DIABLO » Post

hey can somone help?? :(

User avatar
oleastre
Member
Posts: 81
Joined: Wed Aug 13, 2014 21:39
GitHub: oleastre
In-game: oleastre

Re: Entity attachement

by oleastre » Post

I don't want to be rude, but did you tried to do what sofar explained ?

You have your own car mod working with entities, so at least you already have an example of code that attach the player to an entity.

I did not tried by myself, but from sofar comment, I just had a look in the minetest api, searched for "connect" and "spawn" and found two functions: minetest.register_on_joinplayer and minetest.register_on_respawnplayer.

So, you just have to use those two functions to register callbacks that will attache your player to an entity, just like it's done when a player use the "use" button to get into your car mod.

Maybe you already tried and got some errors, then ignore the above comment and let us know what the problem is.

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Entity attachement

by azekill_DIABLO » Post

hey! i made that thread becuz i already tried things without sucess and becuz i'm a noob in lua!

if we can ask an exemple of code.........

but thanks i wasn't knowing this Minetest api

User avatar
oleastre
Member
Posts: 81
Joined: Wed Aug 13, 2014 21:39
GitHub: oleastre
In-game: oleastre

Re: Entity attachement

by oleastre » Post

I understand you are beginning; and I can only encourage you to continue making efforts.

If you do not get answers, maybe try other ways (like the various irc channels), or give us some hints.

As a daily programmer, when you ask for code examples, it seems like you want me to write the code for you :)

And if I never did precisely what you are asking for, I will not answer you with something I did not tested. And so, probably do not answer.

If you asked "How can I know when a player connects or respawn ?" then you would probably have got a quick answer pointing to the correct location in the minetest api.

Did you already read rubenwardy's minetest modding tutorial ?

( and if it's easier for you to ask questions in french, do so in the dedicated forum section ;-) )

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Entity attachement

by azekill_DIABLO » Post

oh no i just know if someone was able to show some functions or part of code!

if i don't code in lua that not funny ...

you just gave me docs and that perfect! and for code i better understand english ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests