The method I thought I'd use is this:
I'll have an item that when is equipped calls the script "invis_cloak.src", and when unequipped calls the script "invis_cloak_off.src".
The equipscript looks like this:
Code: Select all
use uo;
use util;
program InvisibilityCloakOn(player, cloak)
var Time := ReadGameClock();
var WaitTime := GetObjProperty(player, "InvisCloakTime");
if (Time < WaitTime)
var TimeLeft := (WaitTime - Time);
PrintTextAbovePrivate(player, ("The cloak needs to recharge. You feel it will take " + TimeLeft + " seconds before you can use it.), player);
return;
endif
var orcolor := GetObjProperty(cloak, "color");
SetObjProperty(cloak, "originalcolor", orcolor);
SetObjProperty(cloak, "color", 1);
SetObjProperty(player, "hidden", 1);
SetObjProperty(player, "stealthsteps", (2d6+13));
SetObjProperty(player, "InvisCloakTime", (ReadGameClock() + 60));
endprogramCode: Select all
use uo;
use util;
program InvisibilityCloakOff(player, cloak)
var orcolor := GetObjProperty(cloak, "originalcolor");
cloak.color := orcolor;
endprogramThe itemdesc.cfg file in the config folder has this code:
Code: Select all
Item 0x5002
{
Name inviscloak
Desc Invisibility Cloak
Graphic 0x1515
maxhp 20
AR 4
Script
controlscript :combat:itemControl
destroyscript :combat:destroy
equipscript invis_cloak
unequipscript invis_cloak_off
}Both the .src files are located in ...\scripts\custom
Help would be greatly appreciated.
Thank you / Lunne