Need help with item pickup thats inaccessible by player

Discuss all aspects related to modding Zandronum here.
Post Reply
Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

Need help with item pickup thats inaccessible by player

#1

Post by Lollipop » Fri Aug 03, 2012 1:43 pm

* I need to make a pickup that is intended to act as a marker in the iventory
* I need to know if it is possible to make is possible only for some classes to pick up some pickups? and is it then possible to determine how many of that pickup the classes can have?
Spoiler: fail code so far (Open)
Actor rock : custominventory
{
Inventory.PickupMessage "A rock, actually quite usefull"
inventory.pickupsound "misc/p_pkup"
States
{
Spawn:
ROK3 A -1
Stop
Pickup:
TNT1 A 0 A_giveinventory ("Rock", 1)
Stop
}
}
the problem is that then I pick it up the game crashes now, even though there "stop" in the pickup command.
I fixed the problem with the image not showing up with adding S_START and S_END markers in the right places, S_START above the image and S_ENd below with nothing else in between.
Last edited by Lollipop on Tue Aug 07, 2012 7:48 am, edited 1 time in total.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

ninja2000
 
Posts: 25
Joined: Fri Aug 03, 2012 3:10 pm

RE: Need help with item pickup thats inaccessible by player

#2

Post by ninja2000 » Fri Aug 03, 2012 6:57 pm

Class 1 <- Cant pick up
Class 2 <- Can

The item to pick is an rock spawner that after picking up will spawn the rock in the inventory... if Class 1 will try to pick up the spawner there will be (if class = 2 -> perform pick up).

Neewbie
Forum Regular
Posts: 140
Joined: Sat Jun 23, 2012 11:10 am

RE: Need help with item pickup thats inaccessible by player

#3

Post by Neewbie » Fri Aug 03, 2012 7:12 pm

Actor rock : custominventory
{
Inventory.ForbiddenTo "YOURGODDAMNCLASSHERE"
Inventory.PickupMessage "A rock, actually quite usefull"
inventory.pickupsound "misc/p_pkup"
States
{
Spawn:
ROK3 A -1
Stop
Pickup:
TNT1 A 0 A_giveinventory ("Rock", 1)
Stop
}
}

There it shouldn't crash anymore xD
Last edited by Neewbie on Fri Aug 03, 2012 7:18 pm, edited 1 time in total.

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: Need help with item pickup thats inaccessible by player

#4

Post by Lollipop » Sun Aug 05, 2012 7:03 pm

well, then I spawn it into the map it dont have any prite at all, and then I actually pick it up the game crashes -.-
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

User avatar
Combinebobnt
Retired Staff / Community Team Member
Posts: 1906
Joined: Mon Jun 04, 2012 3:37 am
Location: Earth
Contact:

RE: Need help with item pickup thats inaccessible by player

#5

Post by Combinebobnt » Sun Aug 05, 2012 7:09 pm

When you pickup rock, it gives you rock again, which will continue to give you itself forever. This infinite loop will cause the game to crash.

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: Need help with item pickup thats inaccessible by player

#6

Post by Lollipop » Thu Aug 09, 2012 9:56 am

I have changed the code to what neewbie have told, but it wont work even with the stop command -.\\
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Need help with item pickup thats inaccessible by player

#7

Post by Llewellyn » Thu Aug 09, 2012 9:10 pm

Try this:

Code: Select all


Actor rockPickup: customInventory
{
	Inventory.forbiddenTo "YOURGODDAMNCLASSHERE"
	Inventory.pickupMessage "You collected a rock."
	inventory.pickupSound "misc/p_pkup"
	Inventory.Amount 1
   	Inventory.MaxAmount 10
	States
	{
	Spawn:
		ROK3 A -1
		Stop
	Pickup:
		TNT1 A 0 A_Print("PickedUp")
		Stop
	}
}
Last edited by Llewellyn on Fri Aug 10, 2012 11:16 pm, edited 1 time in total.

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: Need help with item pickup thats inaccessible by player

#8

Post by Lollipop » Fri Aug 10, 2012 4:12 pm

Ill try that next time I get access to the data

EDIT: LOOOOL! now I cant pick it up at all XD
Last edited by Lollipop on Fri Aug 10, 2012 4:59 pm, edited 1 time in total.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Need help with item pickup thats inaccessible by player

#9

Post by Llewellyn » Fri Aug 10, 2012 11:18 pm

I edited it, I assumed you were going to put something in the Pickup state, because if you don't then it doesn't pick up.

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: Need help with item pickup thats inaccessible by player

#10

Post by Lollipop » Sun Aug 12, 2012 8:53 am

so now it prints the pickup message, does that mean it works? I mean do I have it in my inventory so I can accesss it ith an ACS script?
this is really important information as its vital for my project that I can access it in such a way.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Need help with item pickup thats inaccessible by player

#11

Post by Llewellyn » Sun Aug 12, 2012 6:41 pm

Lollipop wrote: so now it prints the pickup message, does that mean it works? I mean do I have it in my inventory so I can accesss it ith an ACS script?
this is really important information as its vital for my project that I can access it in such a way.
Try the PrintINV console command.

Bloax
Forum Regular
Posts: 411
Joined: Mon Jun 04, 2012 5:11 pm

RE: Need help with item pickup thats inaccessible by player

#12

Post by Bloax » Sun Aug 12, 2012 7:27 pm

By the way, CustomInventory is not a good base actor to use.

I can't remember exactly why, but it's something about it being mostly for inventory-only items. (And gained by being given by the appropriate base actor for items, Inventory.)

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Need help with item pickup thats inaccessible by player

#13

Post by Llewellyn » Mon Aug 13, 2012 12:20 am

Bloax wrote: By the way, CustomInventory is not a good base actor to use.

I can't remember exactly why, but it's something about it being mostly for inventory-only items. (And gained by being given by the appropriate base actor for items, Inventory.)
Probably something about only being able to keep one of them across mapchange.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Need help with item pickup thats inaccessible by player

#14

Post by Ijon Tichy » Mon Aug 13, 2012 4:40 am

no, that applies to all inventories

there have been problems repeatedly with using a custominventory as a counter
just use a normal Inventory if inventory.restrictedto is in

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: Need help with item pickup thats inaccessible by player

#15

Post by Lollipop » Mon Aug 13, 2012 8:30 am

so forget custominventory and use the inventory actor that custominventory inhertitages from anyway? I also wanna ask if inventory.restrictedto can have multiple classes in it? like:
can have: miner, adv miner (just as scetch)
cannot have: swordsman, archer, pikeman

I also want to know if adding a spawn number works like if I would add a spawn number to a monster?

EDIT: I would also like to know how to spawn an item by its name, would be much easyer than useing spawn numbers, and i think ill run out of numbers also, so i have made this script

#include "zcommon.acs" //I allways include this

script 1 (void)
{
thing_spawn(1, "rockpickup", 0, 0);
}

I hope for help :(

NOTE: I wish to announce that I do know how to spawn it now, I do want to have several actors allowed to pick it up.
Last edited by Lollipop on Fri Jan 18, 2013 3:18 pm, edited 1 time in total.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Post Reply