Sequax
Member
- Joined
- Oct 24, 2008
- Messages
- 19
- Reaction score
- 9
Hey, been trying to figure out how to get a quiver to work on Nostalrius 7.7.
Here the git for the sources I'm using: GitHub
I've tried looking at these two tutorials but my players.cpp doesn't match. I don't have any "ammoItem".
Quiver [TFS 1.X + 0.X]
Quiver for paladins - tfs1.X
I don't know that much about coding, I usually just look at what other people have done and try to figure out the patterns, but in this case, I see none. I can find places where it says AMMO_NONE in different files just as the tutorials, but it always comes down to "ammoItem" which is missing for me.
For the record I'm not particularly interested in setting a limit as said in the first tutorial.
Any ideas? Would be much appreciated.
Here's what I've found that seems kind of similar:
player.cpp
item.cpp
combat.cpp
items.cpp
Here the git for the sources I'm using: GitHub
I've tried looking at these two tutorials but my players.cpp doesn't match. I don't have any "ammoItem".
Quiver [TFS 1.X + 0.X]
Quiver for paladins - tfs1.X
I don't know that much about coding, I usually just look at what other people have done and try to figure out the patterns, but in this case, I see none. I can find places where it says AMMO_NONE in different files just as the tutorials, but it always comes down to "ammoItem" which is missing for me.
For the record I'm not particularly interested in setting a limit as said in the first tutorial.
Any ideas? Would be much appreciated.
Here's what I've found that seems kind of similar:
player.cpp
C++:
Item* Player::getAmmunition() const
{
return inventory[CONST_SLOT_AMMO];
}
item.cpp
C++:
} else if (it.weaponType != WEAPON_NONE) {
if (it.weaponType == WEAPON_DISTANCE && it.ammoType != AMMO_NONE) {
if (it.attack != 0) {
s << ", Atk" << std::showpos << it.attack << std::noshowpos;
}
} else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND && (it.attack != 0 || it.defense != 0)) {
s << " (";
if (it.attack != 0) {
s << "Atk:" << static_cast<int>(it.attack);
}
if (it.defense != 0) {
if (it.attack != 0)
s << " ";
combat.cpp
C++:
if (weapon->getWeaponType() == WEAPON_DISTANCE) {
ammunition = player->getAmmunition();
if (weapon->getAmmoType() != AMMO_NONE) {
if (!ammunition || weapon->getAmmoType() != ammunition->getAmmoType()) {
// redirect to fist fighting
return closeAttack(attacker, target, fightMode);
}
C++:
if (weapon->getAmmoType() != AMMO_NONE) {
Item* ammunition = player->getAmmunition();
if (ammunition && ammunition->getAmmoType() == weapon->getAmmoType()) {
attackValue += ammunition->getAttack();
}
}
C++:
if (ammunition && weapon->getAmmoType() != AMMO_NONE && weapon->getAmmoType() == ammunition->getAmmoType()) {
hitChance = 90; // bows and crossbows
specialEffect = ammunition->getWeaponSpecialEffect();
attackStrength = ammunition->getAttackStrength();
attackVariation = ammunition->getAttackVariation();
if (normal_random(0, 100) <= ammunition->getFragility()) {
uint16_t count = ammunition->getItemCount();
if (count > 1) {
g_game.transformItem(ammunition, ammunition->getID(), count - 1);
} else {
g_game.internalRemoveItem(ammunition);
}
}
moveWeapon = false;
}
items.cpp
C++:
items[id].ammoType = getAmmoType(script.readIdentifier());
if (items[id].ammoType == AMMO_NONE) {
script.error("Unknown ammo type");
return false;