adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Weapons and ammo


From: Kai Sterker
Subject: [Adonthell-devel] Weapons and ammo
Date: Sun, 16 Feb 2003 13:21:08 +0100

One question that came up a while ago was how to handle items (weapons)
that need ammunition. With the current item/inventory implementation,
the solution is pretty straightforward, I think:

Weapons like slings, bows and crossbows will have a pointer to a slot.
To 'load' them, you'd combine some ammunition with the weapon. The
weapon's 'combine' method would then assign the ammunition's slot to
that of the weapon. Whenever you attack with the weapon, it could launch
one of the items in its slot (after checking that they are suitable for
the weapon). 

The only problem is moving ammunition to a different slot. This would
obviously break the link between weapon and ammo. A workaround would be
the following:

The weapon also remembers the id (name) of the ammo assigned. Whenever
the slot becomes empty (either by using up the last item, or by moving
them to a different slot), the inventory could be searched for (new)
ammo with the same id. This has the advantage that the weapon will
automatically use all ammo of a certain kind, even if it is splitted
into multiple stacks.


How does that sound?

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]