Page 1 of 1

Using MAGE_THUNDERSTORM

Posted: Mon Dec 13, 2010 8:11 pm
by jduartedj
Hi,

I don't know if anyone has ever found a way to do this, or at least a better way but I wanted to share this code I made to cast thunderstorm. It does require the window to be focused like harvesting used to to require.
So maybe there is a better way... If there is please tell me!

Code: Select all

<onSkillCast>
				-- Casts Thunderstorm at the player's window position
			if arg1.Name == "MAGE_THUNDERSTORM" then 
				printf("Casting: Thunderstorm - Focus on Window needed!\n"); --not really needed 
				addMessage("Casting: Thunderstorm");  --not really needed 
				-- gets windows Width and Height
				local hf_x, hf_y, hf_wide, hf_high = windowRect( getWin());
				-- clicks at about 1/3 of window Height which is about where the player always is
				player:mouseclickL(hf_wide/2,hf_high*2/3); 
				yrest(2500); --simulating casttime
			end;
</onSkillCast>
I tried to cast it at the position of the mob but could find any way to detect the mob's window position (not world position). Anyway maybe there is a way to say where to cast thunderstorm without an actual click!?

Any feedback on this will help, thanks.

Re: Using MAGE_THUNDERSTORM

Posted: Tue Dec 14, 2010 8:59 am
by jduartedj
I wrote: Any feedback on this will help, thanks.
C'mon people! Anything?

Re: Using MAGE_THUNDERSTORM

Posted: Tue Dec 14, 2010 12:12 pm
by Administrator
Well, it works but it is, of course, not the best solution. Thanks for providing it. Would be nice if there was a RoM API function that would allow you to cast skills like that more easily.

I think doing all the math to convert 3D world coordinates to 2D screen coordinates would just be overkill.

Re: Using MAGE_THUNDERSTORM

Posted: Tue Dec 14, 2010 3:05 pm
by jduartedj
Administrator wrote:I think doing all the math to convert 3D world coordinates to 2D screen coordinates would just be overkill.
yes, ofc. I didn't even thought of it, what i had in mind was in case there was already something that gave us those coordinates, the same way you can get mob.x and mob.y you could get mob.wx and mob.wy for window coordinates.

anyway I would prefer like you said an API function for that.

Re: Using MAGE_THUNDERSTORM

Posted: Tue Dec 14, 2010 7:13 pm
by rock5
Administrator wrote:I think doing all the math to convert 3D world coordinates to 2D screen coordinates would just be overkill.
With the angle and zoom factor of the camera known and if you point the camera to the target so you'd know it would be in the middle, horizontally, you would just have to work out the virtical value. It might not be too difficult to calculate, i think. But the fact that the client has to be the active window to click makes it not worth the effort.