Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
maggot202

item drops from monsters - can it be randomized?

Recommended Posts

Hello
Today, as i was walking my way home, i was thinking that it would be interesting if there was a way of randomizinig the item drop from the monsters, for example, a heavy weapons dude could drop a clip 60% of the time, a box of bullets 25% of the time and a green armor 15% of the time (given that you already have the chaingun. If not, the drop would be always a slightly used chaingun), but i haven't seen any "if's" or random numbers in all of the DECORATE lumps that i've taken a look at. So, it's just bad luck that i haven't run across the apropiate lumps or it can't be done?

Share this post


Link to post

I don't think you can do If statements in DECORATE. You can define multiple dropitems for a monster. He is the code I came up with for your question. I'm not too familar with Decorate, so there might be a better way. Just mess with the probabilty amounts to see what drops.

actor ChaingunGuy2: ChaingunGuy replaces ChaingunGuy
{
dropitem "Chaingun" 10
dropitem "Clip" 20
dropitem "ClipBox" 30
}

All this does is change the dropitem info for the chaingunner.

hope this helps

Share this post


Link to post

In DECORATE, dropitem probability ranges from 0 (never drop) to 255 (always drop), so multiplying the desired probability % by 2.55 (and rounding to the nearest integer) should do the trick. A quick experiment with some imps (none survived) which had an equal chance of dropping one of two items resulted in one dropping nothing, four dropping one item and one dropping both items. Hope this helps.

Share this post


Link to post

DropItem can take two integral parameters, for probability and number, as explained.

But keep in mind that (except for a few special purpose actors, like random spawners or Skulltag's invasion spawners), DropItems are independent. If you have ten DropItems each with a 10% chance of appearing, you'll sometimes see all ten being dropped, and sometimes none, as well as all the other possible results in between. There is no way to have "drop this or that, but not both and not neither" with dropitem.

You can, however, use A_Jump* instructions in a monster's death state and simulate dropitem through A_SpawnItemEx. You can even call an ACS script with ACS_Execute or ACS_ExecuteAlways.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×