playMaker

Author Topic: ArrayMaker: Collecting spawned game objects?  (Read 2378 times)

Red

  • Hero Member
  • *****
  • Posts: 563
ArrayMaker: Collecting spawned game objects?
« on: August 21, 2012, 05:46:17 PM »
So, i've got a situation here...

i have to use an array with arrayMaker to collect a non-finite number of gameobjects that were spawned by a different object and store them in an array... as well as the distance from the object which is making these calculations.

the reason is that i'm trying to create a damage calculator for an enemy when it interacts with fire "seeds" within a certain range so i can calculate how much to multiply the base damage... the distance is so that i can filter out the seeds that are outside of it's range... i can get it to find the closest but that works with only one... do you think it's an idea to create the array, find the closest, add it to the array and then turn a switch/bool in it so that it is excluded with the loop to find the next closest?

Example: Say the enemy is hit with four fire "seeds"... i need it to count the number of seeds that it's hit with... from there, i want to multiply the base damage rate by four (which is the number that it's hit by.) further, say it's neighbour is only hit by two fire "seeds"... i need it to collect those seeds so it knows how many it was hit by. even further, say there is an enemy that's hit with twenty fire "seeds"... again, get the count and calculate the damage accordingly.

if so, any tips would be greatly appreciated.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker: Collecting spawned game objects?
« Reply #1 on: August 22, 2012, 04:42:46 PM »
Hi,

 Allow me few days to respond, currently at Unite and brain is not really functionning when back at the hotel :)

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker: Collecting spawned game objects?
« Reply #2 on: August 29, 2012, 03:19:04 AM »
Hi,

 Ok, back :)

 Have you looked at the targetpro solution?
http://targetpro.path-o-logical.com/
https://hutonggames.fogbugz.com/default.asp?W993

I ported it to playmaker and I have to say I was really impressed by the incredible coverage of this kind of scenario. I think you should ask on their forum about your scenario and see if they have a solution ( which I am pretty sure they have).

 now, using arrayMaker only, you would simply maintain several hashtables, using the gameObject name as the key and then whatever value ( damage, hit count).  Based on that, you can then access and set values for any objects. Else you can have a fsm responsible for manageing this on a per target bases, so on each potential target you would have a fsm that handle hit events and count, apply damages etc etc.

Bye,

 Jean