Author Topic: How do you script a summoning spell?  (Read 2109 times)

0 Members and 1 Guest are viewing this topic.

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
How do you script a summoning spell?
« on: March 18, 2012, 01:33:23 PM »
0
Attempting to make myself a mobile RC casting bot.  Intent is to dynamically target the square next to me every time I cast a Colossus.  I'm using TM's awesome spellcast subs, but unfortunately I can't figure out how to get a square of ground into #ltargetid.

Help?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: How do you script a summoning spell?
« Reply #1 on: March 18, 2012, 03:26:01 PM »
0
Here's a little script I wrote a long time ago that summons energy vortexes.  Might be similarly useful:

Code: [Select]
set %targetx #CHARPOSX
set %targety #CHARPOSY - 5
;set %creature_type SY ; blade spirits
set %creature_type YI ; energy vortex
repeat
  if #FOLLOWERS < 4
    gosub Summon
until #FALSE
;-----------------------------------------------
sub Summon
;  event macro 15 32 ; blade spirits
  event macro 15 57 ; energy vortex
  target 20s
  set #LTARGETKIND 2
  set #LTARGETX %targetx
  set #LTARGETY %targety
  event macro 22 0
  wait 40
return
;-----------------------------------------------
sub Meditate
  namespace push
  namespace local MED
  set !wait %1
  set !thresh %2
  gosub TM_SyncTextScan
  set !mana_target #INT - !thresh
  set !success #FALSE
  med_loop1:
    if #MANA > !mana_target
      goto Meditate_skip
    if !success = #FALSE
    {
      gosub TM_SyncTextScan
      event macro 13 46
      wait 20
    }
    gosub TM_FindValidTextNoAdvance you_enter_a_meditative_trance
    if #RESULT = #TRUE
    {
      gosub TM_SyncTextScan
      if !wait <> #TRUE
        goto Meditate_skip
      set !success #TRUE
    }
    gosub TM_FindValidTextNoAdvance you_stop_meditating
    if #RESULT = #TRUE
    {
      gosub TM_SyncTextScan
      set !success #FALSE
    }
    goto med_loop1
Meditate_skip:
  namespace pop
return
;-------------------------------------------------------------------------------
; Brings !_jindex up to the most recent #journal entry
sub TM_SyncTextScan
  namespace push
  namespace local text
  set !_jindex #jindex + 1
  namespace pop
return
;-------------------------------------------------------------------------------
; %2, %3, %4, etc strings to match
; returns #TRUE for match, #FALSE for no match
;  Will not advance !_jindex pointer to allow for scanning journal history for more than one search.
;  Also searches for : , #SPC in journal entry to be sure someone isn't spamming the text
sub TM_FindValidTextNoAdvance
  namespace push
  namespace local text
  set !temp_lpc #LPC
  set #LPC 1000
  set !num_args %0
  set !first_arg 1
  if !_jindex = N/A
    set !_jindex #jindex
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= #jindex
    {
      scanjournal !temp_jindex
      if !text in #journal && :_ , !text notin #journal
      {
        set !temp_jindex !temp_jindex + 1
        set #LPC !temp_lpc
        namespace pop
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until ( ( !index - !first_arg ) > ( !num_args - 1 ) )
  set #LPC !temp_lpc
  namespace pop


If you want to use the spellcast subs, you'll need to change the #LTARGETKIND to 2 so the ground will be targeted.

Might be easier to just use the little snippet above.
« Last Edit: March 18, 2012, 03:29:51 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: How do you script a summoning spell?
« Reply #2 on: March 18, 2012, 03:29:59 PM »
0
If you are in SA, you may as well Give up! As far as I know anyways. I never could figure out how to even target snakes nests in SA, much less cast a rising.

Your best bet, would be to base what tile is immediately behind you or in front of you based on your #Chardir, and set a universal Click X Click Y For those two spots and once the target cursor comes up, you click the location.

Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: How do you script a summoning spell?
« Reply #3 on: March 19, 2012, 05:01:01 AM »
0
Attempting to make myself a mobile RC casting bot.  Intent is to dynamically target the square next to me every time I cast a Colossus.  I'm using TM's awesome spellcast subs, but unfortunately I can't figure out how to get a square of ground into #ltargetid.

Help?
Scan all times around you and define "Good" and "Bad Tiles" then use the xyz for target on a good tile, did this many years ago with a hord of Mages doing afk Champs by casting nonstop energy vortex

Tags: