Then I created a command called @Training
to be able to add points per command
Spoiler
ACMD(training)
{
int pontos = 0;
int resultado = 0;
pontos = sscanf(message, "%12d", &pontos);
if (*message == '\0') { // No message, just show the list
clif->message(fd, "please add a value");
return false;
}
if (pontos > 0) {
if (pontos >= battle_config.training_point ) {
clif->message(fd, "The number of points can not be so high");
return false;
} // End Addition
sd->training_point += pontos;
clif->message(fd, "points acquired");
} else {
if (pontos == 0) {
clif->message(fd, "POnts can not be zero");
return false;
}
pontos*=-1;
sd->training_point -= pontos;
clif->message(fd, "points removed");
}
resultado = sd->training_point;
clif->message( fd, resultado + "/200"); // message - show points
return true;
}
And in the end, when I add the points, it shows how many points you have
Then, when doing a quest, I would use the command to add pro player points.
But apparently the logic is all wrong.
the structure is apparently not right.
Each player must have their points, and using the command I should add or subtract points.
What am I doing wrong?
Hi guys
I'm creating a system to store points for each Char.
(These points I will use in the future in the damage equation)
I'm having trouble making this variable store the points by char.
I believe my logic is wrong
Or I must be forgetting some detail.
I added with sd member
int training_point;
in pc.c (in pc_reg_received):
sd->training_point = pc_readglobalreg(sd,script->add_variable("TRAINING_POINT"));
E também
else if( !strcmp(regname,"TRAINING_POINT") && sd->training_point != val ) { val = cap_value(val, 0, battle_config->training_point); sd->training_point = val; }
following the example of die_count
I also added a config in player.conf
// Number of training points that the player can accumulate // Default: 200 | Max: 500 training_point: 200
and add in battle.c (h)
{ "training_point", &battle_config.training_point, 200, 0, 255, },
Then I created a command called @Training
to be able to add points per command
ACMD(training) { int pontos = 0; int resultado = 0; pontos = sscanf(message, "%12d", &pontos); if (*message == '\0') { // No message, just show the list clif->message(fd, "please add a value"); return false; } if (pontos > 0) { if (pontos >= battle_config.training_point ) { clif->message(fd, "The number of points can not be so high"); return false; } // End Addition sd->training_point += pontos; clif->message(fd, "points acquired"); } else { if (pontos == 0) { clif->message(fd, "POnts can not be zero"); return false; } pontos*=-1; sd->training_point -= pontos; clif->message(fd, "points removed"); } resultado = sd->training_point; clif->message( fd, resultado + "/200"); // message - show points return true; }
And in the end, when I add the points, it shows how many points you have
Then, when doing a quest, I would use the command to add pro player points.
But apparently the logic is all wrong.
the structure is apparently not right.
Each player must have their points, and using the command I should add or subtract points.
What am I doing wrong?
Share this post
Link to post
Share on other sites