Author Topic: Letting a player pickup an absent player's items.  (Read 861 times)

I want it so that if a player makes a brick, and sets it as an item spawn, then leaves the game. So that all players in the minigame can still pick up that item.

First I tried:
Code: [Select]
package Pickup
{
function minigamecstar fishe(%a,%b,%c)
{
return 1;
}
};
activatepackage(Pickup);
That didn't seem to do anything.

Next I tried:
Code: [Select]
package Pickup
{
function armor::onCollision(%this,%obj,%col,%thing,%other)
{
if(isObject(%obj.client))
{
if(isObject(%col))
{
if(%col.getClassName() $= "Item")
{
%slotsfree = 0;
for(%i=0; %i<5; %i++)
if(%obj.tool[%i] > 1)
%slotsfree++;
if(%slotsfree < 5)
{
%slot = 0;
for(%iq=0; %iq<5; %iq++)
{
if(!isObject(%obj.tool[%iq]))
{
%slot = %iq;
break;
}
}
%obj.tool[%slot] = %col.dataBlock.getID();
messageclient(%obj.client,'MsgItemPickup','',%slot,%col.dataBlock.getID());
%col.delete();
}
}
}
}

if(isObject(%col))
parent::oncollision(%this,%obj,%col,%thing,%other);
}
};
activatepackage(Pickup);
Players could pick up the items, but the bricks item spawn would be set to none, meaning the items would never respawn.


How can I make the player pickup the item, as to have it respawn normally?

Have you tried setting the minigame to "Use All Players' Bricks"?

First I tried:
Code: [Select]
package Pickup
{
function minigamecstar fishe(%a,%b,%c)
{
return 1;
}
};
activatepackage(Pickup);
That didn't seem to do anything.
Don't do that, ever.

Have you tried setting the minigame to "Use All Players' Bricks"?
Don't do that, ever.
I want everyone to be able to use everything, no exceptions.
So why shouldn't I?

Doing it like that does not contain it to your own minigame - it affects every other minigame on the server, too. If you're going to package minigameCstar fishe, add checks to make sure that at least one of the objects is in your minigame.

You'll have to package getMiniGameFromObject too.

Or you could just use this. (sorry for the plug, but it does what you want)