Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

how do i loop this script?

Page: 1 of 1
 Nirran
08-08-2008, 7:00 PM
#1
want to make sure at least one item drops,each if statement is one item

object oContainer = OBJECT_SELF;
int numberOfItems = 1;

if(!GetLocalBoolean(oContainer, 159)){
SetLocalBoolean(oContainer,159,TRUE);

if(Random(100) < 10){
GetCustomItemLightColor(oContainer);
}
if(Random(100) < 10){
GetCustomItemCustom(oContainer);
}
if(Random(100) < 10){
PlaceTreasureJedi(oContainer, numberOfItems);
}
if(Random(100) < 25){
GetCustomItemDisposable(oContainer);
}
if(Random(100) < 25){
PlaceTreasure(oContainer, numberOfItems, 0);
}
if(Random(100) < 25){
PlaceTreasureDroid(oContainer, numberOfItems, 0);
}
if(Random(100) < 50){
GetCustomItemTraps(oContainer);
}
if(Random(100) < 50){
GetCustomItemGrenade(oContainer);
}
}
 tk102
08-08-2008, 8:10 PM
#2
Something like this maybe? Note the new while block has a closing }

object oContainer = OBJECT_SELF;
int numberOfItems = 1;

int nMinimum = 1;

if(!GetLocalBoolean(oContainer, 159)){
SetLocalBoolean(oContainer,159,TRUE);
while (nMinimum>0) {
if(Random(100) < 10){
GetCustomItemLightColor(oContainer);
nMinimum--;
}
if(Random(100) < 10){
GetCustomItemCustom(oContainer);
nMinimum--;
}
if(Random(100) < 10){
PlaceTreasureJedi(oContainer, numberOfItems);
nMinimum -= numberOfItems;
}
if(Random(100) < 25){
GetCustomItemDisposable(oContainer);
nMinimum--;
}
if(Random(100) < 25){
PlaceTreasure(oContainer, numberOfItems, 0);
nMinimum -= numberOfItems;
}
if(Random(100) < 25){
PlaceTreasureDroid(oContainer, numberOfItems, 0);
nMinimum -= numberOfItems;
}
if(Random(100) < 50){
GetCustomItemTraps(oContainer);
nMinimum--;
}
if(Random(100) < 50){
GetCustomItemGrenade(oContainer);
nMinimum--;
}
}
}
I assumed the functions like PlaceTreasure are guaranteed to place numberOfItems...
 Nirran
08-08-2008, 8:23 PM
#3
yea they are garenteed but the if(random ect is the conditional before the function is called,i wanta keep the loot random but make sure 1 is dropped,i tried something similar to this last night and the game seems to only want one item,donno :shrug:
 Nirran
08-08-2008, 8:30 PM
#4
ok tried that with minimum set to 5 and it had loot in every chest but most of them had 1 item :shrug:
 Nirran
08-09-2008, 4:23 AM
#5
got it working,changed my functions to have a number of items parameter,thnx for ur help
Page: 1 of 1