Page 1 of 1

Select a specific object and cast a spell on it

Posted: April 22nd, 2018, 6:52 pm
by Swedish Chef
I'm trying to build a very basic meta that casts BD and the like on my dagger after x minutes. I've tried a few meta expressions, and while i can get them to cast on myself (so like defender on a wand or orb) i cant get them to cast on a specific or selected item.

Code: Select all

/vt mexec actiontrycastbyidontarget[2101,actiontryselect[80347B95]]
or

Code: Select all

/vt mexec actiontrycastbyidontarget[2101,80347B95]
or

Code: Select all

/mt cast cragstones will on ivory orb

where 80347B95 is the specific object code i pulled using "wobjectgetselection[]"

any help or pointing in the right direction would be super duper cool :) Thanks!

Re: Select a specific object and cast a spell on it

Posted: April 23rd, 2018, 9:27 am
by Dmdtt
easiest way is to select the orb in one action then

Code: Select all

actiontrycastbyidontarget[2101,wobjectgetselection[]]
in another action.

for casting BD on your dagger you may have to try a number of things to get it selected.

first pull its template type by manually selecting and using

/vt mexec wobjectgettemplatetype[wobjectgetselection[]]

then using that # try

Code: Select all

actiontryselect[wobjectfindininventorybytemplatetype[InputTemplateNumberHere]]
then if that allows you to select it

Code: Select all

actiontrycastbyidontarget[2101,wobjectgetselection[]]
another option that is a bit more clunky is to manually save the dagger into a variable. by selecting it then

Code: Select all

setvar[Dagger,wobjectgetselection[]]
then

Code: Select all

actiontrycastbyidontarget[2101,getvar[Dagger]]
i remember doing this automatically once by reacting off testvar[Dagger]==0 and chat message for hitting something so i know it is out then using the object class for the weapon to select the nearest one using

Code: Select all

actiontryselect[wobjectfindnearestbyobjectclass[1]]
(1 is objectclass for melee weapons) then in another rule

Code: Select all

All testvar[Dagger]==0 and wobjectgetobjectclass[wobjectgetselection[]]==1
the first conditon makes sure that the variable hasnt been set yet and second confirms that selected item is a melee weapon

then for the action

Code: Select all

setvar[Dagger, wobjectgetselection[]]

Re: Select a specific object and cast a spell on it

Posted: April 25th, 2018, 3:26 am
by Swedish Chef
Through the methods you prescribed I was able to select my weapon. However, when trying to cast the spell (defender as an example) the return was 2 from the expressions. maybe it's just a limitation in what vtank expects versus what classic provides?

Re: Select a specific object and cast a spell on it

Posted: April 25th, 2018, 10:04 pm
by Dmdtt
the only thing I can think of is are you sure you are using the right spell ids?

also once you confirm the spellid maybe try using magtools casting commands see if that will work for buffing up weapons.