Insta-death with no debt script question

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Insta-death with no debt script question

#1 Post by Edamh »

My L50 has been getting ganked by all the elites in Inferno Gardens in Xaviera. I wanted to add a check to see if the target is elite, and if elite, use the insta-death-with-no-debt script.

I have the following in the L50 profile

Code: Select all

	<onSkillCast><![CDATA[
		-- Additional Lua code to execute when casting a skill
		-- Note: arg1 contains the skill being used.
		-- i.e. arg1.Name will be the name of the skill being cast
		-- e.g.:
		--if( 15 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_SOUL_SOURCE");
		--elseif( 25 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_HOLY_AURA");
		--    player:cast("PRIEST_URGENT_HEAL");
		--    player:cast("PRIEST_URGENT_HEAL");
		
	if( target.HP == target.MaxHP and target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR ) then
			RoMScript("SetCameraPosition (0,0,1000000)");
	end;
		
	]]></onSkillCast>
but I get the error

Code: Select all

D:/micromacro/scripts/rom/classes/player.lua:669: onSkillCast error: [string "..
."]:13: attempt to index global 'target' (a nil value)
When I use

Code: Select all

	<onSkillCast><![CDATA[
		-- Additional Lua code to execute when casting a skill
		-- Note: arg1 contains the skill being used.
		-- i.e. arg1.Name will be the name of the skill being cast
		-- e.g.:
		--if( 15 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_SOUL_SOURCE");
		--elseif( 25 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_HOLY_AURA");
		--    player:cast("PRIEST_URGENT_HEAL");
		--    player:cast("PRIEST_URGENT_HEAL");
		local target = player:getTarget();
	if( target.HP == target.MaxHP and target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR ) then
		player:logout();
	end;
	]]>
	</onSkillCast>
I do not get the error. Unfortunately, if I wait for the logout, my char is usually dead since the elites can hit for 5K+ so the char can be dead within 5-10 seconds before logout can complete.

What am I missing or have wrong in my insta-death-no-debt version? Thanks.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Insta-death with no debt script question

#2 Post by lisa »

I'd say you would need to check the instadeath code works.

Edit: tested the code, it takes 6+ seconds after doing code before u actually die.

also
target.HP == target.MaxHP
Having that means you only check it before it has been attacked. So if you have given it a little slap then you will not do your death.

Maybe do a check if the target is targeting you?

Code: Select all

local target = player:getTarget();
if( target.TargetPtr == player.Address and target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR) then
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: Insta-death with no debt script question

#3 Post by Edamh »

lisa wrote:Having that means you only check it before it has been attacked. So if you have given it a little slap then you will not do your death.

Maybe do a check if the target is targeting you?

Code: Select all

local target = player:getTarget();
if( target.TargetPtr == player.Address and target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR) then
tyvm. this code works, and I can setup instadeath but no debt my char!
Post Reply