# Array for mob stats

• 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

• 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.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• 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.