Hi, in this link otland/forgottenserver
you can see the function I need help with (just some explanation).
There are 3 if statements that are important to me but I am just curious about 1
The first one will execute once you deselect the target by yourself. The third one will execute if you cannot select the target, in this case that could be an NPC. But I am not sure about the second one as I couldn't really print anything to the console
this one here:
If anyone could provide me with some info that would be great
you can see the function I need help with (just some explanation).
There are 3 if statements that are important to me but I am just curious about 1
The first one will execute once you deselect the target by yourself. The third one will execute if you cannot select the target, in this case that could be an NPC. But I am not sure about the second one as I couldn't really print anything to the console
this one here:
C++:
Creature* attackCreature = getCreatureByID(creatureId);
if (!attackCreature) {
If anyone could provide me with some info that would be great
C++:
if (player->getAttackedCreature() && creatureId == 0) {
player->setAttackedCreature(nullptr);
player->sendCancelTarget();
return;
}
Creature* attackCreature = getCreatureByID(creatureId);
if (!attackCreature) {
player->setAttackedCreature(nullptr);
player->sendCancelTarget();
return;
}
ReturnValue ret = Combat::canTargetCreature(player, attackCreature);
if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret);
player->sendCancelTarget();
player->setAttackedCreature(nullptr);
return;
}