Aller au contenu

Photo

object_smash_loot


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Alupinu

Alupinu
  • Members
  • 528 messages
Does anybody have a real *simple* loot_object script? Maybe something that works on a D6 or D8 conditional. (Player breaks object and 1of6 items appears.)

#2
Dann-J

Dann-J
  • Members
  • 3 161 messages
Here's a quick OnDeath script off the top of my head. Replace resref1, resref2, etc with actual item resrefs.

--

void main()
{
int iRandom = Random(6);
string sItem;

switch(iRandom)
{
case 0:
sItem = "resref1";
break;

case 1:
sItem = "resref2";
break;

case 2:
sItem = "resref3";
break;

case 3:
sItem = "resref4";
break;

case 4:
sItem = "resref5";
break;

case 5:
sItem = "resref6";
break;
}

CreateItemOnObject(sItem,OBJECT_SELF,1,"",0);
}

Modifié par DannJ, 13 décembre 2010 - 11:49 .


#3
Alupinu

Alupinu
  • Members
  • 528 messages
Cool... Thank you DannJ I think this is just what I was looking for, nice and simple. :)

#4
Dann-J

Dann-J
  • Members
  • 3 161 messages
On second thoughts, that might only work for placeables that have inventories.

Instead of CreateItemOnObject, you might want to replace it with:

location lLoc = GetLocation(OBJECT_SELF);
CreateObject(OBJECT_TYPE_ITEM, sItem, lLoc, FALSE);

That's what happens when you code off the top of your head, and don't test it. Image IPB

Modifié par DannJ, 14 décembre 2010 - 09:51 .


#5
Alupinu

Alupinu
  • Members
  • 528 messages
Well if I could vote I would give you a 10, DannJ! After your last update the script works perfectly. Thanks again! :D