by Fishytza » Fri Nov 11, 2016 6:17 pm
Spoiler: stuff that doesn't matter anymore
This confirms that Weapon classes can in fact have their own inventory
Code: Select all
Class WepWithInvTest : Shotgun
{
States
{
Spawn:
TNT1 A 1 NoDelay
{
A_GiveInventory("RocketAmmo", 22);
A_LogInt(CountInv("RocketAmmo")); //prints 22, not 0
}
Stop;
}
}
Also you called invoker.A_GiveInventory (assuming you did the exact same test on a custominventory actor instead of a weapon), so no, the countinv wouldn't be 0. Invoker means checking the custominventory's inventory. Not the player's.
??????
Are you trying to tell me this piece of code gives 6 cells to
both 'self' and 'invoker'? Is that what's happening here?
Code: Select all
invoker.A_GiveInventory("Cell", 6);
And if that's not the case then the only thing that makes sense to me is that, for Weapon classes, invoker is self. Either that or all inventory related functions are redirected to 'self' for some reason. I'm confused.
EDIT:
Code: Select all
Class CInvTest : CustomInventory
{
States
{
Pickup:
TNT1 A 0
{
invoker.A_GiveInventory("Cell", 6);
A_LogInt(invoker.CountInv("Cell"));
A_LogInt(CountInv("Cell"));
}
Stop;
}
}
Guess what, the first A_LogInt prints 6, the second prints 0. The player doesn't get the 6 Cells.
'CustomInventory' works. This is definitely a bug with 'Weapon'.
[spoiler=stuff that doesn't matter anymore]This confirms that Weapon classes can in fact have their own inventory
[code]Class WepWithInvTest : Shotgun
{
States
{
Spawn:
TNT1 A 1 NoDelay
{
A_GiveInventory("RocketAmmo", 22);
A_LogInt(CountInv("RocketAmmo")); //prints 22, not 0
}
Stop;
}
}[/code]
[quote]Also you called invoker.A_GiveInventory (assuming you did the exact same test on a custominventory actor instead of a weapon), so no, the countinv wouldn't be 0. Invoker means checking the custominventory's inventory. Not the player's.[/quote]
??????
Are you trying to tell me this piece of code gives 6 cells to [b]both[/b] 'self' and 'invoker'? Is that what's happening here?
[code] invoker.A_GiveInventory("Cell", 6);[/code]
And if that's not the case then the only thing that makes sense to me is that, for Weapon classes, invoker is self. Either that or all inventory related functions are redirected to 'self' for some reason. I'm confused.[/spoiler]
[size=120]EDIT:[/size]
[code]Class CInvTest : CustomInventory
{
States
{
Pickup:
TNT1 A 0
{
invoker.A_GiveInventory("Cell", 6);
A_LogInt(invoker.CountInv("Cell"));
A_LogInt(CountInv("Cell"));
}
Stop;
}
}[/code]
Guess what, the first A_LogInt prints 6, the second prints 0. The player doesn't get the 6 Cells.
'CustomInventory' works. This is definitely a bug with 'Weapon'.