so is the trick here to have something unique in the "Status_eff" array? because I can't exactly apply that as its getting copied along the rest to auto generate the 4 players using merge()
onready var Runner = get_node("Runner")
signal raceOver
func _ready():
for i in 4-Game.Players.size():
var Goblin = load("res://Scenes/Goblin.tscn").instance()
Runner.add_child_below_node(Runner,Goblin)
im using this to generate the goblins based on the Game.Players.size()
these are the actual globals in Game.gd, I just typed an example earlier of how it should look when its filled
export var Players = {}
export var Race = {
"Goblin" : {
"maxHP" : 5,
"HP" : 5,
"Speed" : 100,
"maxSpeed" : 100,
"Speedmlt" : 1,
"Status_eff" : [],
"Strength": 2,
"Stopped" : true,
"Hired" : false
}
}
inside the goblin/player scene im cloning there is the player.gd script generating the dictionaries
func _on_Goblin_tree_entered():
var x = Game.Players.size()
index = x
Game.Players.merge({ x : { } } )
Game.Players[x].merge(Game.Race.Goblin)
name = str(index)
var rng = RandomNumberGenerator.new()
rng.randomize()
Game.Players[index].HP = Game.Players[index].maxHP + rng.randi_range(-2,2)
Game.Players[index].Speed = Game.Players[index].maxSpeed + rng.randi_range(-25,25)
I was trying to keep the post short and concise, but I'm not too sure where the issue lies still. can't seem to fix it
I tried to generate the dictionaries inside the same script that generates the Goblin.tscn but results were the same