# Array for mob stats

Just started using Construct 2? Post your questions here

### » Wed Apr 20, 2016 4:53 pm

Hi all,

I've started putting together an array for my mobs. The array currently consists of:

mob name
mob rarity
drop rate
drop rarity
"animation" frame (which is just a static image of the one of the mobs).

The array value is currently 5,5,1 as i'm only testing with 5 mobs at the moment.

To give you a flow of how things go:
Player enters an area
The system will choose a random mob from the array to fight based on mob rarity.
The combat will be automated and is output to a combat log for viewing.

Now I obviously don't want the mob to die in one hit, so could I add further details to the mob array like health and resistances? So the combat log shows the Player (which has global variable HP) and NPC (which would have array HP) "duking it out" until one is dead.

Apologies if this isn't clear, i'm still learning the whole array thing!

Thanks
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496

### » Wed Apr 20, 2016 6:39 pm

Sure you can! A 2D array should suffice. x could be mob names and then all the values on the y axis could be attributes for that mob. eg

(0,0) = Skeleton
(0,1) = resistance fire
(0,2) = rarity 5
(0,3) = HP 100

etc, and then the next mob is at

(1,0) = Gremlin
(1,1) = resistance water
(1,2) = rarity 15
(1,3) = HP 50

and so on. Just make a note for yourself somewhere of what each Y-coordinate is for. Ie (x,0) is name, (x,1) is resistance, (x,2) is rarity, etc.

Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

### » Wed Apr 20, 2016 9:12 pm

mikehive wrote:Sure you can! A 2D array should suffice. x could be mob names and then all the values on the y axis could be attributes for that mob. eg

(0,0) = Skeleton
(0,1) = resistance fire
(0,2) = rarity 5
(0,3) = HP 100

etc, and then the next mob is at

(1,0) = Gremlin
(1,1) = resistance water
(1,2) = rarity 15
(1,3) = HP 50

and so on. Just make a note for yourself somewhere of what each Y-coordinate is for. Ie (x,0) is name, (x,1) is resistance, (x,2) is rarity, etc.

Thank you very much mikehive

Next stop the combat system! Though with the idea of automating the most part, hopefully won't be very difficult.

Thanks again.
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496