Files
dsrc/sku.0/sys.server/compiled/game/script/test/create_weapon.script
T
2013-09-10 23:17:15 -07:00

65 lines
1.5 KiB
Plaintext

/**
* Copyright (c) ©2000-2002 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: test_crafting_base_weapon.script
* Description: base crafting script used by all weapons
* @author $Author: Reece Thornton & Friends$
* @version $Revision: 0$
*/
/**
* Include Libraries
*/
// include anyLibrary; /** a .scriptlib file */
include library.utils;
include library.craftinglib;
include library.weapons;
void makeResource(obj_id self, string rclass)
{
obj_id[] rtypes = getResourceTypes(rclass);
sendSystemMessageTestingOnly(self, "Types are..." + rtypes[0].toString());
obj_id rtype = rtypes[0];
if(!isIdValid(rtype))
{
sendSystemMessageTestingOnly(self, "No id found");
sendSystemMessageTestingOnly(self, "Type was "+rclass);
return;
}
string crateTemplate = getResourceContainerForType(rtype);
if ( !crateTemplate.equals("") )
{
obj_id pInv = utils.getInventoryContainer(self);
if ( isIdValid(pInv) )
{
obj_id crate = createObject(crateTemplate, pInv, "");
if ( addResourceToContainer (crate, rtype, 100000, self) )
{
sendSystemMessageTestingOnly(self, "Resource of class "+rclass+" added");
}
}
}
}
trigger OnSpeaking(string strText)
{
string[] strCommands = split(strText, ' ' );
if (strCommands[0]=="cwep")
{
obj_id pInv = utils.getInventoryContainer(self);
string type = "all";
if(strCommands.length > 1)
{
type = strCommands[1];
}
weapons.createOneOfEach(type, pInv, weapons.VIA_TEMPLATE, 1.0f);
}
return SCRIPT_CONTINUE;
}