The Daily Click ::. Forums ::. Klik Coding Help ::. individuality between enemies when using the same active object
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
25th December, 2010 at 01:11:51 -

What im aiming for is to be able to use the same active object for all of the same type of enemy, so i dont have to make a new active object for each enemy that i put in a level, cuz theres gonna be quite a lot. anywho, to the point...
Say i make it so in game you have a quest to collect a certain amount of some random object, and only certain enemies in the level has them. so say only Trooper A's will drop Quest item, but not all of them, and the ones that actually have it are randomized. how would i go about making it so that the game randomly selects some of the Trooper A's to give them the item, and then on top of that how would i make it so that a quest object appears above the heads of the ones that have the quest item? Ive tried this in the past with other games, but hte problem i was having was that i didnt know how to create an active object and have it follow 1 Trooper but not hte others, it always wants to jump around to the closest one and what not, instead of following the right one. also, instead of all 3 (just as an example) quest markers following 3 different troopers they would all glitch around and clump together on 1 trooper, how do i go about fixing this?

 
[Game design makes my brain feel like its gonna explode.]

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
25th December, 2010 at 01:45:16 -

The items aren't "jumping around to the closest one" - there are some pretty simple rules which determine how objects pair up.

This article may be useful, and includes links to a couple of others:
http://www.create-games.com/article.asp?id=1975

Basically, alterable values (and often the "spread value" function) are what you need.

To answer your specific question though...

Give each Trooper an alterable value called "Item", and set it to "0" by default.
Now add a couple of events:

+ Start of frame
-> Run fastloop "RandomizeItems", n times (where n = number of troopers with item)

+ On Loop "RandomizeItems"
+ "Item" of Trooper = 0
+ Pick Trooper at random
-> Trooper: Set "Item" to 1
-> Create ItemSprite at 0,0

That takes care of randomizing which Troopers carry items, and creating the item sprites that appear above their heads.
Now to make the items follow the Trooper...

+ "Item" of Trooper = 1
-> ItemSprite: Set position at 0,0 from Trooper

Job done

 
n/a

Mark McCauley



Registered
  18/02/2009
Points
  291

Has Donated, Thank You!VIP Member
5th January, 2011 at 11:18:16 -

or if you mean using different sprites for example soldier1,soldier2,scientist1,scientist2
in tgf2
in properties of activeobjects
set object qualifiers to say enemy

this way u only need to code the events once for all object types enemy instead of doing for each active sprite
do u get me?



 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th January, 2011 at 08:33:07 -

Yah i get it, i use mmf2 dev though, would it be the same basic thing as using the enemy qualifier in mmf2? (btw, thanks for all your help mark, youve been answering lots of my questions, even some of that have already been answered, but the additional info you provide is very helpful )

 
[Game design makes my brain feel like its gonna explode.]

Mårten



Registered
  25/06/2002
Points
  769
11th January, 2011 at 11:15:12 -

Yeah, you're referencing the same thing. There are Object qualifiers, one of the is named Enemy. Most things are the same in MMF2 and TGF2.

 
---
   

Post Reply



 



Advertisement

Worth A Click