rORUMI
Expired VIP Member
 
Posts: 278
Joined: May 2014
Reputation: 50
Version:
1.4.2.142
|
RE: Help to cancel target
You can use Canceltarget an Cleartarget
LUA Programming
----------------------------------------------------
function ClearAllTargets()
ClearTargets(); -- Clears all saved targets
CancelTarget(true); -- Cancels active target
Sleep(500)
end
------------------------------------------------------
|
|
08-09-2015 19:53 PM |
|
budarox
Expired VIP Member
 
Posts: 16
Joined: Nov 2012
Reputation: 0
Version:
1.4.2.142
|
RE: Help to cancel target
(08-09-2015 19:53 PM)rORUMI Wrote: You can use Canceltarget an Cleartarget
LUA Programming
----------------------------------------------------
function ClearAllTargets()
ClearTargets(); -- Clears all saved targets
CancelTarget(true); -- Cancels active target
Sleep(500)
end
------------------------------------------------------
I'll test when server back
ty
|
|
08-10-2015 06:12 AM |
|
budarox
Expired VIP Member
 
Posts: 16
Joined: Nov 2012
Reputation: 0
Version:
1.4.2.142
|
RE: Help to cancel target
(08-09-2015 19:53 PM)rORUMI Wrote: You can use Canceltarget an Cleartarget
LUA Programming
----------------------------------------------------
function ClearAllTargets()
ClearTargets(); -- Clears all saved targets
CancelTarget(true); -- Cancels active target
Sleep(500)
end
------------------------------------------------------
Man, this script just stop work, i guess he needs a command "repeat"
but I can't read this in lua configuration, and another question, 500 is 5 seconds ? ty
@rORUMI
|
|
08-10-2015 16:39 PM |
|
ExoDo
Restrainer of Glory

Posts: 171
Joined: Feb 2014
Reputation: 12
Version:
1.4.2.142
|
RE: Help to cancel target
is 0.5 sec, in helper say sleep is take a ms
|
|
08-10-2015 21:00 PM |
|
budarox
Expired VIP Member
 
Posts: 16
Joined: Nov 2012
Reputation: 0
Version:
1.4.2.142
|
RE: Help to cancel target
(08-10-2015 21:00 PM)ExoDo Wrote: is 0.5 sec, in helper say sleep is take a ms
as I set to repeat forever?
|
|
08-10-2015 21:33 PM |
|
rORUMI
Expired VIP Member
 
Posts: 278
Joined: May 2014
Reputation: 50
Version:
1.4.2.142
|
RE: Help to cancel target
Budarox, ClearAllTargets() in a simple function... created by me and used inside a lib of functions.
I Make ans Small test to you. Please Copy and paste the next code like a new script. Run It and letme know if work.
In My test over my iss.
- If target me, a char, a npc, in some secons, my iss lost the target.
- If my iss is using buff, the code wait.. an then cancel the target.
LUA Programming
-- L2TOWER: LUA - CancelMyTarget.lua | rORUMI | <a href="http://www.l2tower.eu" target="_blank">http://www.l2tower.eu</a>
-- Test: Cancel target if pass nTime secons
ShowToClient("Script", "CancelMyTarget v0.1 ACTIVE" , 3);
------------------------------------------------------
nTime = (5*1000) -- 5 sec
myTime = GetTime() -- Global time
----------------------------------------------------
function CheckTime()
local getTime = GetTime();
local getTime = tonumber(getTime);
local checkTime = tonumber(myTime);
local checkTime = myTime + nTime;
if getTime > checkTime then
myTime = GetTime() -- Global time
return true
end
return false
end --fn
----------------------------------------------------
function ClearAllTargets()
ClearTargets(); -- Clears all saved targets
CancelTarget(true); -- Cancels active target
Sleep(1000)
end
------------------------------------------------------
repeat
if not (GetMe():IsAlikeDeath()) and (CheckTime() == true) then
if (GetTarget() ~= nil) and not (GetMe():IsUsingMagic()) then ClearAllTargets() end;
Sleep(500)
else
Sleep(1000)
end
until false
(This post was last modified: 08-11-2015 06:52 AM by rORUMI.)
|
|
08-11-2015 06:49 AM |
|
budarox
Expired VIP Member
 
Posts: 16
Joined: Nov 2012
Reputation: 0
Version:
1.4.2.142
|
RE: Help to cancel target
(08-11-2015 06:49 AM)rORUMI Wrote: Budarox, ClearAllTargets() in a simple function... created by me and used inside a lib of functions.
I Make ans Small test to you. Please Copy and paste the next code like a new script. Run It and letme know if work.
In My test over my iss.
- If target me, a char, a npc, in some secons, my iss lost the target.
- If my iss is using buff, the code wait.. an then cancel the target.
LUA Programming
-- L2TOWER: LUA - CancelMyTarget.lua | rORUMI | <a href="http://www.l2tower.eu" target="_blank">http://www.l2tower.eu</a>
-- Test: Cancel target if pass nTime secons
ShowToClient("Script", "CancelMyTarget v0.1 ACTIVE" , 3);
------------------------------------------------------
nTime = (5*1000) -- 5 sec
myTime = GetTime() -- Global time
----------------------------------------------------
function CheckTime()
local getTime = GetTime();
local getTime = tonumber(getTime);
local checkTime = tonumber(myTime);
local checkTime = myTime + nTime;
if getTime > checkTime then
myTime = GetTime() -- Global time
return true
end
return false
end --fn
----------------------------------------------------
function ClearAllTargets()
ClearTargets(); -- Clears all saved targets
CancelTarget(true); -- Cancels active target
Sleep(1000)
end
------------------------------------------------------
repeat
if not (GetMe():IsAlikeDeath()) and (CheckTime() == true) then
if (GetTarget() ~= nil) and not (GetMe():IsUsingMagic()) then ClearAllTargets() end;
Sleep(500)
else
Sleep(1000)
end
until false
ty
|
|
08-14-2015 06:31 AM |
|