How do I destroy more than one copy of an NPC at a time?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

Each NPC can appear on the same map at the same time. These copies of an NPC have the same apperance and action, but can be in different places, and count as separate NPCs (think clones). Normally when you give an ID number to a plotscripting commands, the command will only affect the first copy of that NPC on the current map, but using the NPC reference command, you can manipulate any copy of an NPC.

Here is a short example script that destroys all copies of a particular NPC ID number

plotscript, destroy npc copies, NPC ID=0, begin

  variable(npc copy) #npc copy counter

  for (npc copy, 1,npc copy count(NPC ID), 1) do, begin # npc copy loop
     destroy npc(npc reference(npc id, 0))     
  end

end


See Also[edit]