L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SCRIPT: Magical Charge (Please help to fix)
Author Message
versutia4 Offline
Goblin Grave Robber
*

Posts: 12
Joined: Oct 2013
Reputation: 0
Version: 1.4.2.142
Post: #1
SCRIPT: Magical Charge (Please help to fix)

Hi all, I write here because I need some help to make an script for an skill called Magical Charge from a Feoh SoulTaker.

Well, first of all I don't know programming, but reading some threats, I tried and made my own scripts, until now.

What I want or expect with this script?, well, when a monster approaching less 200 from my wizard, He executes that skill called Magical Charge.

Just as I said, I tried to make this script (attached here), but inside L2TowerScript says that all is ok, but in game I get this message:

"Script Error: Lua error (Script not valid) - No matching overload found, candidates: Skill* FindByID(SkillList&,int)"

So, Can anyone help me to fix that please? I'm so sorry if is easy, but honestly I don't know how.

Quote:MagicalChargeSkillID = 11094;
MagicalChargeSkill = GetSkills():FindById(ResSkillId);
TargetInRange = 200;

function MagicalCharge()
if (GetMe():IsAlikeDeath() == false) and (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) and (GetMe():GetRangeTo(Target) < TargetInRange) then
UseSkillRaw(MagicalChargeSkillID, false, false)
Sleep(500);
end;

repeat
MagicalCharge()
until (GetMe():GetRangeTo(Target) > TargetInRange)
Sleep(1000);
end;


Attached File(s)
.lua  MagicalCharge.lua (Size: 478 bytes / Downloads: 15)
08-08-2015 19:05 PM
Find all posts by this user Quote this message in a reply
ExoDo Offline
Restrainer of Glory
*

Posts: 171
Joined: Feb 2014
Reputation: 12
Version: 1.4.2.142
Post: #2
RE: SCRIPT: Magical Charge (Please help to fix)

    LUA Programming
MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);


like this should work
08-08-2015 20:32 PM
Find all posts by this user Quote this message in a reply
versutia4 Offline
Goblin Grave Robber
*

Posts: 12
Joined: Oct 2013
Reputation: 0
Version: 1.4.2.142
Post: #3
RE: SCRIPT: Magical Charge (Please help to fix)

(08-08-2015 20:32 PM)ExoDo Wrote:  
    LUA Programming
MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);


like this should work

Thank you very much, I didn't see my fault. I corrected it and in game doesn't show me any error, but it doesn't work.

The monster approaching and my char doesn't execute the skill. Can you help me with that?
08-08-2015 22:39 PM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #4
RE: SCRIPT: Magical Charge (Please help to fix)

    LUA Programming
MagicalChargeSkillID = 11094;
    MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
    TargetInRange = 200;
 
    function MagicalCharge(targetds)
 
if targetds ~= nil then
    if (GetMe():IsAlikeDeath() == false) and (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) and (GetMe():GetRangeTo(targetds) < TargetInRange) then
    UseSkillRaw(MagicalChargeSkillID, false, false)
    Sleep(500);
    end;
    end;
 
    repeat
MyTRG = nil;
MyTRG = GetMe():GetTarget;
    MagicalCharge(MyTRG)
    until (GetMe():GetRangeTo(MyTRG) > TargetInRange)
    Sleep(1000);
    end;



mby smth like thisd coz u dont have defined "Target"

PUSH [Image: knUu53] IF HELPED
08-09-2015 08:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
versutia4 Offline
Goblin Grave Robber
*

Posts: 12
Joined: Oct 2013
Reputation: 0
Version: 1.4.2.142
Post: #5
RE: SCRIPT: Magical Charge (Please help to fix)

(08-09-2015 08:03 AM)TheQQmaster Wrote:  
    LUA Programming
MagicalChargeSkillID = 11094;
 MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
 TargetInRange = 200;
 
 function MagicalCharge(targetds)
 
if targetds ~= nil then
 if (GetMe():IsAlikeDeath() == false) and (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) and (GetMe():GetRangeTo(targetds) < TargetInRange) then
 UseSkillRaw(MagicalChargeSkillID, false, false)
 Sleep(500);
 end;
 end;
 
 repeat
MyTRG = nil;
MyTRG = GetMe():GetTarget;
 MagicalCharge(MyTRG)
 until (GetMe():GetRangeTo(MyTRG) > TargetInRange)
 Sleep(1000);
 end;



mby smth like thisd coz u dont have defined "Target"

Hi TheQQmaster

Thanks for answer me. I want to tell you that I copied this script, pasted on mine and saved it of course.

In game doesn't show any error but my char doesn't do the skill....He stays casting others skills but when a monster approach him, doesn't do the action Sad

Please help me with that...I will appreciate it

Thanks again
08-09-2015 10:14 AM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #6
RE: SCRIPT: Magical Charge (Please help to fix)

(08-09-2015 10:14 AM)versutia4 Wrote:  
(08-09-2015 08:03 AM)TheQQmaster Wrote:  
    LUA Programming
MagicalChargeSkillID = 11094;
 MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
 TargetInRange = 200;
 
 function MagicalCharge(targetds)
 
if targetds ~= nil then
 if (GetMe():IsAlikeDeath() == false) and (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) and (GetMe():GetRangeTo(targetds) < TargetInRange) then
 UseSkillRaw(MagicalChargeSkillID, false, false)
 Sleep(500);
 end;
 end;
 
 repeat
MyTRG = nil;
MyTRG = GetMe():GetTarget;
 MagicalCharge(MyTRG)
 until (GetMe():GetRangeTo(MyTRG) > TargetInRange)
 Sleep(1000);
 end;



mby smth like thisd coz u dont have defined "Target"

Hi TheQQmaster

Thanks for answer me. I want to tell you that I copied this script, pasted on mine and saved it of course.

In game doesn't show any error but my char doesn't do the skill....He stays casting others skills but when a monster approach him, doesn't do the action Sad

Please help me with that...I will appreciate it

Thanks again
Atm not in home. Will check when i be in home

Sent from my Galaxy S5 via TAPTALK

try to debugg it

    LUA Programming
ShowToClient(tostring(os.date("%X")),"Magical Charge ON",3);		-- debugger - can remowe if all is working
 
 
MagicalChargeSkillID = 11094;						-- check if correct ID of skill, coz there lot skills by name magical charge (11094,23752)
MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
TargetInRange = 200;
 
 
function MagicalCharge(targetds)
	local Me = GetMe();
	if targetds ~= nil then
		ShowToClient(tostring(os.date("%X")),"if my target is not empty",3);		-- debugger - can remowe if all is working
		if not (Me:IsAlikeDeath()) and (Me:GetRangeTo(targetds) < TargetInRange) and
		ShowToClient(tostring(os.date("%X")),"i am not dead and my target is in good range",3);		-- debugger - can remowe if all is working			
    			if  (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) then
				ShowToClient(tostring(os.date("%X")),"i can use skill",3);		-- debugger - can remowe if all is working
    				UseSkillRaw(MagicalChargeSkillID, false, false)
    				Sleep(500);
    			end;
    		end;
	end;
end;
 
repeat
	MyTRG = nil;
	MyTRG = GetMe():GetTarget;
    	MagicalCharge(MyTRG)
	Sleep(1000);
until false;


PUSH [Image: knUu53] IF HELPED
(This post was last modified: 08-09-2015 18:30 PM by TheQQmaster.)
08-09-2015 12:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
versutia4 Offline
Goblin Grave Robber
*

Posts: 12
Joined: Oct 2013
Reputation: 0
Version: 1.4.2.142
Post: #7
RE: SCRIPT: Magical Charge (Please help to fix)

(08-09-2015 12:36 PM)TheQQmaster Wrote:  
(08-09-2015 10:14 AM)versutia4 Wrote:  
(08-09-2015 08:03 AM)TheQQmaster Wrote:  
    LUA Programming
MagicalChargeSkillID = 11094;
 MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
 TargetInRange = 200;
 
 function MagicalCharge(targetds)
 
if targetds ~= nil then
 if (GetMe():IsAlikeDeath() == false) and (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) and (GetMe():GetRangeTo(targetds) < TargetInRange) then
 UseSkillRaw(MagicalChargeSkillID, false, false)
 Sleep(500);
 end;
 end;
 
 repeat
MyTRG = nil;
MyTRG = GetMe():GetTarget;
 MagicalCharge(MyTRG)
 until (GetMe():GetRangeTo(MyTRG) > TargetInRange)
 Sleep(1000);
 end;



mby smth like thisd coz u dont have defined "Target"

Hi TheQQmaster

Thanks for answer me. I want to tell you that I copied this script, pasted on mine and saved it of course.

In game doesn't show any error but my char doesn't do the skill....He stays casting others skills but when a monster approach him, doesn't do the action Sad

Please help me with that...I will appreciate it

Thanks again
Atm not in home. Will check when i be in home

Sent from my Galaxy S5 via TAPTALK

try to debugg it

    LUA Programming
ShowToClient(tostring(os.date("%X")),"Magical Charge ON",3); -- debugger - can remowe if all is working
 
 
MagicalChargeSkillID = 11094; -- check if correct ID of skill, coz there lot skills by name magical charge (11094,23752)
MagicalChargeSkill = GetSkills():FindById(MagicalChargeSkillID);
TargetInRange = 200;
 
 
function MagicalCharge(targetds)
	local Me = GetMe();
	if targetds ~= nil then
 ShowToClient(tostring(os.date("%X")),"if my target is not empty",3); -- debugger - can remowe if all is working
 if not (Me:IsAlikeDeath()) and (Me:GetRangeTo(targetds) < TargetInRange) and
 ShowToClient(tostring(os.date("%X")),"i am not dead and my target is in good range",3); -- debugger - can remowe if all is working 
 if (MagicalChargeSkill ~= nil) and (MagicalChargeSkill:CanBeUsed()) then
 ShowToClient(tostring(os.date("%X")),"i can use skill",3); -- debugger - can remowe if all is working
 UseSkillRaw(MagicalChargeSkillID, false, false)
 Sleep(500);
 end;
 end;
	end;
end;
 
repeat
	MyTRG = nil;
	MyTRG = GetMe():GetTarget;
 MagicalCharge(MyTRG)
	Sleep(1000);
until false;


Hi TheQQmaster

Honestly I used your suggestion, but I got some errors in game with that script.

However, I was testing some things and I get one that works regularly

And I said regularly because sometimes take too time to activate that skill, either when target is near my char and the skill is available to use

Can you check please? Thanks


Attached File(s)
.lua  MagicalCharge.lua (Size: 250 bytes / Downloads: 14)
08-09-2015 22:15 PM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #8
RE: SCRIPT: Magical Charge (Please help to fix)

    LUA Programming
repeat
user = nil;
user = GetTarget();
	if(user ~= nil) and not (user:IsAlikeDeath()) and (GetMe():GetRangeTo(user)< 250) then
 UseSkillRaw(11094,false,false); -- Feoh Soultaker Magical Charge Skill
	end;
	Sleep(1*1000)
until false


PUSH [Image: knUu53] IF HELPED
(This post was last modified: 08-09-2015 23:43 PM by TheQQmaster.)
08-09-2015 23:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply
 Reputed by : versutia4(+1)
versutia4 Offline
Goblin Grave Robber
*

Posts: 12
Joined: Oct 2013
Reputation: 0
Version: 1.4.2.142
Post: #9
RE: SCRIPT: Magical Charge (Please help to fix)

(08-09-2015 23:42 PM)TheQQmaster Wrote:  
    LUA Programming
repeat
user = nil;
user = GetTarget();
	if(user ~= nil) and not (user:IsAlikeDeath()) and (GetMe():GetRangeTo(user)< 250) then
 UseSkillRaw(11094,false,false); -- Feoh Soultaker Magical Charge Skill
	end;
	Sleep(1*1000)
until false


Thank you very much, I will taste it shortly......and I'll tell you how is working.

Hey TheQQmaster

That Script works fine, as much as I wanted. Infact, I did another script called Magical Evasion, is the same thing, only change Skill ID (I'll share here)

Only thing I could see, is when both skills are availables and target is near, in some cases my char executes both skills and doesn't move........practicaly, stays in the same position Smile

For that case, in one script I use Sleep by 1 second, and in the other one, Sleep by 2 seconds.

Again, thank you very much for your time and help.


Attached File(s)
.lua  MagicalEvasion.lua (Size: 252 bytes / Downloads: 12)
.lua  MagicalCharge.lua (Size: 250 bytes / Downloads: 31)
(This post was last modified: 08-10-2015 01:33 AM by versutia4.)
08-10-2015 00:11 AM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #10
RE: SCRIPT: Magical Charge (Please help to fix)

for that add condition if it is like buff type skill

if skill not nil and skill can be used and dont have 2nd skill buff on me use it

PUSH [Image: knUu53] IF HELPED
08-10-2015 12:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)