blob: b7e311b850f9d64cce6e3008840d0273830cc94d (
plain) (
tree)
|
|
// TMW2 scripts.
// Authors:
// Pyndragon
// Jesusalva
// Description:
// Warp Crystal
- script Warp Crystal NPC_HIDDEN,{
close;
function Cooldown {
mesn;
mesc l("Successive warps cause time-space distortions and are thus not allowed.");
mesc l("You can use it again in %s.", FuzzyTime(TELEPORTER_TIME));
getitem @itemid, 1;
close;
}
function ReturnItem {
getitem @itemid, 1;
end;
}
OnUse:
// Receives @dest$
if (TELEPORTER_TIME > gettimetick(2))
Cooldown();
if (BaseLevel < 20) {
dispbottom l("The might contained in this curious object is too powerful. You have to be at least level 20 to harness it.");
ReturnItem();
}
// TODO: Are you already at target point?
// The chance to break is always at least 20%
// Begins at 100% and each second will subtract 0.01%
// It will never go below 15%, which happens after x seconds
.@timet=limit(0, gettimetick(2)-TELEPORTER_TIME, 3600);
.@prop=.@timet*2777/1000; // Make it range from 0~10000
.@adj_breakrate=limit(1500, .@prop, 9500 );
//debugmes "Adjusted break ratio: %d", .@adj_breakrate;
if (rand(0,10000) > .@adj_breakrate)
getitem @itemid, 1;
else
getitem BrokenWarpCrystal, 1;
// Apply Cooldown, same variable as LoF Teleporter, cancel ship travels
TELEPORTER_TIME=gettimetick(2)+300;
@timer_navio_running=0;
// Save new location and warp you there
EnterTown(@dest$);
ReturnTown();
end;
}
|