[solution found] Giving multiple Custominventory items

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [solution found] Giving multiple Custominventory items

Re: [r3334] A_Giveinventory Custom inventory bug

by cypherphage » Tue May 08, 2012 10:27 pm

Muwhaha, I figured out a way to do this!

Code: Select all

Actor superFlask : CustomInventory
{	
+INVENTORY.HUBPOWER
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
+INVENTORY.INVBAR
	 INVENTORY.MaxAmount 100
states { Spawn:
PTN2 ABC 4
loop
use:
TNT1 A 0 A_GiveInventory ("doubleFlask", 1)
stop
}}

Actor doubleFlask : CustomInventory
{ +INVENTORY.ALWAYSPICKUP
states { 
Pickup:
TNT1 A 0 A_GiveInventory ("ArtiPoisonBag", 1)
TNT1 A 0 A_GiveInventory ("ArtiHealth", 1)
TNT1 A 0 A_TakeInventory ("superFlask", 1)
TNT1 A 0 a_jumpifinventory("superFlask",1,"pickup")
stop }}

// try giving yourself this, you'll now get 10 of both items meaning this works
Actor superFlaskTest : CustomInventory
{states { Spawn:
PTN2 ABC 4
loop
pickup:
TNT1 A 0 A_GiveInventory ("superFlask", 10)
stop
}}
this both allows for the giving of a bunch of stuff at once, and also allows for the awesome sauce that is a looped custominvnetory function. For instance, if you wanted to do some complex action 3 times, give three custominventories set up this way...which is sort of horribly ugly hack but is IMO cool beyond words :).

Re: [r3334] A_Giveinventory Custom inventory bug

by Major Cooke » Sun Mar 04, 2012 9:34 am

For one, you're far better off having the superflask give 30 artihealth instead of three doubleflasks.

And if you're wanting to give multiple of said item, as already stated, you would use A_GiveInventory("Item",3)

Re: [r3334] A_Giveinventory Custom inventory bug

by cypherphage » Sat Feb 25, 2012 9:02 am

Well, I suppose after a little thinking about it, custominventory working that way makes sense given that it can do more than just give items. Sorry Graf, I was trying to use custominventory to be able to give X copies of items in the item. Oh well.

Re: [r3334] A_Giveinventory Custom inventory bug

by Graf Zahl » Wed Feb 22, 2012 5:37 pm

I think the advice here should be clear:

Do not use CustomInventory items for tasks that can be achieved by other means. In the end they are merely a hack and have some limitations.

Furthermore, A_GiveInventory("item", count) doesn't give you 'count' items. It gives you one item with an itemcount setting of 'count' so obviously the pickup state only gets called once.
Can't say much about your last attempt yet, except that you better learn to use the proper features to do what you want.

Re: [r3334] A_Giveinventory Custom inventory bug

by cypherphage » Tue Feb 21, 2012 9:54 pm

Code: Select all

Actor superFlask : CustomInventory
{
  +INVENTORY.ALWAYSPICKUP
  +INVENTORY.INVBAR
  states
  {
  Spawn:
	PTN2 ABC 4
	loop
  Use://Pickup:
    TNT1 A 0 A_GiveInventory ("doubleFlask")
	TNT1 A 0 A_GiveInventory ("doubleFlask")
	TNT1 A 0 A_GiveInventory ("doubleFlask")
    stop
  }
}

Actor doubleFlask : CustomInventory
{
  +INVENTORY.ALWAYSPICKUP
  INVENTORY.MaxAmount 1
  +INVENTORY.AUTOACTIVATE
  states
  {
  Spawn:
	PTN2 ABC 4
	loop
  Use://Pickup:
    TNT1 A 0 A_GiveInventory ("ArtiHealth", 10)
    stop
  }
}
Given that this doesn't work, the problem seems to be with receiving more than 1 cutominventory at a time, no matter how they are given. Hell, using the console to give the player multiple "doubleflasks" directly didn't work.

Re: [r3334] A_Giveinventory Custom inventory bug

by NeuralStunner » Tue Feb 21, 2012 4:24 pm

I've only had this happen wen the item has a Pickup state. This might be for a good reason.

I haven't tried this yet, but what about changing Pickup to Use, and flagging the items [wiki=Actor_flags#INVENTORY.AUTOACTIVATE]INVENTORY.AUTOACTIVATE[/wiki]?

Also, you really shouldn't collapse your code like that. It's especially hard to read.

Re: [r3334] A_Giveinventory Custom inventory bug

by cypherphage » Tue Feb 21, 2012 6:43 am

So...is this fixable? It is very annoying.

[solution found] Giving multiple Custominventory items

by cypherphage » Sat Jan 21, 2012 1:38 pm

For some reason, when the player receives more than 1 of a custom inventory, only one of them has any effect. Here is a simple example:
Spoiler:
this bug happens in r3334, and I am really hoping for a fix. Also, i tested whether increasing maxAmount had any effect, it didn't and this bug also happens with the console's give command.Ideas?


edit: a solution was found.
Attachments
customInvtest.wad
(783 Bytes) Downloaded 36 times

Top