1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/python
# -*- coding: GBK -*-
 
##@package SummonNPC
# ÔÚÉí±ßË¢NPC <NPCID> [ÊýÁ¿] Ä¬ÈÏÊýÁ¿:1
#
# @author Mark
# @date 2010-4-23
# @version 1.0
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
# VER = "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ
#
# Ä£¿éÏêϸ˵Ã÷
import GameMap
import ChConfig
import GameWorld
import NPCCommon
 
#
#Âß¼­ÊµÏÖ
## ÔÚÉí±ßË¢ÕÙ»½NPC <NPCID> [ÊýÁ¿] Ä¬ÈÏÊýÁ¿:1
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param list ²ÎÊýÁбí [tagID, NPCCount]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, list):
#===============================================================================
#    #¼ì²âµ±Ç°Íæ¼ÒÊÇ·ñÓÐȨÏÞ
#    #if 
#    #µÚÒ»½×¶Î²»´¦Àí
#===============================================================================
    
    #ÊäÈëÃüÁî¸ñʽ´íÎó
    if len(list)<1 or len(list)>2:
        return
    #NPC¶ÔÏóID
    tagID=list[0]
    
    if not GameWorld.GetGameData().FindNPCDataByID(tagID):
        return
        
    
    #NPCË¢ÐÂÊýÁ¿
    if len(list)==1:
        #ĬÈÏÊýÁ¿1
        NPCCount=1
    else:
        #GMÊäÈëµÄÊýÁ¿
        NPCCount=list[1]
    
    for i in range(0,NPCCount):
        #ÔÚÍæ¼ÒÖÜΧѡÔñÒ»¸öÎÞÍæ¼ÒµÄµã
        resultPos=GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(),curPlayer.GetPosY(),6)
        #Éú³ÉNPC
        summonNPC = curPlayer.SummonNewNPC()
        summonNPC.SetNPCTypeID(tagID)
        summonNPC.SetAIType(200)
        summonNPC.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count)
        #³õʼ»¯
        NPCCommon.InitNPC(summonNPC) 
        summonNPC.SetOwner(curPlayer)
        
        #Íæ¼ÒÕÙ»½ÊÞÁбíÌí¼ÓÕÙ»½ÊÞ,ÕÙ»½ÊÞÌí¼ÓÖ÷ÈË
        summonNPC.Reborn(resultPos.GetPosX(), resultPos.GetPosY())