I finded question about getting more than 100 SKILLS in one of the forum's thread. It can be done with DLL, fast and efficient. But If you can't deal with C++, you have to think about C-script...
Look at slow C-script version
:
Code:
define Skill200, SKILL60; //define skill for handle storing
var GetEntRetVal; //must be global for execute...
entity* GetSetEnt; //pointer for SKILL box entity
string ExecStr; //string for execute command
string TempIntStr; //string for converting int->str
string PsEnt=<ps.mdl>; //create very small MDL5 entity with 4x4 skin (it takes ~296 bytes only)
action PsEntAction{ //action for our SKILL box
my.invisible=on; //invisible passable static
my.passable=on;
my.dynamic=off;
}
function GetSkill200(EntName, SkillNum){ //Get SkillNum value for EntName entity
GetEntRetVal=-1; //Set to ERROR
if (!EntName){return(GetEntRetVal);} //No entity, ERROR
if (SkillNum>100)||(SkillNum<1){return(GetEntRetVal);} //No Skill, ERROR
GetSetEnt=EntName; //type casting ;)
if (GetSetEnt.Skill200==0){ //No entity for skill storing
GetSetEnt.Skill200=handle(ent_create(PsEnt,my.x,PsEntAction)); //create it
}
GetSetEnt=ptr_for_handle(GetSetEnt.Skill200); //get pointer to SKILL box
str_cpy(ExecStr, "GetEntRetVal=GetSetEnt.SKILL"); //prepare execute command
str_cat(ExecStr, str_for_num(TempIntStr, int(SkillNum)));
str_cat(ExecStr, ";");
execute(ExecStr);
return(GetEntRetVal); //return needed skill
}
function SetSkill200(EntName, SkillNum, SkillVal){ //Set SkillNum to SkillVal for EntName entity
if (!EntName){return(-1);} //No entity, ERROR
if (SkillNum>100)||(SkillNum<1){return(-1);} //No Skill, ERROR
GetSetEnt=EntName; //type casting ;)
if (GetSetEnt.Skill200==0){ //No entity for skill storing
GetSetEnt.Skill200=handle(ent_create(PsEnt,my.x,PsEntAction)); //create it
}
GetSetEnt=ptr_for_handle(GetSetEnt.Skill200); //get pointer to SKILL box
str_cpy(ExecStr, "GetSetEnt.SKILL"); //prepare execute command
str_cat(ExecStr, str_for_num(TempIntStr, int(SkillNum)));
str_cat(ExecStr, "=");
str_cat(ExecStr, str_for_num(TempIntStr, SkillVal));
str_cat(ExecStr, ";");
execute(ExecStr);
return(0); //no ERROR
}
function RemoveSkill200(EntName){ //remove SKILL box, call this before ent_remove(EntName)
if (!EntName){return(-1);} //No entity, ERROR
GetSetEnt=EntName; //type casting ;)
if (GetSetEnt.Skill200!=0){ //No entity for skill storing
GetSetEnt=ptr_for_handle(GetSetEnt.Skill200); //get pointer to SKILL box
ent_remove(GetSetEnt); //and remove it
}
return(0); //no ERROR
}
For saving another 100 skills we create invisible passable static entity and use it as "SKILL BOX". Don't forget to remove it before removing 'parent' entity.
Example of usage (without error checking):
Code:
define MySkill6, SKILL6; //define name for skill6
define MySkill106, 6; //define another name for skill6, but this imagine skill106
...
SetSkill200(me, MySkill106, random(50)); //set my.skill106 to random value
me.MySkill6=20; //set my.skill6 to 20
...
your.MySkill6=GetSkill200(me, MySkill106); //set you.skill6 to my.skill106 (random value)
SetSkill200(you, MySkill106, me.MySkill6); //set you.skill106 to my.skill6 (20)
...
RemoveSkill200(me); //remove "skill box" entity before removing parent entity
ent_remove(me);
RemoveSkill200(you);
ent_remove(you);
...
That's all. If you want another 100 skills define one more skill for "skill box" handle and rewrite functions for set/get/remove.
But I don't know for what you may need 300 skills