With giveinventory it's impossible to have more than one puzzleitem of a kind. When you have more than one the amount gets reset to 1 each time giveinventory is called.
I wonder why because it's no problem to pick up more than one normally.
[Fixed] GiveInventory Puzzleitems
Moderator: GZDoom Developers
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.
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.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Posts: 10002
- Joined: Fri Jul 18, 2003 6:18 pm
- Location: Idaho Falls, ID
Just to hazard a guess, I'd say this is probably intentional so that an ACS script doesn't have to check to see if the player has a particular puzzle item already before giving it to him -- it can just assume he doesn't have the item and give it to him and if he already has it, it won't give him an extra.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Deathkings has levels where you can collect more than one item of the same kind.
But you cannot do that if scripts are involved to give you the items.
And you don't think this looks right, do you?
But you cannot do that if scripts are involved to give you the items.
And you don't think this looks right, do you?
Code: Select all
for (i = 0; i < NUMARTIFACTS; ++i)
{
if (strcmp (ArtifactNames[i], type) == 0)
{
int maxCount;
if (i >= arti_firstpuzzitem)
{
maxCount = 1;
}
else if (gameinfo.gametype == GAME_Heretic)
{
maxCount = 16;
}
else
{
maxCount = 25;
}
player->inventory[i] = MIN(player->inventory[i]+amount, maxCount);
return;
}
}
-
- Posts: 10002
- Joined: Fri Jul 18, 2003 6:18 pm
- Location: Idaho Falls, ID
What's wrong with it? It appears that puzzle items are specifically singled out and restricted to only having 1 at a time, obviously an intentional change.Graf Zahl wrote:And you don't think this looks right, do you?
Does Deathkings actually behave differently than the original? If so, then this would seem to be a bug. If not, this is probably here for compatibility.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Posts: 10002
- Joined: Fri Jul 18, 2003 6:18 pm
- Location: Idaho Falls, ID
It would do the same thing in Heretic if you managed to get 20 of an item and then picked another one up which ran through the above code. 16 is less than 21, so it would "steal" 4 items from you instead of giving you 1 more. I'd say the code giving you more than 1 is the code at fault, UNLESS as you say you should be able to get more than 1, in which case the code above is very odd indeed...Graf Zahl wrote:They are not! That's the point. They are restricted to 1 only in coop when picked up but the code above restricts them to 1 all the time and what's worse it *TAKES THEM AWAY* if you already have them!
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Site Admin
- Posts: 7749
- Joined: Wed Jul 09, 2003 10:30 pm