The Dink Network

Reply to Re: Enemy Combat Scripting

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
April 8th 2010, 02:07 AM
bonca.gif
Erwin
Peasant He/Him Netherlands
Friendship is magic 
I've done something like this before. I marked creatures as team 1 and team 2 by setting their sp_gold values to 1 and 2. Then I would have them target a random member of the other team in their main procedure. Here's a bit of code from a member of team 2 I used to do it.

int &mtarget;

loop:
&mtarget = get_rand_sprite_with_this_brain(9, 0);
if (&mtarget > 0)
  {
  int &team;
  &team = sp_gold(&mtarget, -1);

	if (&team == 1)
	{
  	sp_target(&current_sprite, &mtarget);
	}
	
	if (&team == 2)
	{
	sp_target(&current_sprite, 0);
	wait(1);
	goto loop;
	}

  }

}


I wasn't quite finished with this so there are still a couple of things that need to be done. A team allied with Dink will of course have to check if they targeted Dink and target something else if they did. A new target has to be picked once the current target is dead. It would also be nice if the creatures were able to target the nearest enemy creature. I haven't quite figured out how to do the last part yet but I think it's possible. I'll play around with it once I have time and let you know what I know once I know it.