Furthermore, if you really want to save resources follow these instructions...
In another module paint two barrels, make them plot and give them the tagnames, wpn_spawn & the other belt_spawn, paint a waypoint and give it the tagname spawn_way_01
Next place basic bioware standard items in the barrels, next change the items to the desired results, after that is all done, highlight the two barrels & waypoint, press Control + C, open up the module they will go into..
In an area where you want them to be (where the PC's NOR DMs cannot access them) select a space on the map and press Control + V, this will pain the barrels with the items into the module.. NO TAGNAMES ON ITEMS NEEDED...
Next you will make a script which will go in the OnOpen event of a container you create (like a Chest)
Here is the script... (I didn't know how you were planning on spawning the items you never said..)
Therefore I will make this script for the OnOpen event for ANY Placeable Ojbect (With An Inventory) you place the script in the proper OnOpen Event, note however, this is a template, since other people should be able to use it as well..
Make SURE you change the variables below to the variables I told you to use above. (at the start of this post)
//////////////////////////////////////////////////////////////////////////////
//Script Name: spawn_tres_oo
//Template script - Save Under a New Name
/////////////////////////////////////////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/17/10
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
This will be a Template Script for the OnOpen Event of a Placeable Object
You MUST Set the settings below for this to work how you want it to..
NOTE: If you set one chance to spawn treasure at 40 % and the other
chance to spawn treasure 2 at 80% then you may spawn 2 Items!
*/
///////////////////////////////////////////////////////////////////////////
//Set this to the tagname of the waypoint you will be using to reference
// the placeable objects in the module which holds the treasure..
const string WAY_PT_TAGNAME = "tagname";
//Set this to the tagname of the container which holds Treasure 1
const string TREASURE_1_TAGNAME = "tagname";
//Set this to the tagname of the container which holds Teasure 2
const string TREASURE_2_TAGNAME = "tagname";
//Set this to the % chance you want Treasure 1 to spawn.. (uses rolls of 0 or more)
const int SPAWN_TEASURE_1_CHANCE = 5; //Default = 5 (%) Chance of spawning
//0 = disabled (Always spawn it!)
//Set this to the % chance you want Treasure 2 to spawn.. (uses rolls 100 or less)
const int SPAWN_TREASURE_2_CHANCE = 20; //Default = 20 (%) Chance of Spawning
//0 = disabled (Always spawn it!)
//NOTE: This treasure will only spawn ONE TIME for EVERY PC on Every Restart
//or if the PC is playing single player (offline) and using a saved game, it will
//only spawn the treasure one time only (and never again)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////WARNING: DON'T TOUCH ANYHTING BELOW THIS LINE!!!/////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Declare Prototypes
int GetTreasureCount(object oBox);
void GetTreasure(int nInt, object oBox);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Main Script
void main()
{
object oPC = GetLastOpenedBy();
if(!GetIsPC(oPC) || GetIsDM(oPC) || GetIsDMPossessed(oPC))
{ return; }
object oWay = GetWaypointByTag(WAY_PT_TAGNAME);
object oT1 = GetNearestObjectByTag(TREASURE_1_TAGNAME,oWay);
object oT2 = GetNearestObjectByTag(TREASURE_2_TAGNAME,oWay);
int nInt, nT2C, nConv, nPercent;
int nTC1, nTC2, nTS1, nTS2;
object oS1, oS2;
nTC1 = GetTreasureCount(oT1);
nTC2 =GetTreasureCount(oT2);
nTS1 = Random(nTC1);
nTS2 = Random(nTC2);
int nChk;
nChk = GetLocalInt(oPC, GetTag(OBJECT_SELF));
if(nChk) { return; }
else { SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE); }
nConv = 100 - SPAWN_TREASURE_2_CHANCE; //Reverse the check (100 or less)
nInt = Random(99);
nT2C = Random(99);
if(nInt)
{
GetTreasure(nTS1, oT1); //Get a random item (1) from the chest..
}
if(nT2C >= nConv) //5% = 95 or higher needed on roll...
{
GetTreasure(nTS2, oT2); //Get one randome item from the 2nd treasure chest
}
//Main Script End
}
///////////////////////////////////////////////////////////////////////
//Define Prototype
int GetTreasureCount(object oBox)
{
int i = 0;
object oItem;
oItem = GetFirstItemInInventory(oBox);
while(GetIsObjectValid(oItem))
{
i +=1;
oItem = GetNextItemInInventory(oBox);
}
return i; //Tell us how many items were in the box!
//Prototype End
}
////////////////////////////////////////////////////////////////////////
//Define Prototype
void GetTreasure(int nInt, object oBox)
{
int i = 0;
object oItem;
oItem = GetFirstItemInInventory(oBox);
while(GetIsObjectValid(oItem))
{
i +=1;
if(i == nInt)
{
CopyItem(oItem, OBJECT_SELF, TRUE); //Put it in the box we are opening..
}
oItem = GetNextItemInInventory(oBox);
}
//Prototype End
}
You may want to destroy the placeable object, and respawn it later, but that would be another script request..
Modifié par Genisys, 17 août 2010 - 07:04 .