82 lines
2.8 KiB
Plaintext
82 lines
2.8 KiB
Plaintext
//mod_activate
|
|
// ** This script goes in the OnItemActivation event of your Module
|
|
|
|
void chkloc(object PC, object mat, string ref)
|
|
{
|
|
if(!GetIsObjectValid(PC)) {
|
|
DestroyObject(mat); // destroy if they leave
|
|
} else if (GetLocalLocation(PC, "loc") != GetLocation(PC)) {
|
|
CreateItemOnObject(ref, PC, 1);
|
|
DestroyObject(mat);
|
|
} else {
|
|
DelayCommand(4.0, chkloc(PC, mat, ref));
|
|
}
|
|
|
|
}
|
|
|
|
void SetLoc(object PC)
|
|
{
|
|
SetLocalLocation(PC, "loc", GetLocation(PC));
|
|
}
|
|
|
|
void matsit(object PC)
|
|
{
|
|
location loc = GetLocation(PC);
|
|
object area = GetAreaFromLocation(loc);
|
|
vector pos = GetPositionFromLocation(loc);
|
|
loc = Location(area, pos, GetFacingFromLocation(loc) + 90.0);
|
|
object mat = CreateObject(OBJECT_TYPE_PLACEABLE, "placeablemat", loc);
|
|
AssignCommand(PC, ClearAllActions(TRUE));
|
|
// AssignCommand(PC, ActionMoveToObject(mat, FALSE, 0.0));
|
|
// float dir = GetFacing(mat);
|
|
// AssignCommand(PC, SetFacing(dir-90.0));
|
|
AssignCommand(PC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS,0.0f,30000.0));
|
|
DelayCommand(2.0, SetLoc(PC));
|
|
DelayCommand(4.0, chkloc(PC, mat, "mat"));
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object PC = GetItemActivator();
|
|
object item = GetItemActivated();
|
|
string tag = GetTag(item);
|
|
if (tag == "water") {
|
|
FloatingTextStringOnCreature("You feel refreshed.", PC);
|
|
SetLocalInt(PC, "thirst", 1);
|
|
} else if (tag == "EmoteWand") {
|
|
DelayCommand(1.0, ExecuteScript("cc_emote", PC));
|
|
} else if (tag == "NW_IT_RECALL") {
|
|
DelayCommand(1.0, ExecuteScript("cc_recall", PC));
|
|
} else if (tag == "whostone" || tag == "WhoStone") {
|
|
ExecuteScript("whostone", PC);
|
|
} else if (GetStringLeft(tag, 4) == "toy_") {
|
|
ExecuteScript("x_activate", OBJECT_SELF);
|
|
} else if (tag == "mat") {
|
|
DelayCommand(1.0, matsit(PC));
|
|
} else {
|
|
ExecuteScript("nw_s3_alcohol", PC);
|
|
}
|
|
|
|
//IsRecall();
|
|
object oActiveObject = GetItemActivated();
|
|
if (oActiveObject == GetObjectByTag ("GemofReturning"))
|
|
{
|
|
object oPC = GetItemActivator();
|
|
if (GetLocalInt(oPC,"LocStart") != TRUE)
|
|
{
|
|
SetLocalLocation(oPC,"GemLoc",GetLocation(oPC));
|
|
SetLocalInt(oPC,"LocStart",TRUE);
|
|
}
|
|
|
|
location JumpLoc = GetLocalLocation(oPC,"GemLoc");
|
|
SetLocalLocation(oPC,"GemLoc",GetLocation(oPC));
|
|
effect eVisual = EffectVisualEffect(16);// visual
|
|
effect eVisual1 = EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED);
|
|
effect eVisual2 = EffectVisualEffect(VFX_DUR_LIGHT_PURPLE_10);// visual
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVisual, oPC,2.0);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVisual1, oPC,2.0);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVisual2, oPC,2.0);
|
|
AssignCommand(oPC,ActionJumpToLocation(JumpLoc));
|
|
}
|
|
}
|