2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Ignore Entities with special skill values when performing c_move
#293002
10/08/09 14:56
10/08/09 14:56
|
Joined: Jan 2005
Posts: 605 Deutschland, NRW
garv3
OP
User
|
OP
User
Joined: Jan 2005
Posts: 605
Deutschland, NRW
|
Hi all, is it somehow possible to ignore special Entities when moving an entity by c_move? I know IGNORE_FLAG2, IGNORE_PASSABLE, IGNORE_YOU and so on... What I want to do is: Prevent the players' entities (it's multi player) from colliding with each other and prevent the enemies from colliding with each other and prevent items from colliding with each other and enemies. For the players (two ships) I already tried:
// SHIP 1 FUNCTION
[...]
you = Player2Schiff;
c_move(me, nullvector, vec_scale (tempVec, -0.5*Player1Bewegungsgeschwindigkeit*time_step), (IGNORE_PASSABLE | IGNORE_PUSH | IGNORE_YOU));
[...]
// SHIP 2 FUNCTION
[...]
you = Player1Schiff;
c_move(me, nullvector, vec_scale (tempVec, -0.5*Player1Bewegungsgeschwindigkeit*time_step), (IGNORE_PASSABLE | IGNORE_PUSH | IGNORE_YOU));
[...]
But they still collide and get stuck when moved 'through' each other -> why?. It would be great if it is possible to set an IGNORE_SKILL5 for example and the c_move operation ignores all entities with the same skill5 value. Code would be somewhat like:
ship1.skill5 = 123;
ship2.skill5 = 123;
[...]
// SHIP 1 and 2 FUNCTION
c_move(me, nullvector, vec_scale (tempVec, -0.5*Player1Bewegungsgeschwindigkeit*time_step), (IGNORE_PASSABLE | IGNORE_PUSH | IGNORE_SKILL5)); // Ship ignores the other ship!
Anyway I would like to find a way to make an entity move ignoring all other entities that belong to the same 'group' or 'type'. Any ideas? Kind regards derGarv
GameStudio Version: A7 Pro v7.86
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: garv3]
#293003
10/08/09 15:17
10/08/09 15:17
|
Joined: Jul 2009
Posts: 36
SomebodyNew
Newbie
|
Newbie
Joined: Jul 2009
Posts: 36
|
What you are looking for is called "ACTIVATE_PUSH". You'll find it in the manual under c_move. c_move(me, vector(25*time_step, 0, 0), nullvector, IGNORE_PASSABLE | ACTIVATE_PUSH); You do not have to set a push value! Now put sth. like this in your collision event:
function damage_enemies_only()
{
if(event_type == EVENT_PUSH)
{
if (your.side == 3)
return(0);
}
if(event_type == EVENT_ENTITY && your.side != 3)
{
your.health -= 10;
my.alive = 0;
}
}
I never understood why you would want to use IGNORE_FLAG2 since entities become either passable or obstacles. Which is not a sohpisticated differentiation. Ok, I hope this helps. Good luck!
Last edited by SomebodyNew; 10/08/09 15:29.
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: SomebodyNew]
#293005
10/08/09 15:40
10/08/09 15:40
|
Joined: Jan 2005
Posts: 605 Deutschland, NRW
garv3
OP
User
|
OP
User
Joined: Jan 2005
Posts: 605
Deutschland, NRW
|
Well, I just didn't know about the possibility to return a 0 or 1 in the event function. This helps a lot and solves all my problems regarding to the collision system!
Thank you a lot!
GameStudio Version: A7 Pro v7.86
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: SomebodyNew]
#293006
10/08/09 15:41
10/08/09 15:41
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
note that sombodynew's example only works the way he did it, not if you use "void" instead of "function"... just to save you some time... cause it took me ages to figure that out
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: SomebodyNew]
#293028
10/08/09 18:07
10/08/09 18:07
|
Joined: Jan 2005
Posts: 605 Deutschland, NRW
garv3
OP
User
|
OP
User
Joined: Jan 2005
Posts: 605
Deutschland, NRW
|
My understanding is that voids can't return anything while functions do but are a slightly slower than voids. That's my understanding too. But I think the performance advantage is minimal, so I use functions all the time. That avoids problems like this. But another question: Is there any event triggered when an entity with ACTIVATE_PUSH overruns another entity? I know that EVENT_PUSH is triggered for the overrun entity but is anything triggered for the overrunnig entity? (Sorry for these confusing sentences!)
GameStudio Version: A7 Pro v7.86
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: garv3]
#293036
10/08/09 19:19
10/08/09 19:19
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
functions is the word used in c_script. It can still be used, and can return (I think it returns var only). void simply means that it doesn't return anything, just like you said, and I use it cause it's an awesome word (I just like "void"), because it's shorter, and because it gives reminds me of the fact that the function doesn't return anything. If a function should return something, I use int or long or var or ENTITY* or whatever it should return. Gives it more structure and makes it a little easier to read... and I dislike the c_script syntax.
as for the overrrunning entity event triggering, I don't think anything's triggered, since it ignores it until the other entity returns "1".
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: Ignore Entities with special skill values when performing c_move
[Re: Germanunkol]
#293039
10/08/09 19:24
10/08/09 19:24
|
Joined: Jan 2005
Posts: 605 Deutschland, NRW
garv3
OP
User
|
OP
User
Joined: Jan 2005
Posts: 605
Deutschland, NRW
|
as for the overrrunning entity event triggering, I don't think anything's triggered, since it ignores it until the other entity returns "1". That's exactly what I noticed. So what can I do if I want the entity to overrun the second one but perform an event? EDIT: Found a workaround - not too smart but it works for me.
Last edited by garv3; 10/08/09 21:23.
GameStudio Version: A7 Pro v7.86
|
|
|
|