Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 642 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Several entities with the same pointer/c_scan pointer madness #263947
05/03/09 12:47
05/03/09 12:47
Joined: Dec 2007
Posts: 34
L
Luzifer Offline OP
Newbie
Luzifer  Offline OP
Newbie
L

Joined: Dec 2007
Posts: 34
Hello everyone,

right now I'm trying to get a rather simple shooter system to work. For my enemies I'm using a modified AI from the AUM 57 and even though it seemed to work fine in the beginning, I'm running into a lot of problems with it.

First of all the enemy looks for you = player and by testing I know that even though the c_scan finds my player, the enemy randomly does not recognize the player entity. Sometimes I can jump up and down in front of it, sometimes it will see me right the second I step into the scan cone. C_scan seems to do fine, it's just that the player pointer is not recognized half the time. Here's the code:

Code:
if ((c_scan(my.x, my.pan, vector(160, 60, 1000), ignore_me) > 0) && (you == player))
	{
	my.skill1 = attacking; // then attack the player
	}


On a different note: When I shoot an enemy, I want there to be some effects (blood obviously) and it works just fine this way:

Code:
if (you == ent_enemy)
{
	if (hitvertex > 450 && hitvertex < 800) {
		you.skill3 -= 100; //headshot kills instantly
	}
effect(blood_hit,55,target,nullvector);
}


Problem: If I create two enemy entities with the same action the pointer only works for one, the other does not get any blood effects or headshots. How do I work around that problem, so that both enemies work the same? (without creating seperate actions for each enemy)

Thanks in advance!


Edit: Okay this is seriously weird. The c_scan cone works fine (event_scan of player is activated inside the cone) but the enemy only recognizes "you" as "player" if I'm on the far left side of his vision field.

Last edited by Luzifer; 05/03/09 13:52.
Re: Several entities with the same pointer/c_scan pointer madness [Re: Luzifer] #263968
05/03/09 14:45
05/03/09 14:45
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
is "ent_enemy" a Pointer?
A Pointer can point only to one Entity!
Use one skill to identify the enemy:

#define Art skill21;
#define Art_enemy 1;

action enemy_action()
{
...
my.Art = Art_enemy;
}

then if you want to know if the hit is a enemy:

if (you.Art == Art_enemy)
{
...
}

Edit: This is lite-C, but it is no problem to convert...

Last edited by Widi; 05/03/09 14:55.
Re: Several entities with the same pointer/c_scan pointer madness [Re: Widi] #263974
05/03/09 15:18
05/03/09 15:18
Joined: Dec 2007
Posts: 34
L
Luzifer Offline OP
Newbie
Luzifer  Offline OP
Newbie
L

Joined: Dec 2007
Posts: 34
Funktioniert super, vielen vielen Dank!

For all potential, English-speaking helpers:
Second problem solved. Out of curiosity I tried to replace the player-pointer in c_scan and hoped this would work better too, but no change. The enemies react exactly the same. Even though the scan-cone seems to be working correctly they do not identify the skill or the pointer until the player is extremely close or on their left side. That is weird.

Any suggestions?

Re: Several entities with the same pointer/c_scan pointer madness [Re: Luzifer] #263992
05/03/09 17:49
05/03/09 17:49
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Wenn der Spieler von einem Gegner-Scan getroffen wird, sollte er einen Trace zu diesem Gegner schicken.

Wenn der Tracestahrl durchkommt, ist der "Blick" zum Spieler frei und es darf geballert werden.

Praktischerweise zeigt dann "you" in der Event Funktion des Gegners auf den Spieler.

Nur mit c_scan wird das nix, weil c_scan alle Entities findet
und "you" auf die nächstgelegene setzt.
Das ist natürlich nicht immer der Spieler, sondern auch mal ein anderes Objekt.


no science involved
Re: Several entities with the same pointer/c_scan pointer madness [Re: fogman] #264546
05/06/09 18:39
05/06/09 18:39
Joined: Dec 2007
Posts: 34
L
Luzifer Offline OP
Newbie
Luzifer  Offline OP
Newbie
L

Joined: Dec 2007
Posts: 34
Sorry für die späte Antwort, komme unter der Woche nicht so recht zu was. Ich werde das auf jeden Fall ausprobieren.

Aber eigentlich sollte es doch auch rein mit Scan funktionieren. Dafür fragt die IF-Bedingung ja nach "you == player". Wenn ich diese rausnehme findet er den Player (und natürlich jede andere entity) sofort so wie geplant.

Ich denke deine Methode wird eine gute Umgehung sein, ich werds definitiv testen. Aber eigentlich müsste es doch auch mit der reinen Abfrage "you == player" im c_scan funktionieren, oder?

Re: Several entities with the same pointer/c_scan pointer madness [Re: Luzifer] #264560
05/06/09 20:18
05/06/09 20:18
Joined: Apr 2009
Posts: 298
Southern Oceans
KiwiBoy Offline
Member
KiwiBoy  Offline
Member

Joined: Apr 2009
Posts: 298
Southern Oceans
Give it a unique ID then if (unique ID =insert unique ID numbers)
then do action.


Use the 'manual' Luke, the manual is your friend. 'Self reminder' smile

My WebPage
Re: Several entities with the same pointer/c_scan pointer madness [Re: Luzifer] #264885
05/08/09 16:06
05/08/09 16:06
Joined: Nov 2002
Posts: 792
Berne, Switzerland
elsewood Offline
User
elsewood  Offline
User

Joined: Nov 2002
Posts: 792
Berne, Switzerland
In deinem Code machst du EINEN Scan und fragst dann ob es den Spieler getroffen hat. Wenn ja dann setzt du den Flag, wenn NEIN, dann machst du einfach gar nichts...
ALso geht das nur, wenn der Spieler das nächstgelegene Objekt ist und sonst findest du ihn nicht... grin


A bus station is where the bus stops. A train station is where the train stops.
On my desk I have a workstation...
Re: Several entities with the same pointer/c_scan pointer madness [Re: elsewood] #264998
05/09/09 13:02
05/09/09 13:02
Joined: Dec 2007
Posts: 34
L
Luzifer Offline OP
Newbie
Luzifer  Offline OP
Newbie
L

Joined: Dec 2007
Posts: 34
Ahhh, der Groschen ist gefallen! wink Danke!

Ich habs jetzt so probiert wie fogman vorgeschlagen hat, aber ich es funktioniert noch nicht so recht, bzw. garnicht. Wenn ich im Code temp.x verwendet habe, hat der Gegner den Player nur auf der x-Achse des Levels gefunden, also das war schonmal falsch. Da der scan laut Tests weiterhin tadellos funktioniert muss es wohl mein c_trace sein. In der aktuellen Form passiert garnichts:

Code:
if (event_type == EVENT_SCAN) 
{
  vec_set(temp,your.x);
  c_trace(player.x,temp,ignore_passable|ignore_me|activate_sonar|use_box);
}


Ohne use_box hab ichs auch schon probiert. Wo liegt der Fehler?


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