Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make a data structure like this?

Asked by 3 years ago

Hey. I’m working on a RPG game but i need an idea to achieve something. I’m trying to keep record of which players hit to certain npc and how much damage they did.

I tried to use module script but i stucked at array order. Today i worked too much so my brain is almost stopped lol.

local DamageRecords = {}

local mobs = {}

function DamageRecords:AddDamage(player,mobID,damage)
      --how can i store this variables on array
      --i tried some array structure but i couldn't achieve what i want. It's seems too complicated for me rn
      --I just need a help for data structure for ex.
      mobs[mob][players[damage]]
end

--I should be able to access all player and damage value they did to certain mob

return DamageRecords

Answer this question