Lets say I've got a bunch'o orcs spawning around. How would a script find if I were to kill them?
{ set_count_orc_death //addparam
setvard NPC_COUNT_ORC_DEATH 1
}
{ game_death
if NPC_COUNT_ORC_DEATH
callexternal GAME_MASTER gm_dead_orc_count
}
{ gm_dead_orc_count
if !GM_DID_DEAD_ORC_TRIGGER
add GM_DEAD_ORC_COUNTER 1
if GM_DEAD_ORC_COUNTER >= GM_DEAD_ORC_MAX
setvard GM_DID_DEAD_ORC_TRIGGER 1 //flag so we don't repeat this final event
callevent gm_dead_orc_trigger
}
{ gm_dead_orc_trigger
[ whatever you want to happen when the requisite number of orcs defined in GM_DEAD_ORC_MAX are dead ]
}
createnpc <some_script> <some_loc> addparams "set_count_orc_death"
{ gm_dq_death_counter //PARAM1 = name of monster to count, or partial name. All for counting all of 'em. Not scriptname! PARAM2 = 1 or 0 greatguys1 July2016
setvard DQ_DEATHS 0
setvard DQ_COUNT_WHO PARAM1
setvard DQ_COUNT_DEATHS PARAM2
}
{ gm_dq_add_death //PARAM1 = name of monster greatguys1 July2016
if ( PARAM1 contains DQ_COUNT_WHO )
{
setvard DQ_DEATHS $math(add,DQ_DEATHS,1)
}
else if ( PARAM1 equals 'all' )
{
setvard DQ_DEATHS $math(add,DQ_DEATHS,1)
}
}
{ game_death
if ( $get(GAME_MASTER,scriptvar,'DQ_COUNT_DEATHS') == 1 ) //greatguys1 July2016
{
callexternal GAME_MASTER gm_dq_add_death $get($get(ent_me,id),name)
}
}
if ( $get(GAME_MASTER,scriptvar,'DQ_DEATHS') >= DQ_KILL_NUM )
{
setvard QUEST_MODE "complete"
}
{ game_death
if ( $get(GAME_MASTER,scriptvar,'DQ_COUNT_DEATHS') ) //greatguys1 July2016
{
callexternal GAME_MASTER gm_dq_add_death $get(ent_me,name)
}
}
//By greatguys1
//Best viewed in EditPlus with the ms.stx applied
//This is meant to be included into the monsters\externals.script!!! This doesn't work on its own!
{ game_death
callexternal GAME_MASTER gm_dq_add_death $get(ent_me,name) $get(ent_me,origin) //Various params passed are stored on the game_master so other scripts can look at them later if they need to. Add more as needed
}
//By greatguys1
//Best viewed in EditPlus with the ms.stx applied
//This is supposed to be included into the game master! This does not work on its own!
{ gm_dq_add_counter //PARAM1 = ID that you wanna call back greatguys1 July2016
if ( !$get_array(DQ_DEATH_CALLBACK_IDS,exists) )
{
array.create DQ_DEATH_CALLBACK_IDS
}
array.add DQ_DEATH_CALLBACK_IDS PARAM1
}
{ gm_dq_perish_counter //PARAM1 = ID that you want to perish the counter with
local L_DEL_IDX $get_arrayfind(DQ_DEATH_CALLBACK_IDS,PARAM1)
if ( L_DEL_IDX != -1 )
{
array.del DQ_DEATH_CALLBACK_IDS L_DEL_IDX
}
}
{ gm_dq_add_death //PARAM1 = name of monster PARAM2 = MonsterOrigin greatguys1 July2016
setvard DQ_KILLED_MONSTER_NAME PARAM1
setvard DQ_KILLED_MONSTER_ORIGIN PARAM2
calleventloop $get_array_amt(DQ_DEATH_CALLBACK_IDS) gm_dq_monster_death_callbacks
}
{ gm_dq_monster_death_callbacks
callexternal $get_array(DQ_DEATH_CALLBACK_IDS,game.script.iteration) ext_quest_monster_killed
}