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

163 lines
3.9 KiB
Plaintext

//************************************************************/
// Copyright (c) ©2000,2001 Sony Online Entertainment Inc.
// All Rights Reserved
//
// Title: qadroid.script
// Description: Droid Deed Creation
// @author $Author: James Michener $
// @version $Revision: #1 $
//************************************************************/
/********* Includes ******************************************/
include library.utils;
/********* CONSTANTS *****************************************/
// blank droid deeds
const string[] DROID_TEMPLATE_ARRAY =
{
"object/tangible/deed/pet_deed/deed_mse_advanced_basic.iff"
};
// object variables array to be attached.
const string[] STRING_ARRAY =
{
"ai.diction", // droid_default
"creature_attribs.type" // mouse_droid_crafted
};
// objvar values to be attached.
const string[] STRING_VALUES =
{
"droid_default", // ai.diction
"mouse_droid_crafted" // creature_attribs.type
};
const string[] ATTRIB_ARRAY =
{
"combatModule", // 0
"crafting.creator.xpType", // 43
"crafting.repair_type", // 32
"creature_attribs.defenseValue", // 80
"creature_attribs.general_protection", // 6000
"creature_attribs.level", // 30
"creature_attribs.maxConstitution", // 0
"creature_attribs.maxDamage", // 205
"creature_attribs.maxHealth", // 4000
"creature_attribs.minDamage", // 135
"creature_attribs.toHitChance", // 80
"mechanism_quality", // 82
"module_data.bomb_level", // 14
"module_data.bomb_level_bonus", // 20
"pet.nonCombatDroid", // 1
};
const int[] INT_VALUES =
{
0,
43,
32,
80,
6000,
30,
0,
205,
4000,
135,
80,
82,
14,
20,
1
};
const string[] ATTRIB_DOUBLE_ARRAY =
{
// could not get double values to set in the setObjVar function, float errored out a loss of precision(7 digits)
"crafting_components.decayRate", // 46.740349
"creature_attribs.aggroBonus", // 0.000000
"creature_attribs.critChance", // 0.000000
"creature_attribs.critSave", // 0.000000
"creature_attribs.scale", // 1.000000
"creature_attribs.stateResist", // 0.000000
};
const string[] DOUBLE_VALUES =
{
"46.740349",
"0.000000",
"0.000000",
"0.000000",
"1.000000",
"0.000000"
};
const string SOURCE_SCHEMATIC = "crafting.source_schematic";
/********* Triggers ******************************************/
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
if (toLower(text).equals("qadroid") )
{
// get player inventory
obj_id inventory = utils.getInventoryContainer(player);
// get array of items in player inventory
obj_id[] invItems = getContents(inventory);
// test for room in backpack
if(invItems.length > 89)
{
// system message: no room in inventory
sendSystemMessageTestingOnly(player, "You do not have enough space for this droid.");
return SCRIPT_CONTINUE;
}
else
{
// create droid deeds listed in ITEM_ARRAY -- currently only 1 droid
for(int i = 0; i < DROID_TEMPLATE_ARRAY.length; i++)
{
obj_id newObj = createObject(DROID_TEMPLATE_ARRAY[i], inventory, "");
int SourceSchematic = 0;
// attach script to deed
attachScript (newObj, "npc.pet_deed.droid_deed");
// attach scriptvar to deed
boolean myBool = utils.setScriptVar(newObj, "crafting.creator.xp", 90);
// sendSystemMessageTestingOnly(player, ""+myBool);
// debug message - system message newObj objID
sendSystemMessageTestingOnly(player, toString(newObj));
// attach and set object variables to deed
for(int j = 0; j < STRING_ARRAY.length; j++)
{
setObjVar(newObj, STRING_ARRAY[j], STRING_VALUES[j]);
}
for(int k = 0; k < ATTRIB_ARRAY.length; k++)
{
setObjVar(newObj, ATTRIB_ARRAY[k], INT_VALUES[k]);
}
for(int m = 0; m < ATTRIB_DOUBLE_ARRAY.length; m++)
{
setObjVar(newObj, ATTRIB_DOUBLE_ARRAY[m], DOUBLE_VALUES[m]);
}
setObjVar(newObj, SOURCE_SCHEMATIC, SourceSchematic);
}
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}