Is it possible to make an EC command script for this please?
We have a 'target injured' party member or follower. But what if I see someone struggling and want to just go in and slap a bandy to help? He's not in party, he's just some random blue. Is there a way to make a command script to target injured friendly? I've tried 'nearest friendly' but if there are 2 people, it can't tell which one to target, and if they're neck deep in spawn, targeting manually isn't always quick enough to save them from death.
Comments
Edit your Actions.lua file, and add the following to the file (can be anywhere, bottom is fine):
Then create a Macro with a command block for this:
This will target the most critically injured blue mobile near you that isn't in your party. It scans the blue mobiles bars, so they must be enabled.
You can add this to the targeting action window as well if you want so you don't have to use a Command block each time.
Edit ActionsWindow.lua
Go to line 274 and after "ActionsWindow.ActionData[5207]" add the following line:
Then go down to what should now be line 441, which has "ActionsWindow.Groups[6]", and in the number index on that line, add 5208 to the list:
This should put this new targeting action in the Actions list under Targeting
Home of the Pet Intensity Calculator, Pet Planner, Trainable Animal Bestiary, and other Tools, Guides, and Information.
you might want to exclude poisoned or mortalled targets though unless you’re using cleansing winds, or get it to hold until target is no longer poisoned or mortalled so you don’t have to recast”
Currently that folder looks like this: C:\Program Files (x86)\Electronic Arts\Ultima Online Enhanced\UserInterface\petra\Icons\Macro Icons\Numbers
I think I need to add a folder called 'source' and put the copied file into that?
Hope you don't mind, I'm going to add the following.
@Petra_Fyde
Directory Structure
...\UserInterface\petra
-----\Icons...
-----\Source
----------Actions.lua
With this setup, you would need to call the function with the script Khyro described above using the Action>Command.
You only need to make the edit to Actions.lua once. The only time you would need to update it, would be if the dev team updates the Actions.lua in the default directory and you want to incorporate whatever change they have made, or they changed something about the way they called the file and you had to perform the edit a second time.
I have very rarely run into updates that required mod changes. Once in awhile you may have to load with default, log out, and then reload with your mod, but that is just selecting from the drop down list at the login screen.
--
If you want to have the function appear in the Actions widow, rather than calling it from the Action>Command, then follow the second set of instructions. Directory structure would look like this.
...\UserInterface\petra
-----\Icons...
-----\Source
----------Actions.lua
----------ActionsWindow.lua
If you want to add a custom icon you can. Create your icon and follow the steps I laid out for you in the icons thread: add the icon and assign the icon a number in Icons.xml and if you want Macropicker.lua.
Let's say you added the icon to Icons.xml as 900001.
Modify the line:
ActionsWindow.ActionData[5208]...
to read:
ActionsWindow.ActionData[900001]...
Now your custom icon will also appear in the actions window.
--
If you want to change the numbers at which the targeting takes place, the following two lines control that operation.
curHealth < 25
local lowerHP = -1
curHealth < 50 = will target below 50 HP
local lowerHP = -10 will target if you have 10 less than maximum hitpoints (90/100)
I believe these are direct values and not percentages, but I could be wrong. Working from memory.
--
As for what Yoshi is suggesting, you should be able to add those exemptions following the,
if (Actions.TargetAllowed....
with "and not" follower, poisoned, etc., but I don't remember the actual calls off the top of my head. You can probably find these yourself in the Actions.lua by examining the other similar functions, there is one that excludes (or includes) followers, so you could just copy paste from there (Target severly injured follower I think...???).
--
Welcome to modding the EC. It can get as complicated as you want to make it.
It's addictive though.
Health is returned by the server in blocks of 4%, so that above line is making sure only damaged mobiles will be scanned. A value of 25 is 100% health (25*4).
lowerHP stores the current lowest health value scanned. It starts -1 to indicate there is currently no mobile stored. So it starts -1 until it finds a mobile that is not 100% health, then stores that value as it loops through, until it finds the lowest health mobile visible.
If you want to excluded pets, change this line:
to this:
Home of the Pet Intensity Calculator, Pet Planner, Trainable Animal Bestiary, and other Tools, Guides, and Information.
So far I've stuck with the original plan for icons, overwriting the numbers. Number 11 now looks like this:
This is the 'gif' version, just in case anyone else wants to use it. Obviously it needs to be .dds to actually work in game
Yoshi failed to notice that the intended macro is not for casting a spell, but for applying a bandage.
It's easy to create a bank page and url, it's easy to copy and paste. But it takes relatively more time to write useful stuff which ends up buried with the other less useful discussions in this forum.
ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs
Never be afraid to challenge the status quo
Any thoughts?
I think it's alright to add to a wiki page, as when and when players like Arroth or Khyro post them, like some of the earlier posts in the bugs or here. We resolved some of the EC client issues by ourselves. I think I kept my own notes in Evernote.
ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs
ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs
I was a bit intrigued that this is something that could be scripted and thought maybe I should try it myself but kind of lost focus about 10 lines into it after thinking how long it would take me to create some of these scripts myself.
Amazing what we can do with computers.
These EC scripts are useful for those who feel Pinco is too heavy.
I dont think we are looking at automated, afk or macro scripts where we can go to bed while the toon craft, hunt and collect stuff.
ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs