[HELP] Custom AI

10/28/2018 16:12 AdamJansen#1
Hello everyone, i've started working on some custom lua files, i've followed Nubness Guide released here on epvp and i've tried to make a boss talk, use a skill and spawn some mobs on certain HP % but it doesn't work, i doesn't do anything and yes, i'm sure i add the AI to the monster in both Database and Client, i've tried with both MobSay and MobSayByIndex and yes i edited the sys-uni file or whatever it is called.

This is the script i'm talking about

-- //////////////////////////////////////////////////////////////////////
-- 카일룸 사크라 보스 1차 보스 몬스터_ID-5499 AI 120.Lua ver.090513
-- //////////////////////////////////////////////////////////////////////



-- //////////////////////////////////////////////////////////////////////

Mob = LuaMob(CMob)

-- //////////////////////////////////////////////////////////////////
-- 사용자 변수는 여기에 선언합니다.
dwNextCreateTime = 0
bMobSay = 0
bMobCreate = 0
bMobAttack=0

-- //////////////////////////////////////////////////////////////////
-- 사용자 함수는 여기에 선언합니다.


-- //////////////////////////////////////////////////////////////////
function Init()

end

-- //////////////////////////////////////////////////////////////////
function OnAttacked( dwTime, dwCharID )

end

-- //////////////////////////////////////////////////////////////////
function OnAttackable( dwTime, dwCharID )

end

-- //////////////////////////////////////////////////////////////////
function OnNormalReset( dwTime )


end

-- //////////////////////////////////////////////////////////////////
function OnDeath( dwTime, dwAttackedCount )

end

-- //////////////////////////////////////////////////////////////////
function OnReturnHome( dwTime, dwAttackedCount )

end

-- //////////////////////////////////////////////////////////////////
function OnMoveEnd( dwTime )

end


-- //////////////////////////////////////////////////////////////////
function WhileCombat( dwTime, dwHPPercent, dwAttackedCount )
if ( dwHPPercent <= 75 ) then
if ( bMobSay < 1) then
Mob:LuaSayByIndex ( 10127, 200.0 )
bMobSay = bMobSay + 1
end
if (bMobAttack <1) then
Mob:LuaAttackAI ( 336 )
bMobAttack=bMobAttack + 1
end
end
if ( dwHPPercent <= 70 ) then
if ( bMobSay < 2) then
Mob:LuaSayByIndex ( 10128, 200.0 )
bMobSay = bMobSay + 1
end
if (bMobAttack <2) then
Mob:LuaAttackAI ( 133 )
bMobAttack=bMobAttack + 1
end
end
if ( dwHPPercent <= 50 ) then
if ( bMobSay < 3) then
Mob:LuaSayByIndex ( 10129, 200.0 )
bMobSay = bMobSay + 1
end
if (bMobAttack <3) then
Mob:LuaAttackAI ( 336 )
bMobAttack=bMobAttack + 1
end
end
if ( dwHPPercent <= 45 ) then
if ( bMobSay < 4) then
Mob:LuaSayByIndex ( 10130, 200.0 )
bMobSay = bMobSay + 1
end
if (bMobAttack <4) then
Mob:LuaAttackAI ( 133 )
bMobAttack=bMobAttack + 1
end
end
if ( dwHPPercent <= 25 ) then
if ( bMobSay < 5) then
Mob:LuaSayByIndex ( 10131, 200.0 )
bMobSay = bMobSay + 1
end
Mob:LuaCreateMob ( 3072, 1, 0.0, 0.0 )
Mob:LuaCreateMob ( 3073, 1, 0.0, 0.0 )
end

end

Hope someone is able to give me some hits about how to solve this annyoing issue because i'm kinda stuck
10/29/2018 01:56 sinon95#2
test changing Mob:LuaSayByIndex for Mob:LuaSay ( ' some phrase', 60.0 )
10/29/2018 22:06 AdamJansen#3
okay, i found the error on that file, it was cause of some extra not needed END. Now i'm experiencing a different issue with another file. This is the error i'm getting into the logs:

.\Data\Lua\140.lua:61: ')' expected near '='

and this is the interested code line:

if ( dwHPPercent = 75 ) then
10/31/2018 02:17 Fordmondeo20#4
LUA don't like any spaces in some situations (or in all situations?).
Type if(dwHPPercent=75) and tell us if it works.