Nightrise last edited by
I was looking at some code pertaining to weapons and was wondering how/where inventory is handled. By this I mean the replenishing of ammo (i.e. for crossbows) and the acquiring of weapons. Is this handled in an inventory manner, or is this very closely tied to the class of character? It would be cool to be able to pick up/equip weapons, or drop existing weapons.
NabsterHax last edited by
Weapons aren’t tied to a certain class, though you will have to be careful giving certain classes weapons they don’t normally get because certain classes won’t have animation sets for certain weapons. For example, only the archer class has the animation sets for bows and crossbows.
I believe there is a fixed “size” inventory with primary, secondary and tertiary slot (I think 4th is always fists). I’m pretty sure you can put whatever you want in those (e.g. you can give a knight 3 primaries). Best thing to do is experiment. If you want a start point, I suggest looking for the function SetWeapons() in the AOCPlayerController class (I think it’s that one…).
Nightrise last edited by
Thanks for the reply and the pointers NabsterHax! I’ll definitely take a look at SetWeapons(). With a little luck, it’s possible to extend the inventory to something a bit more fully featured, and add some custom UI :).
Cthulhu last edited by
The method you are looking for replenishing ammo is AOCInventoryManager.ReplenishAllAmmo().
Also when selecting a weapon from the menu, it will look whether it’s a valid weapon for your class from its FamilyInfo.
NewPrimaryWeapons(0)=(CWeapon=class'AOCWeapon_DoubleAxe',CheckLimitExpGroup=EEXP_2HAXE,UnlockExpLevel=0.f) NewPrimaryWeapons(1)=(CWeapon=class'AOCWeapon_PoleAxe',CheckLimitExpGroup=EEXP_2HAXE,UnlockExpLevel=25.f) NewPrimaryWeapons(2)=(CWeapon=class'AOCWeapon_Bearded',CheckLimitExpGroup=EEXP_2HAXE,UnlockExpLevel=100.f) NewPrimaryWeapons(3)=(CWeapon=class'AOCWeapon_WarHammer',CheckLimitExpGroup=EEXP_HEAVYBLUNT,UnlockExpLevel=0.f) NewPrimaryWeapons(4)=(CWeapon=class'AOCWeapon_Maul',CheckLimitExpGroup=EEXP_HEAVYBLUNT,UnlockExpLevel=25.f) NewPrimaryWeapons(5)=(CWeapon=class'AOCWeapon_GrandMace',CheckLimitExpGroup=EEXP_HEAVYBLUNT,UnlockExpLevel=100.f) NewPrimaryWeapons(6)=(CWeapon=class'AOCWeapon_Longsword',CheckLimitExpGroup=EEXP_BASTARD,UnlockExpLevel=0.f) NewPrimaryWeapons(7)=(CWeapon=class'AOCWeapon_SwordOfWar',CheckLimitExpGroup=EEXP_BASTARD,UnlockExpLevel=25.f) NewPrimaryWeapons(8)=(CWeapon=class'AOCWeapon_Messer',CheckLimitExpGroup=EEXP_BASTARD,UnlockExpLevel=100.f) NewPrimaryWeapons(9)=(CWeapon=class'AOCWeapon_Flail',CForceTertiary=(class'AOCWeapon_Buckler'),CheckLimitExpGroup=EEXP_FLAIL,UnlockExpLevel=0.f) NewPrimaryWeapons(10)=(CWeapon=class'AOCWeapon_HFlail',CForceTertiary=(class'AOCWeapon_Buckler'),CheckLimitExpGroup=EEXP_FLAIL,UnlockExpLevel=0.f)
This is for Knight.
The method AOCPlayerController.AreWeaponsValidForCurrentFamilyInfo() is what check for those, and if it returns false, it will load a default weapon for your specific class.
Recently I had to subclass it to allow Vanguards to run without tertiaries.
Extending your inventory is possible, though, you will have a lot of work subclassing everything. And i mean it, you will be copy+pasting and rewritting a lot of code.
As for the UI, changing what is already there is doable with the SDK, the problem is when you need to add new stuff to it. You will have to handle flash to add any new stuff to the HUD, and I’m not sure whether you can cook your own flash elements into your mod.