Jump to content

Home

how do i loop this script?


Nirran

Recommended Posts

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);
	}
}

Link to comment
Share on other sites

Something like this maybe? Note the new while block has a closing }

 

object oContainer = OBJECT_SELF;
int numberOfItems = 1;

[color=palegreen]int nMinimum = 1;[/color]

if(!GetLocalBoolean(oContainer, 159)){
SetLocalBoolean(oContainer,159,TRUE);
       [color=palegreen]while (nMinimum>0) {[/color]
	if(Random(100) < 10){
		GetCustomItemLightColor(oContainer);
                       [color=palegreen]nMinimum--;[/color]
	}
	if(Random(100) < 10){
		GetCustomItemCustom(oContainer);
                       [color=palegreen]nMinimum--;[/color]
	}
	if(Random(100) < 10){
		PlaceTreasureJedi(oContainer, numberOfItems);
                       [color=palegreen]nMinimum -= numberOfItems;[/color]
	}
	if(Random(100) < 25){
		GetCustomItemDisposable(oContainer);
                       [color=palegreen]nMinimum--;[/color]
	}
	if(Random(100) < 25){
		PlaceTreasure(oContainer, numberOfItems, 0);
                       [color=palegreen]nMinimum -= numberOfItems;[/color]
	}
	if(Random(100) < 25){
		PlaceTreasureDroid(oContainer, numberOfItems, 0);
                       [color=palegreen]nMinimum -= numberOfItems;[/color]
	}
	if(Random(100) < 50){
		GetCustomItemTraps(oContainer);
                       [color=palegreen]nMinimum--;[/color]
	}
	if(Random(100) < 50){
		GetCustomItemGrenade(oContainer);
                       [color=palegreen]nMinimum--;[/color]
	}
[color=palegreen]}[/color]
  }

I assumed the functions like PlaceTreasure are guaranteed to place numberOfItems...

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...