#Question how do I pass three variables to a function from two scripts at the same time?

1 messages · Page 1 of 1 (latest)

lavish tusk
#

https://pastebin.com/dXMrZNgR

In this pastebin I have the focal part of my code, basically i'm trying to achieve a Pokémon style type system with weaknesses, immunities and resistances my main problem is passing the elementType variable from the player or enemy that got hit and at the same time pass the damageAmount and damageType variable from what is hitting it so it can calculate the damage, the decrease_health function is from a cococode tutorial I followed to make a simple enemy but now that I need to make this i need to rework it, but first I would like to know if I can pass the three variables like I need to or if I have to make more functions. <@&1349109171240439858>

tawny rover
#

i say you pass the three variables

#

and you can use metadata

#

to share data between scripts

#

or to store info

#

or even better, create a DamageInfo class

#

to share data

#

but i still recommend using metadata because custom classes are a lil bit advanced

lavish tusk
#

I made a custom class but yes I'll go with Metadata thanks for the help

lavish tusk
tawny rover
#

if it's a dict

#

and then parse it in the other scripts

lavish tusk
#

Okay but how do I make it so it changes based on the enemy? Can I set the metadata different for every enemy? Sorry if I'm asking a lot but it's my first game

tawny rover
#

Yep, you can set any amount of metadata you want, and I enjoy helping people, so you're actually doing me a favor!

lavish tusk
#

Then I hope I can get your help in the future ^^