Official: Songweaver.lua

javito
Posts: 11
Joined: Tue Jan 17, 2017 1:51 am
Been thanked: 1 time

Re: Songweaver.lua by myself

Post by javito » Sun Feb 19, 2017 12:07 pm

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

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Songweaver.lua by myself

Post by locatelli » Sun Feb 19, 2017 12:48 pm

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

bionuttt
Posts: 43
Joined: Sun Feb 05, 2017 8:25 pm
Has thanked: 5 times
Been thanked: 2 times

Re: Songweaver.lua by myself

Post by bionuttt » 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 )

User avatar
FarAwaY
Posts: 48
Joined: Sun Jan 29, 2017 9:31 pm
Has thanked: 22 times
Been thanked: 13 times

Re: Songweaver.lua by myself

Post by FarAwaY » 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
Image

bionuttt
Posts: 43
Joined: Sun Feb 05, 2017 8:25 pm
Has thanked: 5 times
Been thanked: 2 times

Re: Songweaver.lua by myself

Post by bionuttt » 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

bionuttt
Posts: 43
Joined: Sun Feb 05, 2017 8:25 pm
Has thanked: 5 times
Been thanked: 2 times

Re: Songweaver.lua by myself

Post by bionuttt » Sun Feb 19, 2017 3:15 pm

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 !

bionuttt
Posts: 43
Joined: Sun Feb 05, 2017 8:25 pm
Has thanked: 5 times
Been thanked: 2 times

Re: Songweaver.lua by myself

Post by bionuttt » 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;

User avatar
FarAwaY
Posts: 48
Joined: Sun Jan 29, 2017 9:31 pm
Has thanked: 22 times
Been thanked: 13 times

Re: Songweaver.lua by myself

Post by FarAwaY » 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.
Image

bionuttt
Posts: 43
Joined: Sun Feb 05, 2017 8:25 pm
Has thanked: 5 times
Been thanked: 2 times

Re: Songweaver.lua by myself

Post by bionuttt » Sun Feb 19, 2017 7:10 pm

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

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Songweaver.lua by myself

Post by locatelli » Sun Feb 19, 2017 8:49 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;
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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest