[Tutorial] How to create Custom Monster AI

05/07/2014 19:59 Hasi105#16
How to use "LuaUpdateInsZonePortal" ... my portal in CS wont able to open with (1001, 0) or maybe i missed how to readout the portal id....

btw: How to disable / enable a portal?

pls tell me....ty
05/09/2014 14:17 nubness#17
Take a look at the AI files for Eternal, Huistaton, Gargadel, Luhiel.
05/09/2014 15:47 Hasi105#18
I know defeating one should open the gate.... but it doesnt.... thats why i dont know how to permanent open this gate

EDIT:
-Found the problem with perm open.....(in the 65.svmap / 66.svmap is the faciton number 1001) thats the problem ( set it to the faction and it works ) * my problem is solved now *
03/08/2015 13:23 JuuF#19
Did anybody find something about LuaRecallUser? Atleast, does anybody do tests about these except me?
03/08/2015 22:19 RealChew#20
Hi JuuF

Yep, i know how to use the LuaRecallUser.

LuaRecallUser can receive 6 args :

- The first is the Job of the toon (per example : 0 for Fighters and Warriors, 1 for Defenders and Guardians, ...).
- The second is the range in metters.
- The 3rd is the map (if missing, it will use automatically the map 0)
- 4th is the X coordinate value (optional)
- 5th is the Y coodinate value (optional)
- 6th is the Z coordinate value (optional)

Then, if you use :
Code:
Mob:LuaRecallUser(4, 100,  39, 65.000, 2.985, 67.000)
The mob will Recall all of Pagans/Mages within 100 metters area to the map 39 at X=65.000, Y=2.985 and Z=67.000

As i said, the coordinate value are optionals, if you just use :
Code:
Mob:LuaRecallUser(4, 100, 39)
The Pagans/Mage will be recall to the mob position.
Ofc, the mob must be in the map 39 in this case, or the pagans will be summon to this map.
And if you don't use the map arg, the toons will be summon to the map 0.

See you :)
03/09/2015 07:23 JuuF#21
Thank you so much, this will be pretty enough for my tests. I was missing the 'job' column and after some disconnects i was about to give up. I really appreciate this. This will help me to solve most of my problems :P
05/09/2015 03:20 Big_#22
Fixed my issews thanx for the tut
01/16/2016 10:24 AxelMac#23
i have make this script, but not working :( anyone can help me please ?


Fixed
02/01/2017 11:54 Fordmondeo20#24
Hey, does anybody know how to select mobs which are created through the AI?

A negative example:
Code:
Guard1		= 0
Guard2		= 0
Guard3		= 0

function Init()
	Guard1 = Mob:LuaCreateMob(68, 0, 20.73, 69.96)
	Guard2 = Mob:LuaCreateMob(68, 0, 26.79, 75.66)
	Guard3 = Mob:LuaCreateMob(68, 0, 35.35, 75.42)
end
Does it probably work with LuaGetMobUID in any way?
04/26/2017 22:46 saler23#25
Quote:
Originally Posted by RealChew View Post
Hi JuuF

Yep, i know how to use the LuaRecallUser.

LuaRecallUser can receive 6 args :

- The first is the Job of the toon (per example : 0 for Fighters and Warriors, 1 for Defenders and Guardians, ...).
- The second is the range in metters.
- The 3rd is the map (if missing, it will use automatically the map 0)
- 4th is the X coordinate value (optional)
- 5th is the Y coodinate value (optional)
- 6th is the Z coordinate value (optional)

Then, if you use :
Code:
Mob:LuaRecallUser(4, 100,  39, 65.000, 2.985, 67.000)
The mob will Recall all of Pagans/Mages within 100 metters area to the map 39 at X=65.000, Y=2.985 and Z=67.000

As i said, the coordinate value are optionals, if you just use :
Code:
Mob:LuaRecallUser(4, 100, 39)
The Pagans/Mage will be recall to the mob position.
Ofc, the mob must be in the map 39 in this case, or the pagans will be summon to this map.
And if you don't use the map arg, the toons will be summon to the map 0.

See you :)
only the coordinates are optional? what if we don't want to put the class and the range, and just summon everyone out from the map where the mob is?
04/27/2017 13:25 saler23#26
Quote:
Originally Posted by Cups​ View Post
Well if there isn't a value for multiple classes (have you tried higher values?), then you could always just cheat and use a for loop.
Code:
-- The classes who will be teleported
local classes = {0, 2, 3}

-- Loop through the classes and teleport those specific
for _, class in pairs(classes) do
    Mob:LuaRecallUser(class, -1, 39)
    Mob:LuaRecallUser(class, math.huge, 39) -- You could try something like one of these if you didn't want to specify a range
end

Thanks for the help Cups, by the way, i've tried both, and it doesn't works, also, i've tried 2 others ways:

- for variable = 0, 5, 1 do
Mob:LuaRecallUser(variable, 100, 39)
end

- i = 0
while i <= 5 do
Mob:LuaRecallUser(i, 100, 39)
i = i + 1
end

but it doesn't work, doesn't summon anyone, but by adding the right class value, like Mob:LuaRecallUser(0, 100, 39) it summons out, but just the class i insert into the lua script... a bit stuck on it
04/27/2017 20:35 sominus#27
Try this:

Code:
while( iclass <=  5 )
do
   Mob:LuaSay ('iclass '..iclass,50) --print iclass current value (for test)
   Mob:LuaRecallUser(iclass, 10, 35)
   iclass = iclass + 1
end
I don't know if you're using this in the 'WhileCombat' function. If so, keep in mind that using 'local iclass = 0' will reset the value to zero each time, reseting the loop.

You could just put 'iclass = 0' at the start of the script, before all the functions.

This is the sample used as a test (tested with a fighter only):

04/27/2017 22:56 kolin79#28
Add ai to any monster.
Then register the monster IDs you want to delete

Mob = LuaMob(CMob)

function Init()
--You can add as many monsters as you like
Mob:LuaDeleteMob ( 3005, 0, 0.0, 0.0, 500.0)
Mob:LuaDeleteMob ( 3006, 0, 0.0, 0.0, 500.0)
Mob:LuaDeleteMob ( 3007, 0, 0.0, 0.0, 500.0)
end

The monsters on the current map are deleted

Here spawn monsters for certain coordinates

Mob = LuaMob(CMob)

function OnDeath( dwTime, dwAttackedCount )
-- ID, number, x, z
Mob:LuaCreateMob(3015,1,150.0,535.0)
end
05/03/2017 16:39 saler23#29
i think i'm getting crazy, by the way, thanks everyone for the help, i fixed the summon script and it works pretty well now... but, i can swear i saw the function OnRespawn some days ago... just figured out how i have to build the script i need, and i can't find the OnRespawn function anymore... does it exists or i just dreamed it?
10/28/2017 12:18 mr.hellraven#30
bCharID = Mob:LuaGetMinAggro()
bCharName = Mob:LuaGetName( bCharID )
Mob:LuaSay( 'test ' .. bCharName .. ', are you afraid to die?', 20.0 )'

how to make them speak Russian ?!