Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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