Ignore Entities with special skill values when performing c_move

Posted By: garv3

Ignore Entities with special skill values when performing c_move - 10/08/09 14:56

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:
Code:
// 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:
Code:
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
Posted By: SomebodyNew

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 15:17

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:
Code:
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!
Posted By: garv3

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 15:40

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!
Posted By: Germanunkol

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 15:41

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... tongue cause it took me ages to figure that out
Posted By: SomebodyNew

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 16:59

Do you have any advantages with a void over a function?
I've looked in the manual but it does not even mention voids.
I've seen them a couple of times though.
My understanding is that voids can't return anything while functions do but are a slightly slower than voids.
Posted By: garv3

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 18:07

Originally Posted By: SomebodyNew
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!)
Posted By: Germanunkol

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 19:19

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".
Posted By: garv3

Re: Ignore Entities with special skill values when performing c_move - 10/08/09 19:24

Originally Posted By: Germanunkol
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.
© 2024 lite-C Forums