3 registered members (AndrewAMD, VoroneTZ, 1 invisible),
1,578
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: new entity
[Re: Funeral]
#415980
01/26/13 17:46
01/26/13 17:46
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Please post your code so we can have a look at it.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: new entity
[Re: Funeral]
#415988
01/26/13 20:03
01/26/13 20:03
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Please use code tags when posting code. The above code shouldn't do anything useful at all, but instead remove the entity immediately after it was created because it's missing a wait instruction.
Apart from that move_min_z is written but never read, this is most likely an error.
As you already pointed out yourself you're not setting the entities passable flag. Do that. That will fix the player getting stuck.
Please note that the entity gets removed after 100 frames (I presume that there is a wait that you forgot to paste here). This is not timed correctly and most likely not what you wanted as 100 frames can be different time spans on different machines and circumstances.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: new entity
[Re: Uhrwerk]
#415993
01/26/13 21:10
01/26/13 21:10
|
Joined: Dec 2008
Posts: 83 Buenos Aires, Argentina
Funeral
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
|
function kazooie() {
while(my) { set(me,PASSABLE); vec_set(my.x, vector(0, 2.6, 5)); vec_rotate(my.x, player.pan); vec_add(my.x, player.x); my.pan = player.pan; planning_time += 1; if(planning_time > 100) { ent_remove(my); planning_time = 0; } wait(1);
} }
the new entity has to be passable not the player
Last edited by Funeral; 01/26/13 21:16.
|
|
|
Re: new entity
[Re: Funeral]
#415995
01/26/13 21:20
01/26/13 21:20
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Again, please use code tags when posting code and indent it properly. Also please edit your posts and do not double post instead. When you have set the PASSABLE flag but the player still gets stuck you have most likely forgot to set the IGNORE_PASSABLE flag when using c_move in the player's action. Here is an alternate suggestion to your code which is (at least from my point of view) better readable and fixes the timing problem:
function kazooie()
{
set(me,PASSABLE); // Do this only once
planning_time = 0;
while(planning_time < 100)
{
vec_set(my.x, vector(0, 2.6, 5));
vec_rotate(my.x, player.pan);
vec_add(my.x, player.x);
my.pan = player.pan;
planning_time += time_step; // Use time_step instead of 1 to fix the timing issue.
wait(1);
}
ent_remove(my);
}
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: new entity
[Re: Funeral]
#416093
01/28/13 00:16
01/28/13 00:16
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
You're welcome. I'm glad I could help. :-)
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|