PDA

View Full Version : AI For NPC Summon Skill use


goodtimeshaxor
16.03.2007, 01:34
I'm trying to make a summon skill that summons an NPC which will immediatly use one skill and then vanish. Will someone get me off on the right track or is there an AI script that is available for me to play around with and mod.

evern
16.03.2007, 10:15
class 1 spawn_casts_1_spell : default_npc

handler 13 17 // CREATED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // myself
push_const 704
add
fetch_i
push_const 3000
push_const 1000
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
handler_end

handler 12 540 // TIMER_FIRED_EX
variable_begin
"timer_id"
"i0"
"i1"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // timer_id
push_const 236
add
fetch_i4
push_const 3000
equal
branch_false L12899
L12899
handler_end

class_end



class spawn_casts_1_spell : default_npc
{
handler:
EventHandler CREATED()
{
myself->AddTimerEx(3000,1000);
}

EventHandler TIMER_FIRED_EX(timer_id,i0,i1)
{
if( timer_id == 3000 )
{
}
}

}


here's a c4 AI for you to play around, put what you want the summon to do in timer_id == 3000, remember to despawn after that.

goodtimeshaxor
17.03.2007, 10:56
Much appreciated evern. I always see you helping people! This should be great, thanks

Aikeleer
17.03.2007, 11:29
And with that, use i.e:
push_event // myself
push_const 704
add
fetch_i
push_event // master
push_const 552
add
fetch_i // target_id
push_const 444
add
fetch_i4
push_const YourSkill
push_const 0
push_const 0
push_const 1000000
func_call 184877074 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1Or something like this ;)

nnightmare
17.03.2007, 20:06
hmm to not make another topic, is it possible to make an npc that does an skill as soon as its summoned on all the party members but it doesnt dissappear? something like the souless id think..

Aikeleer
18.03.2007, 22:45
Sure, just don't put in a DeSpawn command. I'm not too sure if you can't simply let the summon use an affect_scope=party skill, since that'll save you some AI code. Otherwise take a look at funcs GetParty, Party_GetCount, Party_GetCreature, GetMemberOfParty and perhaps ShowSysMsgToParty2. I think you'll only use getmemberofparty and the membercount. :)

FidoW
18.03.2007, 23:04
Sure, just don't put in a DeSpawn command. I'm not too sure if you can't simply let the summon use an affect_scope=party skill, since that'll save you some AI code. Otherwise take a look at funcs GetParty, Party_GetCount, Party_GetCreature, GetMemberOfParty and perhaps ShowSysMsgToParty2. I think you'll only use getmemberofparty and the membercount. :)

If the summon use a skill like the "Blessing of Queen", "Gift of Queen" and the other similar skill of summons (Cat Queen, Seraphim..) i believe must work good.