• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Ether Saga] .lua Problem Territory War

Newbie Spellweaver
Joined
Jun 9, 2014
Messages
16
Reaction score
0
Not sure what was wrong with my last post but hopefully i covered it in this new one.. The original .lua file that controls tw had major problem such as " indefinite repeat of tw announcement that it had started it wouldn't end or release the alliance holding land at the time it started ive worked it down to the announcement donst repeat now tw ends on time but the additional problems are as follows tw ends but dosnt stay ended also it dosnt released that territory owner when tw starts... Here is a copy of the lua file maybe someone could give it a look over an give me some insight into the problem..

a28.lua:

local starttime={ }
local battletime={ }
local timer={ }
local protect_time=0


function checktimer(index)
battletime=os.time()-starttime[index]
if battletime>=timer[index] then
return true
else
return false
end
end

function starttimer(index,lastfor)
starttime[index]=os.time()
timer[index]=lastfor
end

function restarttimer(index)
starttime[index]=os.time()
end
--211鍗犻搴?212棰嗗湡璧勯噾,213甯紬濂栧姳绉疮鍊?214棰嗗湡鎴樻枟涓庡惁,750x2涓績鐭?751x2涓績鐭垮叧闂€?752鎺у埗鎬嚜韬?
--21106鍒锋柊鎺у埗鎬?21107涓績鐭垮彫鍞ゆ€?21108涓績鐭垮叧闂€?
function Main(ai)
local id=ai:TemplateID()
local server=ai:ServerID()
if id==21106 then
if server==8 then
if ai:GetGlobalData(211)>1000 then ai:SetGlobalData(211,1000) end
if ai:GetGlobalData(211)<0 then ai:SetGlobalData(211,0) end
ai:SetGlobalData(214,0)
while 1 do
local domain = ai:GetGlobalData(211)
local domainmoney = ai:GetGlobalData(212)
local domainbattle = ai:GetGlobalData(214)
local time=os.date("%H:%M")
if domain<=0 and domainbattle==0 and protect_time<=0 then
ai:ActiveSpawner(750,true)
ai:Say("$AThe Territory of Gallio Kingdom is open for a Territory War!")
ai:SetGlobalData(214,1)
domainbattle=1
ai:SetPKRegion(744,true)
elseif domain >= 100000000 and protect_time<=0 then
protect_time=4*3600-600 --4灏忔椂淇濇姢
end
ai:Sleep(15)
--淇濇姢鏃堕棿鐩稿叧鎿嶄綔
if protect_time>30 then protect_time=protect_time-30 end --淇濇姢鏃堕棿澶т簬30,鍒欎繚鎶ゆ椂闂村噺灏?0绉?
if protect_time==30 then ai:Sleep(30);protect_time=0;ai:SetGlobalData(211,1000);ai:Say("$AThe Territory of Gallio Kingdom is no longer under system protection!") end --淇濇姢鏃堕棿绛変簬300,鍒?0绉掑悗灏嗗崰鏈夊害璁剧疆涓烘甯稿€?浠?000寮€濮嬮檷,骞朵笖淇濇姢鏃堕棿璁剧疆涓?
--18:00寮哄埗寮€鍚?20:00寮哄埗鍏抽棴
if time=="18:00" and domainbattle==0 and (os.date("%w")=="2" or os.date("%w")=="4" or os.date("%w")=="6" or os.date("%w")=="0")then --18:00鏈浜庢垬鏂楃姸鎬佸己鍒跺紑鍚?
protect_time=0
ai:ActiveSpawner(750,true)
ai:Say("$AThe Gallio Global Agent has set the Territory open for a Territory War!")
ai:SetGlobalData(214,1)
domainbattle=1
ai:SetPKRegion(744,true)
elseif time=="20:00" and domainbattle==1 and (os.date("%w")=="2" or os.date("%w")=="4" or os.date("%w")=="6" or os.date("%w")=="0") then --20:00澶勪簬寮€鍚姸鎬佹椂寮哄埗缁撴潫
ai:ActiveSpawner(750,false)
ai:SetPKRegion(744,false)
ai:SetGlobalData(211,0)
ai:SetGlobalData(214,0)
domainbattle=0
ai:Say("$AThe Territory War of Gallio Kingdom has been closed by the Local Agent!")
ai:TerritoryBattleEnd(2)
end
--鏃犲崰棰嗗府娲剧珛鍒诲紑鍚鍦熶簤澶?
if ai:GetOccupyFaction(2)==0 and domainbattle==0 then
protect_time=1
ai:SetGlobalData(211,100000000)
ai:ActiveSpawner(750,true)
ai:Say("$AThe Gallio Global Agent has set the Territory open for a Territory War!")
ai:SetGlobalData(214,1)
domainbattle=1
ai:SetPKRegion(744,true)
end
--瀹氭椂娓呯┖缁忛獙绉疮濂栧姳
if time=="08:01" or time=="12:01" or time=="16:01" or time=="20:01" or time=="00:01" then
ai:SetGlobalData(213,0)
end
--灏?13鎶樼畻鎴?15,鏈€澶у€间负4,姣?000涓€妗?
local temp1=ai:GetGlobalData(213)
local temp2=math.floor(temp1/10000)
if temp1>=40000 then
ai:SetGlobalData(215,4)
else
ai:SetGlobalData(215,temp2)
end
ai:Sleep(15)
end
else
ai:ActiveSpawner(752,false)
end
elseif id==21107 then
ai:ActiveSpawner(751,false)
ai:Sleep(5)
ai:CastSkill(ai:GetSelf(),489,1)
elseif id==21108 then
ai:Sleep(590)
ai:ActiveSpawner(750,false)
end
end

function OnDeath(ai,idAttacker)
local id=ai:TemplateID()
local server=ai:ServerID()
if id==21107 then
ai:SetGlobalData(212,0)
ai:SetGlobalData(213,0)
ai:ActiveSpawner(751,true)
elseif id==21108 then
ai:SetPKRegion(744,false)
ai:ActiveSpawner(750,false)
ai:SetGlobalData(211,2000000000)
ai:SetGlobalData(214,0)
ai:TerritoryBattleEnd(2)
end
end

function Battle(ai)
end

function OnReborn(ai)
end

function OnStartCombat(ai)
end

function OnEndCombat(ai)
end

function OnPathEnd(ai,pathid)
end

function OnGreeting(ai,who,faction)
end


function OnSkillAttacked(ai,who,master,skill_id)
end

function OnScriptEvent(aiObj, who, param1, pararm2)
end

P.S. Thanks for any help ahead of time
 
git bisect -m
Loyal Member
Joined
Sep 2, 2011
Messages
2,171
Reaction score
916
If lua gives error. Try going to sun.

Can you give image with error? And valid UTF-8 Characters. I don't know how to read in these languages. And i wont use google translate.
 
Upvote 0
Newbie Spellweaver
Joined
Jun 9, 2014
Messages
16
Reaction score
0
ya i can get it translated for u



local starttime={ }
local battletime={ }
local timer={ }
local protect_time=0


function checktimer(index)
battletime=os.time()-starttime[index]
if battletime>=timer[index] then
return true
else
return false
end
end

function starttimer(index,lastfor)
starttime[index]=os.time()
timer[index]=lastfor
end

function restarttimer(index)
starttime[index]=os.time()
end
--201 Occupation degree , 202 territorial capital, accumulated 203 reward Bangzhong value , 204 territorial battle or not , 745x1 center Mine , 746x1 center closed mine blame , blame their own control 747
--21103 Refresh control strange , 21,104 call center ore strange , 21105 Center strange ore Close
function Main(ai)
local id=ai:TemplateID()
local server=ai:ServerID()
if id==21103 then
if server==8 then
if ai:GetGlobalData(201)>1000 then ai:SetGlobalData(201,1000) end
if ai:GetGlobalData(201)<0 then ai:SetGlobalData(201,0) end
ai:SetGlobalData(204,0)
while 1 do
local domain = ai:GetGlobalData(201)
local domainmoney = ai:GetGlobalData(202)
local domainbattle = ai:GetGlobalData(204)
local time=os.date("%H:%M")
if domain<=0 and domainbattle==0 and protect_time<=0 then - Occupation of less than 0, and non-combatants and non-protected time, the open territory war x1 ai:ActiveSpawner(745,true)
ai:Say("$AThe Territory of Gaap Lands is open for a Territory War!")
ai:SetGlobalData(204,1)
domainbattle=1
ai:SetPKRegion(742,true)
elseif domain >= 100000000 and protect_time<=0 then - The occupation of more than 1 billion , and non- combat protection within time , then the guard time is set to 4 hours
protect_time=4*3600-600 --4 -Hour protection , must be an integer multiple of 30 seconds
end
ai:Sleep(15)
- Protection of the time -related operations
if protect_time>30 then protect_time=protect_time-30 end --- Protection of time greater than 30, the protection time is reduced 30 seconds
if protect_time==30 then ai:Sleep(30);protect_time=0;ai:SetGlobalData(201,1000);ai:Say("$AThe territory of Gaap Lands is no longer under system protection!") end --Guard time equal to 300 , then 30 seconds will be set to normal occupancy degree , from the beginning of fall 1000 , and the guard time is set to 0
--18 : 00 forced open , 20:00 forced to shut down
if time=="18:00" and domainbattle==0 and (os.date("%w")=="2" or os.date("%w")=="4" or os.date("%w")=="6" or os.date("%w")=="0") then --18:00 is not in a state of war forced open
protect_time=0
ai:ActiveSpawner(745,true)
ai:Say("$AThe Gaap Global Agent has set the Territory open for a Territory War!")
ai:SetGlobalData(204,1)
domainbattle=1
ai:SetPKRegion(742,true)
elseif time=="20:00" and domainbattle==1 and (os.date("%w")=="2" or os.date("%w")=="4" or os.date("%w")=="6" or os.date("%w")=="0") then --20:00Forced end is turned
ai:SetPKRegion(742,false)
ai:ActiveSpawner(745,false)
ai:SetGlobalData(201,2000000000)
ai:SetGlobalData(204,0)
ai:Say("$AThe Territory War of Gaap Lands has been closed by the Local Agent!")
ai:TerritoryBattleEnd(1)
end
- No occupation gangs compete for territory immediately open
if ai:GetOccupyFaction(1)==0 and domainbattle==0 then
protect_time=0
ai:SetGlobalData(201,0)
ai:ActiveSpawner(745,true)
ai:Say("$AThe Gaap Global Agent has set the Territory open for a Territory War!")
ai:SetGlobalData(204,1)
domainbattle=1
ai:SetPKRegion(742,true)
end
--Empty the timing of accumulated experience reward
if time=="08:01" or time=="12:01" or time=="16:01" or time=="20:01" or time=="00:01" then
ai:SetGlobalData(203,0)
end
--Will be converted into 205 203 and a maximum of 4 , a file per 10,000
local temp1=ai:GetGlobalData(203)
local temp2=math.floor(temp1/10000)
if temp1>=40000 then
ai:SetGlobalData(205,4)
else
ai:SetGlobalData(205,temp2)
end
ai:Sleep(15)
end
else
ai:ActiveSpawner(747,false)
end
elseif id==21104 then
ai:ActiveSpawner(746,false)
ai:Sleep(5)
ai:CastSkill(ai:GetSelf(),489,1)
elseif id==21105 then
ai:Sleep(590)
ai:ActiveSpawner(745,false)
end
end

function OnDeath(ai,idAttacker)
local id=ai:TemplateID()
local server=ai:ServerID()
if id==21104 then
ai:SetGlobalData(202,0)
ai:SetGlobalData(203,0)
ai:ActiveSpawner(746,true)
elseif id==21105 then
ai:SetPKRegion(742,false)
ai:ActiveSpawner(745,false)
ai:SetGlobalData(201,2000000000)
ai:SetGlobalData(204,0)
ai:TerritoryBattleEnd(1)

end
end

function Battle(ai)
end

function OnReborn(ai)
end

function OnStartCombat(ai)
end

function OnEndCombat(ai)
end

function OnPathEnd(ai,pathid)
end

function OnGreeting(ai,who,faction)
end


function OnSkillAttacked(ai,who,master,skill_id)
end

function OnScriptEvent(aiObj, who, param1, pararm2)
end



ai28 had more problems then what im tring to fix i found that if i delete if it starts an stops on time but this part should control that if tw is held by an allaince it should drop the allaince to were the territory isnt held by any at the start of tw but it dosnt an it causes it to not end instead

ai:GetOccupyFaction(1)==0 and domainbattle==0 then
protect_time=0
ai:SetGlobalData(201,0)
ai:ActiveSpawner(745,true)
ai:Say("$AThe Gaap Global Agent has set the Territory open for a Territory War!")
ai:SetGlobalData(204,1)
domainbattle=1
ai:SetPKRegion(742,true)
end
 
Upvote 0
Back
Top