Gamestudio Links
Zorro Links
Newest Posts
MRC.c and WFO
by 11honza11. 11/18/25 15:22
webGL
by Ice2642. 11/17/25 21:27
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (AndrewAMD), 32,145 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
SkinnyApe, tritom, sheliepaley, Blueguy, blobplayintennis
19179 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
I'm trying to create an 'allied 'script #91472
09/25/06 18:11
09/25/06 18:11
Joined: Sep 2002
Posts: 199
Chicago, Illinois
Thehawk Offline OP
Member
Thehawk  Offline OP
Member

Joined: Sep 2002
Posts: 199
Chicago, Illinois
I'm not sure if this is the best place to post this problem but it's probably a simple solution.

I'm trying to create an entity that you will follow the player and shoot at any entity that is not the player. I used AUM 56-58 workshop as the code base. The other guard follows the player. But I now need a way for the guard to detect other entities that aren't the player (so that he can shoot at them)

Here's a snippet of the code that I used. The full code is available in AUM 56-58



Code:
 if(my.status == attacking)
{
//is the road clear?
if (c_content (content_right.x, 0) + c_content (content_left.x, 0) == 2)
{

vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp );//turn enemy to player
}

if(vec_dist (player.x, my.x)> 500)
{
vec_set(content_right, vector(50, -20, -15));
vec_rotate(content_right, my.pan);
vec_add(content_right.x, my.x);





this is the exact script from AUM 56-58. I changed the 'player.x' to 'ent.x' for the "my_ally" function that I based this on. The only problem is that ent.x is not recognized.

So my questions are:

1) Is 'player.x' automatically recognized as a vector?

2) What vector should I use to detect another entity that is not the player?

3) Should I use C_trace instead?

4) Am I way off and should use another function or technique instead?

I apologize for being longwinded but I appreciate any help you can provide.

Re: I'm trying to create an 'allied 'script [Re: Thehawk] #91473
09/26/06 02:21
09/26/06 02:21
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
1). If there is an entity with the player pointer, then yes it is a vector.
2 - 3). You are going to need to scan to find enemies. To start with you might want to use a pointer array so the enemies can search through all of the player and his allies, and latter scan for them.
4). AI is the most difficult thing to write. So learn as much as you can and keep practing.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!

Gamestudio download | 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