ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: warrenotto on September 04, 2013, 05:28:16 PM

Title: block spell during movement
Post by: warrenotto on September 04, 2013, 05:28:16 PM
can anyone tell me or show me where i can learn or read about how to block a spell casting during character movement. that would be awesome thanks.

im having fun with this scripting stuff.
Title: Re: block spell during movement
Post by: TrailMyx on September 04, 2013, 06:58:53 PM
I have a sub in my CLAw that monitors movement to prevent looting while you're wandering.  Same principle really.
Title: Re: block spell during movement
Post by: warrenotto on September 05, 2013, 10:15:37 AM
cool think i found it. i will try to integrate it into my script when i get home tonight. thanks man!

two thumbs up for this forum. you guys are really helpful!
Title: Re: block spell during movement
Post by: TrailMyx on September 05, 2013, 01:16:24 PM
Should be this sub here:

Code: [Select]
sub StandingStill
  namespace push
  namespace local STILL
  
  set !newpos #CHARPOSX , #CHARPOSY , #CHARPOSZ
  if !newpos <> !oldpos || !move_timer = N/A
  {
    set !delay 1 ; adjust this value for more delay
    set !oldpos !newpos
    set !still #FALSE
    set !move_timer #SCNT + !delay
  }
  if #SCNT > !move_timer
  {
    if !oldpos = !newpos
    {
      set !still #TRUE
    }
    else
    {
      set !oldpos !newpos
      set !move_timer #SCNT + !delay
    }
  }
  set #RESULT !still
  namespace pop
return #RESULT

Then you just use it like this:

Code: [Select]
 gosub StandingStill
  if #RESULT = #TRUE
  {
    ; do your stuff here.
  }

Note you can modify the value of !delay to add more delay.  It's already delaying the least amount (1 second)
Title: Re: block spell during movement
Post by: warrenotto on September 06, 2013, 02:27:43 PM
cool. that's the one i though it was. looked through the whole script then realized its right there at the top. haha. i didn't get a chance to try it out last night cause i had to work late. ill give it a go tonight and let you know when i get it working. thanks again. much appreciated.
Title: Re: block spell during movement
Post by: TrailMyx on September 06, 2013, 04:54:43 PM
At the beginning of your script, if you put this:

Code: [Select]
set #LPC 100

That will increase the responsiveness of the function without impacting overall performance.  Just don't make it very large because it will cause a slowdown of your client and other scripts running in parallel.