D.
Translocating item.
Translocating item.
Could some one help me with script, wich will be moving an item in that direction, in wich player is directed when he double click it? But, important, it will be great, when item could be locked down and it will spawn new item, with the same graphic to avoid last object macro 
D.
D.
Just do something like this (Just dont kill me if this isnt efficient enough for you guys
)...
If your goal is to prevent macroing of this, this wont work against third party programs. You can easily scan the ground of an object of a certain type and set it to LastObject then use it. The only way around that is to make a completely different item but then that will get offset because if the type is changing, players will just have it scan the ground for anything and use it. Obstacles and extra items... they can have it just use everything almost all at once.
Code: Select all
function moveobject(who, item)
var locx := item.x;
var locy := item.y;
if ((who.facing < 2) || (who.facing == 7)) // 7 (Northwest), 0 (North), 1 (Northeast)
locy := locy - 1; // Move item 1 tile North
endif
if ((who.facing > 2) && (who.facing < 6)) // 3 (Southeast), 4 (South), 5 (Southwest)
locy := locy + 1; // Move item 1 tile South
endif
if ((who.facing > 0) && (who.facing < 4)) // 1 (Northeast), 2 (East), 3 (Southeast)
locx := locx + 1; // Move item 1 tile East
endif
if (who.facing > 4) // 5 (Southwest), 6 (West), 7 (Northwest)
locx := locx - 1; //Move item 1 tile West
endif
CreateItemCopyAtLocation(locx, locy, GetWorldHeight(locx, locy), item);
//Use the next line in place of the previous if you have POL096. Supports different maps.
//CreateItemCopyAtLocation(locx, locy, GetWorldHeight(locx, locy), item, item.realm);
DestroyItem(item);
endfunction
But it's function. And documentation says about usescript:
"Where Does It Live?
The 'program' in a .src file, in a package or /scripts/items"
example
"Where Does It Live?
The 'program' in a .src file, in a package or /scripts/items"
example
Code: Select all
use uo;
use util;
program my_example_usescript(character, item)
PrintTextAbove(item, character.name + " used me!");
item.color := RandomInt(50);
endprogramRight, you can copy and paste that function inside an include or just in the script itself then call it like
Theres your program and the function all in 1 file. You can call any function you want using your program as long as its either in the script or in one of its includes.
Code: Select all
use uo;
program my_example_usescript(character, item)
var newitem := moveobject(character, item);
newitem.movable := 0;
(put any other modifications or stuff you want to do here)
endprogram
function moveobject(who, item)
var locx := item.x;
var locy := item.y;
if ((who.facing < 2) || (who.facing == 7)) // 7 (Northwest), 0 (North), 1 (Northeast)
locy := locy - 1; // Move item 1 tile North
endif
if ((who.facing > 2) && (who.facing < 6)) // 3 (Southeast), 4 (South), 5 (Southwest)
locy := locy + 1; // Move item 1 tile South
endif
if ((who.facing > 0) && (who.facing < 4)) // 1 (Northeast), 2 (East), 3 (Southeast)
locx := locx + 1; // Move item 1 tile East
endif
if (who.facing > 4) // 5 (Southwest), 6 (West), 7 (Northwest)
locx := locx - 1; //Move item 1 tile West
endif
var newitem := CreateItemCopyAtLocation(locx, locy, GetWorldHeight(locx, locy), item);
//Use the next line in place of the previous if you have POL096. Supports different maps.
//var newitem := CreateItemCopyAtLocation(locx, locy, GetWorldHeight(locx, locy), item, item.realm);
DestroyItem(item);
return newitem;
endfunction