ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: kdzhii on November 07, 2013, 10:30:20 AM
-
hey ppl.
i`m trying to figure out how i could make my character to keep a distance from a dragon while in the same time i cast spells on it. note: i play on a shard where mags can cast spells while moving
so.. my first idea is that event pathfind would be a cool thing.
i have a spot where i land after teleport. dragon will be somewhere around.
how could i create a movement so i dont get too far and attract others monsters and in the same i maximally keep distance ? no worries if i take a hit from dragon or get damaged with a spell. we have 50% faster cast armors here..
thanks - any help appreciated.
-
Record a Rail using one of the handy Rail Writing Tools Around the Site, then you'll need to get a Rail Engine(Typically Provided by the same Coder). Then you will do a basic Math Check.
Finditem (ID for Dragon) G_10
if #Finddist < (How close you want it to get before you move)
Gosub Rail_Engine Rail Direction Distance etc etc etc etc etc
The Nice thing about doing it this way, is you can actually Draw the Path you want your Character to take as he's being eaten by the Dragon. The Rail engine will take you to the Closest Location at first, and then will actually follow the Rail Each time to use it.
-
Snippet from my Doomscript :
Sub MoveAway
FindItem %1 G_
If #FindID = X
Return N/A
If #FindDist => %2
Return
If #FindDist = 0
{
Set !TargetPosX #FindX + 1
Set !TargetPosY #FindY - 1
}
Else
{
Set !TargetPosX #FindX
Set !TargetPosY #FindY
}
Set !TX !TargetPosX - #CharPosX
Set !TY !TargetPosY - #CharPosY
Set !TX ( !TX / ABS ( !TX ) )
Set !TY ( !TY / ABS ( !TY ) )
Set !TX !TX * ( %2 - #FindDist )
Set !TY !TY * ( %2 - #FindDist )
Set !MoveX #CharPosX - !TX
Set !MoveY #CharPosY - !TY
Gosub BMPathfind !MoveX !MoveY 0 3s
Return 1
And how to call :
Gosub MoveAway %CurrentEnemy 10
I used it back then for running away from Darkfather if iam too damaged. You may need replace "Gosub BMPathfind !MoveX !MoveY 0 3s" with your own mover routine or use badmadiancs pathfind. if #result is 1 it were successfully.
To Cast while you walk you must handle on your own ;)
-
how do i create my own routine... ?
-
how do i create my own routine... ?
You Get X , you Get Y. Now you must have a function to run to X\Y.If you dont know how, i would suggest using existing code from people around here or easyuo
-
so what i have right now is something like this:
mainloop:
for %i 1 17
{
set %rail_filename railfile . %i , .txt
set %rail_label LABEL . %i
call %railsubs TM_Initialize
call %railsubs TM_LoadRail %rail_filename
gosub castinvis
gosub setpagebutton
;gosub hide
gosub setrecallbutton
gosub openrunebook
set %charx #charposx
set %chary #charposy
gosub calculatex %i
click %resultx %y
wait 10
click %recallx %recally
repeat
{
wait 1
}
until #charposx <> %charx || #charposy <> %chary
finditem %dragontypes G
if #findcnt > 0
gosub combat
gosub flybank
gosub checkreagents
}
goto mainloop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sub combat
set %target #findid
repeat
{
gosub castlight %target
gosub castscan
finditem %target g_15
if #finddist < 4
call %railsubs TM_GotoClosestWaypoint
}
until #findcnt = 0 || ( #charposx = 5703 && #charposy = 639 )
if ( #charposx = 5703 && #charposy = 639 )
set %recycle #true
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ends up doing a pathfind in the closest waypoint and spams lighting too fast.. hmm.
-
Rail scripts that do things are not easy to get right. Start smaller. Go to the documentation tab on easyuo.com and read about the move and the event pathfinder commands. Make a small snippet of code that does something like this:
Event pathfind X Y Z
Halt
Then look at your charposition information, walk around and try using the code snippet to move. You can evolve it by adding more moves, waits, and checks to see if you moved to the right spot. Now when you try to use someone else's more complete rail and movement code to build your script you will have some experience to help you troubleshoot when it doesn't work well.
Get comfortable with how the movement options work, plan what you want the script to do, preferably by practicing the routine in the game yourself. In this case I would go to the place you want to run the rail and actually do it live six or eight times so that you can anticipate potential failure points. Make a plan for the rail that you think will work that accounts for how the move commands work and what your environment will be like.
Now go look at some of the rail and movement code out there and try to build the script to run in a safe environment first. Don't introduce anything else until you have your rail working -- and don't run it live until you can run it consistently somewhere safe. No sense dying while you try to get it working.
-
sub combat
set %target #findid
repeat
{
gosub castlight %target
gosub castscan
finditem %target g_15
if #finddist < 4
{
call %railsubs TM_GotoClosestWaypoint
call %railsubs TM_DetermineCurrentRailName
call %railsubs TM_RunRail #RESULT PRESENT END FW
}
until #findcnt = 0 || ( #charposx = 5703 && #charposy = 639 )
this does something more .. how can i make it to change dirrection?
-
You want to go back to the beginning of the rail?
-
Bah, I'll just make a tutorial for my rail engine/recorder. eventually....... *Dies of old age before he finishes anything*
-
dont need it no more.