Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, VoroneTZ, 1 invisible), 1,578 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
new entity #415979
01/26/13 17:29
01/26/13 17:29
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
hi few days ago i made a post asking how to create an entity that follows the player.that problem is solved but now it carried a new one: the player get stuck to the new created entity thus doesnt move until the new entity its removed. i tried to flag the new entity as passable but the problem persists. what's worng?

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 Offline
Expert
Uhrwerk  Offline
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: Uhrwerk] #415985
01/26/13 19:32
01/26/13 19:32
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
function new entity()
{

while(my)
{


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;
move_min_z = 0.4;
planning_time += 1;
if(planning_time > 100)
{
ent_remove(my);
planning_time = 0;
}

this is the function of the new created entity

Re: new entity [Re: Uhrwerk] #415986
01/26/13 19:35
01/26/13 19:35
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
the new entity appears, follows the player and after some time it dissapears. th problem is that the player get stuck to it and it doesnt walk or if its on the air dont goes down until the the new entity is removed...

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 Offline
Expert
Uhrwerk  Offline
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] #415992
01/26/13 21:06
01/26/13 21:06
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
yes the code has wait(1) at the end i just pasted the important part. and like i said, if i set the new entity passable or polygon it doesnt work anyway. and i tried to remove the entity with a wait(-3) but that caused some errors.the entity is created near the player. but i tried by creating the entity far away from the player and it works fine, so the problem its when its near it...

Re: new entity [Re: Uhrwerk] #415993
01/26/13 21:10
01/26/13 21:10
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

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 Offline
Expert
Uhrwerk  Offline
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:
Code:
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: Uhrwerk] #416091
01/28/13 00:13
01/28/13 00:13
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
yes, IGNORE_PASSABLE was the missing part i needed. that solved the problem. thx you laugh

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 Offline
Expert
Uhrwerk  Offline
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...

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1