Page 4 of 6

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 12:07 pm
by javito
Purifying Paean does not work nothing happens when I have a debuff, Maybe something's wrong with this script.

Code: Select all

function _CheckState( Entity )

	-- Retrieve the range of the entity compared to my own character position.
	local Range = Player:GetPosition():DistanceToPosition( Entity:GetPosition());

	-- Check if this routine is allowed to be ran under the current circumstances.
	if Entity:IsDead() or ( not Settings.Songweaver.AllowApproach and Range > 23 ) then
		return true;
	end

	-- Retrieve the state for the current entity to inspect.
	local EntityState = Entity:GetState();

	-- Loop through the states only when we are available to dispel them. We still check for removed states!
	if EntityState ~= nil and ( self.StateDispelTime == nil or self.StateDispelTime < Time()) then

		-- Create the state array for the global entity storage and undispellable states if it does not exist.
		if self.StateArray == nil or self.StateUndispellable == nil then
			self.StateArray = {};
			self.StateUndispellable = {};
		end

		-- Create the state array for the current entity if it does not exist.
		if self.StateArray[Entity:GetID()] == nil then
			self.StateArray[Entity:GetID()] = {};
		end

		-- Loop through the states to find which need to be removed.
		for ID, Skill in DictionaryIterator( EntityState:GetList()) do

			-- Check if the current skill is valid and has not been marked and undispellable.
			if Skill ~= nil and Skill:IsDebuff() and ( self.StateUndispellable[Skill:GetID()] == nil or self.StateUndispellable[Skill:GetID()] < Time()) then

				-- Check if this entity had the current skill effect on him and hasn't been removed by either Cure Mind or Dispel.
				if self.StateArray[Entity:GetID()][Skill:GetID()] ~= nil and self.StateArray[Entity:GetID()][Skill:GetID()] == 2 then
					self.StateUndispellable[Skill:GetID()] = Time() + 30000;
				-- Remove the state from the entity.
				else

					-- Retrieve the magical state the current skill.
					local RemoveMagical = Skill:IsMagical();

					-- Check if we are required to change the magical state for the current skill.
					if self.StateArray[Entity:GetID()][Skill:GetID()] ~= nil then
						RemoveMagical = not RemoveMagical;
					end

					-- Check if the dispel or cure mind can be executed correctly. The function might need to set the target first!
					if ( RemoveMagical and Helper:CheckExecute( "Purifying Paean", Entity )) or ( not RemoveMagical and Helper:CheckExecute( "Purifying Paean", Entity )) then

						-- Change the state dispel timer to prevent dispel and cure mind from being used too quickly.
						self.StateDispelTime = Time() + 500;

						-- Track the current state of the dispel and cure mind to find undispellable states.
						if self.StateArray[Entity:GetID()][Skill:GetID()] == nil then
							self.StateArray[Entity:GetID()][Skill:GetID()] = 1;
							return false;
						else
							self.StateArray[Entity:GetID()][Skill:GetID()] = 2;
							return false;
						end

					end

				end

			end

		end

		-- Loop through the existing states to find which have been removed correctly.
		for k,v in pairs( self.StateArray[Entity:GetID()] ) do
			if v ~= nil and EntityState:GetState( k ) == nil then
				self.StateArray[Entity:GetID()][k] = nil;
			end
		end

	end

	-- Return true to let the caller know this function completed.
	return true;

end

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 12:48 pm
by locatelli
At the moment, I'm not using my bard bot anymore. But there is in tutorial a guide by agonic you can use to fix it quite fast by changing the function :D

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 2:52 pm
by bionuttt
- [string "Songweaver.lua"]:537: attempt to index field 'Songweaver' (a nil value)

I use script from the top of post but still got this error ( i have lvl 40 )

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 3:00 pm
by FarAwaY
bionuttt wrote:
Sun Feb 19, 2017 2:52 pm
- [string "Songweaver.lua"]:537: attempt to index field 'Songweaver' (a nil value)

I use script from the top of post but still got this error ( i have lvl 40 )
Try This one viewtopic.php?f=10&t=11&start=20#p185

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 3:12 pm
by bionuttt
FarAwaY wrote:
Sun Feb 19, 2017 3:00 pm
bionuttt wrote:
Sun Feb 19, 2017 2:52 pm
- [string "Songweaver.lua"]:537: attempt to index field 'Songweaver' (a nil value)

I use script from the top of post but still got this error ( i have lvl 40 )
Try This one viewtopic.php?f=10&t=11&start=20#p185
i did this but now i dont got error but is nothing happen , my character stay afk

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 3:15 pm
by bionuttt
bionuttt wrote:
Sun Feb 19, 2017 3:12 pm
FarAwaY wrote:
Sun Feb 19, 2017 3:00 pm
bionuttt wrote:
Sun Feb 19, 2017 2:52 pm
- [string "Songweaver.lua"]:537: attempt to index field 'Songweaver' (a nil value)

I use script from the top of post but still got this error ( i have lvl 40 )
Try This one viewtopic.php?f=10&t=11&start=20#p185
i did this but now i dont got error but is nothing happen , my character stay afk
Done its work thx for help !

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 4:55 pm
by bionuttt
why my character dont use Battle Variation?

this is code in the script:
-- Battle Variation
if Entity:GetHealth() >= 10 and Helper:CheckAvailable( "Battle Variation" ) and Helper:CheckAvailable( "Tsunami Requiem" ) and Position:DistanceToPosition( Entity:GetPosition()) >= 12 then
Helper:CheckExecute( "Battle Variation");
return false;

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 5:32 pm
by FarAwaY
bionuttt wrote:
Sun Feb 19, 2017 4:55 pm
why my character dont use Battle Variation?

this is code in the script:
-- Battle Variation
if Entity:GetHealth() >= 10 and Helper:CheckAvailable( "Battle Variation" ) and Helper:CheckAvailable( "Tsunami Requiem" ) and Position:DistanceToPosition( Entity:GetPosition()) >= 12 then
Helper:CheckExecute( "Battle Variation");
return false;
Check the Skill Names maybe they are wrong.

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 7:10 pm
by bionuttt
FarAwaY wrote:
Sun Feb 19, 2017 5:32 pm
bionuttt wrote:
Sun Feb 19, 2017 4:55 pm
why my character dont use Battle Variation?

this is code in the script:
-- Battle Variation
if Entity:GetHealth() >= 10 and Helper:CheckAvailable( "Battle Variation" ) and Helper:CheckAvailable( "Tsunami Requiem" ) and Position:DistanceToPosition( Entity:GetPosition()) >= 12 then
Helper:CheckExecute( "Battle Variation");
return false;
Check the Skill Names maybe they are wrong.
the name is good

Re: Songweaver.lua by myself

Posted: Sun Feb 19, 2017 8:49 pm
by locatelli
bionuttt wrote:
Sun Feb 19, 2017 4:55 pm
why my character dont use Battle Variation?

this is code in the script:
-- Battle Variation
if Entity:GetHealth() >= 10 and Helper:CheckAvailable( "Battle Variation" ) and Helper:CheckAvailable( "Tsunami Requiem" ) and Position:DistanceToPosition( Entity:GetPosition()) >= 12 then
Helper:CheckExecute( "Battle Variation");
return false;
Edit it like that
-- Battle Variation
if Entity:GetHealth() >= 10 and Helper:CheckAvailable( "Battle Variation" ) and Position:DistanceToPosition( Entity:GetPosition()) >= 12 then
Helper:CheckExecute( "Battle Variation");
return false;

it works