ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Combat/Healing/Looting => Topic started by: Scotch_Tape on June 30, 2009, 06:23:04 PM

Title: EV/NF Caster 2.0
Post by: Scotch_Tape on June 30, 2009, 06:23:04 PM
This will cast Energy Vortex and Nature's Fury and keep your follower slots full.  It will also cast invisibility or attempt to hide if you have the hiding skill.  It detects when you are losing health and heals you.  If you are poisoned it will cure.  There is an option to just stay hidden and stop casting summons.  If you need to leave that spot you can hit pause, move around, and hit start again and it will continue casting on that same spot if you place your character on the same spot.  If you pause then move to a different spot it will let you reset casting location.  Menu button for resetting cast location on the fly.

This script automatically checks how many follower slots the EV takes so if you are unmounted and EV's take 2 slots it doesn't get stuck. 

I didn't test the Natures Fury part of the script, so if you use it let me know if there are any issues.


EV/NF Caster 2.0
Features:
 -Casts Energy Vortex or Natures fury.
 -Will use hiding skill if you have hiding.
 -Menu Driven.
 -Basic life support.(Heal/Cure)
 -Detects follower slots and cost per summon.
 -If you pause and move it allows you to get new
  target.
 -If you pause and hit start again on same spot it
  resumes casting on same location from before.
 -Menu option to just stay hidden without casting
  summons.

Directions:
 1.) Load Script.
 2.) Hit Play.
 3.) Move to spot you would like to cast from.
 4.) Hit "Set Location" on menu.
 5.) Wait for target cursor, Target spot you
     want to cast summons.
 6.) Hit "Start" Button on menu.


*Updated 9/4/2020
-fixed broken menu
-will cast in a different location if location get's blocked.
-If you set your location too far away it will change spot to max and call you an idiot.
Title: Re: EV/NF Caster 1.0
Post by: Petkiller on July 01, 2009, 06:09:25 AM
You posted this at just the right time, I was working on almost the same thing last night.  I looked at a journal scan for location blocked then have it try to cast a few tiles away(not working yet I think the z axis is messing me up).  I will test it this afternoon and see if the nature's fury works, I think a human char has about a 50% to cast it even at 0 skill if you have done the quest.
Title: Re: EV/NF Caster 1.0
Post by: Cerveza on July 01, 2009, 06:29:33 AM
You could also check number of followers.

Code: [Select]
gosub cast

sub cast
set %followers #followers
repeat
do all your casting stuff
gosub get_target_spot
until #followers > %followers
return

You can tell if something is cast by the number of followers you have. If you have room for more followers, just keep casting. Or you can use TM's great casting (runebook) sub.

You can also include a gosub in the repeat to change target positions.

A real slick menu with check boxes to cast in the same area, or randomly around you... with a settable distance, would be nice ;)
Title: Re: EV/NF Caster 1.0
Post by: Scotch_Tape on July 04, 2009, 07:53:31 PM
Has anyone tried this out?  I'm curious if there are any big issues with it working right?

Quote

You can also include a gosub in the repeat to change target positions.

A real slick menu with check boxes to cast in the same area, or randomly around you... with a settable distance, would be nice ;)

I'm looking into a more stable way to target, I'm a slow learner.  How it is now I've run this for over 24 hours without any problems, but I would like to make it have a better target system other than just using the last target.  I don't know about having it casting randomly around you, I don't see it as very useful for how I normally use it, but let me fix any bugs with it before I go adding more stuff.

Thanks for your input, I'll work on that.

Title: Re: EV/NF Caster 1.0
Post by: Petkiller on July 05, 2009, 04:57:46 AM
I tested it out in a few places in toknuo worked fine for me on low level spawn.  It also worked ok on the toknuo champ until the third level spawn came out. Those revant lions just revel too much.   I tried to get a random casting working but I think it would take some kind of tile scaning sub.
Title: Re: EV/NF Caster 1.0
Post by: Scotch_Tape on July 05, 2009, 06:14:37 AM
What's with the random casting spots?  What would be the point in casting all over the place? 

This script really isn't good at casting in the middle of a bunch of mobs, I use it while sitting off to the side and casting into the middle of where the mobs are spawning.  I have basic life support subs but nothing extremely effective.
Title: Re: EV/NF Caster 1.0
Post by: Cerveza on July 05, 2009, 06:20:24 AM
If your in a spawn area with a group, like the old days doing the fan dancers, I used a quickly written EV caster.

The ultimate logic I suppose would be to have it target a spot, then each spot around that until it cast. But having a "random" switch would be cool as well.
Title: Re: EV/NF Caster 1.0
Post by: Petkiller on July 10, 2009, 06:43:59 AM
Random Targeting sub for evs

sub cast
event macro 15 57
target 10s
gosub TM_RandomTargeting 2 ;range of tiles to cast ev from player
return

sub TM_RandomTargeting
  namespace push
  namespace local RT
  set !radius %1
  set !randx #RANDOM % !radius + 1
  set !randy #RANDOM % !radius + 1
  if #RANDOM > 500
    set !randx !randx * -1
  if #RANDOM > 500
    set !randy !randy * -1

  set !randx !randx + #CHARPOSX
  set !randy !randy + #CHARPOSY
  set #LTARGETX !randx
  set #LTARGETY !randy
  set #LTARGETZ #CHARPOSZ
  set #LTARGETKIND 2
  event macro 22 0
  namespace pop
return

I just saw this sub in a different ev script. 
Title: Re: EV/NF Caster 1.0
Post by: TrailMyx on July 10, 2009, 07:53:43 AM
heh, I wrote that back on uocoders.  lol
Title: Re: EV/NF Caster 1.0
Post by: The Ghost on October 10, 2015, 10:13:29 AM
Let help a few ppl that required this to cast at  2 different places.

Add this with the other set value.
Near line 36
Code: [Select]
set %CastTarget #false

This will be the new main loop.
Code: [Select]
While %Scotch_Tape > %Chuck_Norris
{
onhotkey F10 ctrl
   gosub SetCastTarget
If %CastNF = Yes
 gosub CastNF
If %CastEV = Yes
  gosub castEV %targetX %targetY %targetZ 57
gosub HideSelf
gosub MenuUpdate
}



Code: [Select]
sub SetCastTarget
set %targetX #charPosX
set %targetY #charPosY
set %targetZ #charPosZ
wait 4s
set %CastTarget #true
Event sysmessage Casting target set
return
; ---------------------------------------------------
sub castEV
; gosub castEV %targetX %targetY %targetZ 57
repeat
event macro 15 %4
target 5s
set #lTargetX %1
set #lTargetY %2
set #lTargetZ %3
set #lTargetKind 2
event macro 22
wait 30
if #followers <= 4
  set %1 ( %1 + 1 )
until #followers <= 4
return
Title: Re: EV/NF Caster 1.0
Post by: Dan123The123Man on February 01, 2016, 04:34:08 PM
hey ghost with that last post of yours would that make this script like fully automated still or would it require the player to hit that F10 hot key?
Title: Re: EV/NF Caster 1.0
Post by: The Ghost on February 02, 2016, 03:50:18 AM
Th F10 key is just to set the location of where you will cast of where your toon stand.   If you move more then 10 titles you will need to hit F10 again.  Yes it will cast in auto.
Title: Re: EV/NF Caster 1.0
Post by: NObama on February 02, 2016, 07:14:39 PM
heh, I wrote that back on uocoders.  lol

For the original Treasures of Tokuno, demon room - am I right?
Title: Re: EV/NF Caster 1.0
Post by: Vlad1 on April 21, 2016, 10:20:10 AM
EasyUO gump with pause button doesn't work for me.

Please If it possible post the newer version of this script?
Title: Re: EV/NF Caster 1.0
Post by: Scotch_Tape on August 30, 2020, 09:49:58 AM
I'd like to update and support this script, but it seems I had posted this script as a guest.  Is there a way to take ownership of this and update this?  Should I just submit this again? 
Title: Re: EV/NF Caster 1.0
Post by: Crisis on August 30, 2020, 11:40:32 AM
It looks like your original account was lost in maybe a data wipe or something. I would suggest making a new thread for it and posting a link from this thread to your new one. You could also just edit the post you just made and upload a new version there and keep this thread going. It is only one page so if they don't bother to read down a few posts for the new script, it's their loss.

EDIT: I also found how to give a current member control of a thread created by a guest. I will PM that to Tidus and see if he can work some admin magic so you can update from the original thread.
Title: Re: EV/NF Caster 2.0
Post by: Scotch_Tape on September 04, 2020, 12:50:15 PM
Thanks Crisis I've updated the script and added some new features.  I only tested on freeshard (Alexandria) .
Title: Re: EV/NF Caster 2.0
Post by: Gaderian on September 04, 2020, 07:47:22 PM
Hey Scotch,
A couple observations:
Chooseskill has a 4 character parameter, so Spellweaving would be 'spel' - I didn't check if it really works as written.
I can't figure out a reason to lock the detect hidden skill, but it forces it to be locked.
Static wait times following casts regardless of your FCR. This makes it much slower casting that it must be.
The logic surrounding %manacost is not at all obvious:
 before casting save your current mana
 cast
 wait 2 seconds after targetting (can be 0 to 1.5 seconds depending on FCR instead!) so some mana regenerates
 set %manacost to how much was used - modified by how much has regenerated
 if you cast naturesfury (mana cost is 24 unmodified by LMC)
  set %manarequired to %manacost + 84% of %manacost
 if you cast EV (mana cost is 50 unmodified by LMC)
  set %manarequired to %manacost + 48% of %manacost

Those percentages would be different for each setup based on skills, stats and equipped items (meditation, focus, JOAT, intelligence, LMC and MR).
So 84% or 48% ... would change based on another setup to be close to being correct.

A more stable calculation would be to calculate suit LMC and apply it to the base mana cost for casting.

If you would like, I can share the routines I use to calculating suits and mana requirements.

Gaderian
Title: Re: EV/NF Caster 2.0
Post by: Scotch_Tape on September 09, 2020, 06:35:45 AM
Hey Scotch,
A couple observations:
Chooseskill has a 4 character parameter, so Spellweaving would be 'spel' - I didn't check if it really works as written.
I can't figure out a reason to lock the detect hidden skill, but it forces it to be locked.
Static wait times following casts regardless of your FCR. This makes it much slower casting that it must be.
The logic surrounding %manacost is not at all obvious:
 before casting save your current mana
 cast
 wait 2 seconds after targetting (can be 0 to 1.5 seconds depending on FCR instead!) so some mana regenerates
 set %manacost to how much was used - modified by how much has regenerated
 if you cast naturesfury (mana cost is 24 unmodified by LMC)
  set %manarequired to %manacost + 84% of %manacost
 if you cast EV (mana cost is 50 unmodified by LMC)
  set %manarequired to %manacost + 48% of %manacost

Those percentages would be different for each setup based on skills, stats and equipped items (meditation, focus, JOAT, intelligence, LMC and MR).
So 84% or 48% ... would change based on another setup to be close to being correct.

A more stable calculation would be to calculate suit LMC and apply it to the base mana cost for casting.

If you would like, I can share the routines I use to calculating suits and mana requirements.

Gaderian

Chooseskill spell works the same as spel, but thanks I corrected it. 

I use the detect hidden skill to setup the location to cast, but I am assuming people don't want to train detect hidden so I just lock it if it's not already.  I tried setting #TARGCURS but I couldn't seem to get it to work on the ground even if I set the #TARGETKIND so I gave up.  Seems to be pretty dependable how I have it targeting. 

The Timers were just simple and don't require much thought.  If you've got subs built and I am smart enough to figure them out I'll add that, but the script was always very simple.  I understand your hatred with dumb timers so I'd give it an honest attempt to remove all those. 

As far as the %Mana Required I'll explain.

Code: [Select]
set %ManaCost #Mana
 event macro 15 %Cast
 target 4s
 set #LTARGETX %LTX
 set #LTARGETY %LTY
 set #LTARGETZ %LTZ
 set #lTARGETKIND 2
 event macro 22
  wait 2s
 }
 set %ManaCost %ManaCost - #Mana
  if %Cast = 606
    set %manarequired %manacost +  ( %manacost * 84 / 100 )
  if %Cast = 57
    set %manarequired %manacost +  ( %manacost * 48 / 100 )

This is only in the initial cast, so all it's doing is if you're casting EV it figures out how much that cost you then adds the cost to cast invisibility after cast.  Invisibility is a percentage of either spell, so if the initial cast is EV it calculates that plus a invis as the minimum mana the script will need if you are casting summons over and over. same with Natures Fury.

Not saying it's super accurate, but I thought this would be the easiest way to do it considering it's taking the mana cost directly from you casting the spell.  Even if it's got some crap timer code from my tests it seems to get close using different characters with different suits (one really good suit and one really crappy suit)  any slop only helps with adding buffer on for having to cast a heal or cure in there.
Title: Re: EV/NF Caster 2.0
Post by: Gaderian on September 09, 2020, 11:39:26 PM
Hey Scotch,
I did not mean to come across as critical, just my observations trying to figure out what the code was doing.

I couldn't make sense out of the 48% and 84% mana calculations.
Nature's Fury costs 24 mana and 84% of that is approximately 20 mana.
EV costs 50 mana and 48% of that is 24 mana.

I couldn't figure out what the percentages were because I was assuming it was supposed to be the same mana because it would call the same follow up spell. No biggie.

My way I tend to do mana calculations has some calculations at script startup:
1) calculate LMC for equipped items
2) calculate required mana for each level as a group (for example: all spells that use 11 mana are part of a group)
3) assign the mana value for each spell
Now when I go to cast, I decide if I have enough mana to perform the cast by comparing the variable against current #mana.

You mentioned you were using detect hidden because the cast of the summon wasn't working. It looks like it is missing setting #LTARGETKIND - which would be different after casting either Heal or Cure before that.
Code: easyuo
  1. Sub Cast
  2. While #FOLLOWERS < %MaxFollowers && #MANA > %ManaRequired
  3.  {
  4.  If C in #CHARSTATUS
  5.   gosub Cure
  6.  If #HITS < %MaxHits
  7.   gosub Heal
  8.  event macro 15 %Cast
  9.   target 4s
  10.   If %CastAttempt < 2
  11.   {
  12.    set #LTARGETX %LTX
  13.    set #LTARGETY %LTY
  14.    set #LTARGETZ 2      ; <<<<----- looks like it is missing both setting #LTARGETZ correctly and not setting #LTARGETKIND
  15.   }
  16.   else
  17.   {
  18.    set #LTARGETX %TempLTX
  19.    set #LTARGETY %TempLTY
  20.    set #LTARGETZ %LTZ      ;   <<<<<------ This is much better, but happens after the initial attempt
  21.    set #lTARGETKIND 2       ;   <<<<<------ Something like this logic would be needed when %CastAttempt < 2 above
  22.   }
  23.   event macro 22
  24.   wait 1s
  25.   set %CastAttempt %CastAttempt + 1
  26.  }
  27.  set %CastAttempt 1
  28.  return

Gaderian


Title: Re: EV/NF Caster 2.0
Post by: Scotch_Tape on September 10, 2020, 05:32:50 AM
Thanks Gaderian I fixed the issues with the Casting not including a findkind.  That was just a bad copy/paste.

I'm often reminded I went to public school to learn math.  I had the percentage wrong for Energy Vortex.  I found a shorter way of doing the math so that's fixed.

Not sure if you're understanding how lazy I am but I didn't plan on adding any other spells to the script so I don't really need to know all the magery spell mana cost and this is just one calculation no matter what suit or anything else you may or may not have.  It casts the spell and based off how much that costs your dude I simply determine the cost of an invisibility spell since it will always be a percentage of the cost of the EV or NF.  Going in and doing all the parsing on suit equipment and adding all that up just isn't the lazy way of doing this.  I can skip all that and use 1 line of code to figure it out.

I capture the first cast mana cost (EV or NF) and based off that multiply out what percentage your invisibility will cost and have that as a minimum required mana to actually cast another summon and an invisibility after.  It's my hope the slop with my dumb timers leaves enough extra mana on the end in the event you have to cast a heal or cure at some point.  That is not the most efficient way with the timers, but I keep casting EV's so I'm happy with it like that.   

Here is my new math for Summon + Invisibility Cost
Code: easyuo
  1. if %Cast = 606 ;Natures Fury
  2.     set %manarequired %manacost * 184 / 100
  3.   if %Cast = 57 ;Energy Vortex
  4.     set %manarequired %manacost * 140 / 100


Here is where I'm using that math for summon + Invisibility cost.
Code: easyuo
  1. Sub Cast
  2. While #FOLLOWERS < %MaxFollowers && #MANA > %ManaRequired ;<---- if I can't cast a summon and Invisibility after I don't cast and stay invis
  3.  {
  4.  If C in #CHARSTATUS
  5.   gosub Cure
  6.  If #HITS < %MaxHits
  7.   gosub Heal
  8.  event macro 15 %Cast
  9.   target 4s
  10.   If %CastAttempt < 2
  11.   {
  12.    set #LTARGETX %LTX
  13.    set #LTARGETY %LTY
  14.    set #LTARGETZ %LTZ
  15.    set #LTARGETKIND 2
  16.   }
  17.   else
  18.   {
  19.    set #LTARGETX %TempLTX
  20.    set #LTARGETY %TempLTY
  21.    set #LTARGETZ %LTZ
  22.    set #lTARGETKIND 2
  23.   }
  24.   event macro 22
  25.   wait 1s
  26.   set %CastAttempt %CastAttempt + 1
  27.  }
  28.  set %CastAttempt 1
  29.  return