You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Basically, I’m creating a combat system similar to Omori, where certain emotions can affect your damage. The best idea I’ve had was to store two tables. A table on top to represent the emotions that beat the emotions on the table below it.
Example:
Basically, if one player has the Angry emotion currently on them, and the other player were to have the Happy emotion, then a function would run because those two emotions correlate in the tables.
What is the issue? Include screenshots / videos if possible!
I’m having a hard time trying to write this into code form
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried looking around but I had trouble searching because of how I’m struggling to phrase this question.
You could utilize table.find() and check if both player’s emotions are in one of the tables. If not, then it’s safe to assume the other player’s emotion is in the other table. Presuming emotions always has a value from the tables.
For example,
if (table.find(StrongAgainst, Player1.Emotion) ~= nil and table.find(StrongAgainst, Player2.Emotion) ~= nil) then
-- Whatever code you want to run if their emotions are in the same table.
else
-- Different emotions code.
end
local stronk = {"angery","hapy","sad")
local weak = {"hapy","sad","angery")
local tableCount = 3 ----how much stuff is in table or you could use #weak to get how much stuff is in the table
function checkIfColaterate(Player1,Player2)
for i,tableCount,1 do
if stronk[i] == Player1.Emotion and weak[i] == Player2.Emotion then
----checking if indexing 1 in the table is equal to player 1 emotion and player 2 then it continues the script else it will index 2 in the table and check if its player 1 emotion etc..
elseif weak[i] == Player1.Emotion and stronk[i] == Player2.Emotion then
---if its the opposite in case of
end
end
end