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
2 registered members (TipmyPip, AndrewAMD), 12,726 guests, and 5 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
multiple enemy using the same action and path_set #208461
05/27/08 15:23
05/27/08 15:23
Joined: Aug 2007
Posts: 44
QLD, Australia
Serex Offline OP
Newbie
Serex  Offline OP
Newbie

Joined: Aug 2007
Posts: 44
QLD, Australia
So im whipping together a very simple AI script. The theory is that i will create a path, use 1 generic action to control the enemies, and then use path_set based on the instance of the action to determine what path to take.

I thought possibly something similar to:

Code:
	
	if (me == eEnemyOneMdl)
	{
		path_set(my, "enemy_1");
		movement_enabled = 1;
	}
	else if (me == eEnemyTwoMdl)
	{
		path_set(my, "enemy_2");
		movement_enabled = 1;
	}
	else
	{
		// The script jumps here every time.
	}


Would i be better storing the string for the path name in string1 or string2 and then using path_set(my, my.string1)?

Re: multiple enemy using the same action and path_set [Re: Serex] #208574
05/28/08 03:53
05/28/08 03:53
Joined: Jul 2004
Posts: 1,205
Greece
LarryLaffer Offline
Serious User
LarryLaffer  Offline
Serious User

Joined: Jul 2004
Posts: 1,205
Greece
Yes, the fewer if nests is usually the better.. If I were you I'd do something like this:

Code:
action EnemyOne {my.skill[0]=1; ...}
action EnemyTwo {my.skill[0]=2; ...}

..
STRING* sTemp=str_create("");
if (my.skill[0]>0)
{
     path_set(my, str_cat_num(str_cpy(sTemp,"enemy_"),"%.0f",my.skill[0]));
     movement_enabled = 1;
}
ptr_remove(sTemp);
...



INTENSE AI: Use the Best AI around for your games!
Join our Forums now! | Get Intense Pathfinding 3 Free!
Re: multiple enemy using the same action and path_set [Re: LarryLaffer] #208577
05/28/08 04:35
05/28/08 04:35
Joined: Aug 2007
Posts: 44
QLD, Australia
Serex Offline OP
Newbie
Serex  Offline OP
Newbie

Joined: Aug 2007
Posts: 44
QLD, Australia
thankyou sir!


Moderated by  HeelX, Spirit 

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