D
Deleted member 16767
Guest
I want to make a talent tree but I don't know where to start. What is the most easy approach in making it and so that I won't have trouble with it in the future?
More than likely he is referring to talent trees in games not trees in Data Science.Whats a talent tree? I'm guessing you're talking about making a tree of information, but you'll have to be more specific.
/// addTalent(name, sprite, parent);
var o = instance_create(0, 0, obj_talent);
o.name = argument[0]; // not needed but most talents will have names
o.sprite = argument[1]; // also not needed but can be useful to have
o.parent = argument[2]; // this is needed. Parent is what talent you need to already have learned to learn this talent.
o.active = (o.parent == noone); // if the parent is noone then you will learn this skill by default (used for the base talent)
return o;
base = addTalent("", 0, noone); // this is a base talent, this isn't a talent you can learn
skill1 = addTalent("Fire", spr_fire, base); // if the talent has a parent of 'base' that means you don't need to learn any other talents to learn this one
skill2 = addTalent("Fire2", spr_fire, skill1); // this one has a parent of skill1 so you need to learn skill1 before learning this one
skill3 = addTalent("Water", spr_water, base); // again this has a parent of 'base' so no other talents are needed to learn this
/// talentLearnable(talent);
var t = argument[0];
return (t.parent == noone || t.parent.active);
if(talentLearnable(obj_controller.skill1)) { // if you can learn the skill
obj_controller.skill1.active = true; // then learn the skill
}