Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,529 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 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 | 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