Loading...
 

PogamutUT2004


Adding weapons and ammunition

Hi,

I'm using Pogamut 3.0.9 and I'm trying to add some weapons and ammo for test my bots.

I read the javadoc and I use addInventory method in different methods (botSpawned and logic) but it don't work. I think is my code problem...

-botSpawned (I want my bot start with some weapons):
getAct().act(new AddInventory().setType(ItemType.ROCKET_LAUNCHER.toString()));

-logic (I want some times to reload my weapon)
Weapon armaWeapon = this.weaponry.getCurrentWeapon();
WeaponDescriptor armaWeaponDescriptor = armaWeapon.getDescriptor();
ItemType municionItemType = armaWeaponDescriptor.getPriAmmoItemType();
ItemDescriptor municionItemDescriptor = this.descriptors.getDescriptor(municionItemType);
getAct().act(new AddInventory().setType(armaWeapon.getDescriptor().getInventoryType()));
getAct().act(new AddInventory().setType(municionItemType.toString()));

How must I do that?

I read in javadoc too that I must config the botAPI.ini file with bAllowCheats = True, but I'm not sure doing that well. I didn't find botAPI.ini file, there are a BotAPI folder with make.ini file. Just now I found GameBot2004.ini file, this file have bAllowCheats = True. May you confirm me what file is it?

Thanks
Hi! There is a bug in the documentation.

It is not BotAPI.ini ... it was refactored into GameBots2004.ini,
you can find that file inside .../UT2004/System directory.

Try that!

Cheers!

Jakub
Woah, you're really fast :-)

I supposed that but that file was that property configured like Documentation said, so I think I have a problem with my code. Can you help me? I think that I'm using a wrong string in setType:
new AddInventory().setType(municionItemType.toString())

Thanks again

Frank
Ok, so the cheats are enabled, good.

These strings are known to work:

getAct().act(new AddInventory().setType("XWeapons.FlakCannonPickup"));
getAct().act(new AddInventory().setType("XWeapons.FlakAmmoPickup"));

As you can see, we're using only the "name" of the item. Actualy, ItemType is serializing a lot of stuff into one string:
Here is a code of ItemType.toString()

public String toString() {
return "ItemTypename = %22 + name + %22, category = %22 + category + %22, group = %22 + group + %22";
}

What you seek is that 'name' property.

Try:
new AddInventory().setType(municionItemType.getName())

If that is not working, try to log, what the 'getName()' is returing to you (post it here please).
Alternatively, you may see the source code of the ItemType and obtain these names manually.

Cheers!

Jimmy
Hi,

I was probing your advices and it works with the strings and with getName() (it returns these strings). But only work some weapons:

"XWeapons.AssaultRiflePickup" - ItemType.ASSAULT_RIFLE

"XWeapons.FlakCannonPickup" - ItemType.FLAK_CANNON

"XWeapons.LinkGunPickup" - ItemType.LINK_GUN

"XWeapons.MiniGunPickup" - ItemType.MINIGUN

"XWeapons.ShockRiflePickup" - ItemType.SHOCK_RIFLE

I wanted to use Rocket_Launcher (for dodge propouse) but it don't work.

Ammo work too in same way, but I was changing pogamut version and now I can't see it again. I was debbuging and logging and sometimes variable weaponry is inconsistence between ammo and primaryAmmo in WeaponsById. (now I can't reproduce it, i will reinstall to tray it again)

Thanks
More information about weapon classes here: UT2004 objects. If you want to add some weapon use ADDINV command and support the pickup class of the object you want to add.

Best,
michal
Hi,

I'm using v.3.0.11 and I'm trying again to reaload my weapons (FlakCannon). Like I said in my last post, I think there are a inconsistente in weaponry class, I saw that bot uses weaponry-ammo to shoot but when bot reload it use weaponry-weaponsById. ¿Is it a bug? ¿or I'm not understanding weaponry? I think that was working in a older version but I'm not sure

I've debuged verion 3.0.11. and I have next conclusions:
-Bots only shoot if it has ammo in weaponry-ammo
-If I use addInventory with ammoPickup, weaponry increase his ammo in weaponry-weaponsById but not in weaponry-ammo (so I can't really reload and finally my bot stop shooting)
-If I use addInventory with weaponPickup, weaponry increase his ammo in weaponry-ammo but weaponry-weaponsById set his ammo to 0 (with that method my bot can shoot again)


-If I try to reload AssaultRifle, it launch next exception:
(ReloadBotIC) SEVERE 22:10:51.945 Fatal error in WorldView161: Exception raising event InfoMessageItemPickedUp | Id = WorldObjectIdDM-Trainingday.AssaultAmmoPickupid1861 | InventoryId = WorldObjectIdDM-Trainingday.GrenadeAmmo | Location = 2150.20; -1430.80; -79.15 | Amount = 4 | AmountSec = 0 | Type = ItemTypename = XWeapons.AssaultAmmoPickup, category = AMMO, group = ASSAULT_RIFLE | Dropped = true |
(ReloadBotIC) SEVERE 22:10:51.964 Fatal error happenned - component bus is stopping.
FatalErrorEvent[
Component=UT2004SyncLockableWorldView
Message=Exception raising event InfoMessageItemPickedUp | Id = WorldObjectIdDM-Trainingday.AssaultAmmoPickupid1861 | InventoryId = WorldObjectIdDM-Trainingday.GrenadeAmmo | Location = 2150.20; -1430.80; -79.15 | Amount = 4 | AmountSec = 0 | Type = ItemTypename = XWeapons.AssaultAmmoPickup, category = AMMO, group = ASSAULT_RIFLE | Dropped = true |
Cause=java.lang.NullPointerException
Cause stacktrace:
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry$Ammunition.itemPickedUp(Weaponry.java:614)
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry$ItemPickedUpListener.notify(Weaponry.java:845)
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry$ItemPickedUpListener.notify(Weaponry.java:840)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView$ListenerNotifier.notify(AbstractWorldView.java:98)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView$ListenerNotifier.notify(AbstractWorldView.java:77)
cz.cuni.amis.utils.listener.Listeners.notify(Listeners.java:252)
cz.cuni.amis.utils.listener.ListenersMap.notify(ListenersMap.java:76)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView.notifyLevelAListeners(AbstractWorldView.java:629)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView.innerRaiseEvent(AbstractWorldView.java:700)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView.raiseEvent(AbstractWorldView.java:604)
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView.raiseEvent(EventDrivenWorldView.java:102)
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView.innerNotify(EventDrivenWorldView.java:126)
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView.notify(EventDrivenWorldView.java:223)
cz.cuni.amis.pogamut.base3d.worldview.impl.BatchAwareWorldView.notify(BatchAwareWorldView.java:83)
cz.cuni.amis.pogamut.ut2004.communication.worldview.UT2004SyncLockableWorldView.processBatch(UT2004SyncLockableWorldView.java:206)
cz.cuni.amis.pogamut.ut2004.communication.worldview.UT2004SyncLockableWorldView.processBatches(UT2004SyncLockableWorldView.java:189)
cz.cuni.amis.pogamut.ut2004.communication.worldview.UT2004SyncLockableWorldView.unlock(UT2004SyncLockableWorldView.java:166)
cz.cuni.amis.pogamut.ut2004.agent.module.logic.SyncUT2004BotLogic.afterLogic(SyncUT2004BotLogic.java:70)
cz.cuni.amis.pogamut.base.agent.module.LogicModule$LogicRunner.run(LogicModule.java:391)
java.lang.Thread.run(Thread.java:619)

Thanks

Frank
Thanks for the bug report. It is true that weapon and ammo are a little bit tricky and weaponry class is not yet 100% reliable. I'll look into this today.

best,
michal
 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.