[Release] Special NPC Spawn Command

11/30/2017 14:00 Blouflash#1

[Mover.cpp]
In:
Code:
void CMover::Process()
Search for:
Code:
if( (m_nCount & 127) == 0 )
Add this above it:
Code:
#ifdef __EVENT_CMD
			if ((m_nCount & 63) == 0)
				if (m_dwTickCreated > 0 && GetTickCount() > m_dwTickCreated)
					Delete();
#endif // __EVENT_CMD


[FuncTextCmd.cpp]
Search for:
Code:
BOOL TextCmd_ChangeShopCost( CScanner & scanner )
Add this above it:
Code:
#ifdef __EVENT_CMD
BOOL TextCmd_EventCmd(CScanner & scanner)
{
#ifdef __WORLDSERVER
	CUser* pUser = (CUser*)scanner.dwValue;

	if (!IsValidObj(pUser))
		return FALSE;

	CString szKey = "";
	DWORD dwId = scanner.GetNumber();

	scanner.GetToken();
	szKey = scanner.Token;

	DWORD dwSec = 0;
	dwSec = scanner.GetNumber();

	CMover* pMover = (CMover*)CreateObj(D3DDEVICE, OT_MOVER, dwId);
	if (pMover == nullptr)
		return FALSE;

	lstrcpy(pMover->m_szCharacterKey, szKey);
	LPCHARACTER lpChar = pMover->GetCharacter();
	pMover->InitNPCProperty();
	pMover->InitCharacter(lpChar);
	pMover->SetPos(pUser->GetPos());
	pMover->InitMotion(MTI_STAND);
	pMover->UpdateLocalMatrix();

	SAFE_DELETE(pMover->m_pAIInterface);
	pMover->SetAIInterface(AII_NONE);
	pMover->m_dwBelligerence = BELLI_PEACEFUL;

	if(dwSec > 0)
		pMover->m_dwTickCreated = GetTickCount() + SEC(dwSec);
	if(pUser->GetWorld())
		pUser->GetWorld()->ADDOBJ(pMover, true, pUser->GetLayer());

#endif // __WORLDSERVER

	return TRUE;
}
#endif // __EVENT_CMD
Search for:
Code:
	ON_TEXTCMDFUNC( TextCmd_whisper,               "whisper",           "w",              "±Ó¼Ó¸»",         "±Ó",      TCM_SERVER, AUTH_GENERAL      , "±Ó¼Ó¸» [/¸í·É ¾ÆÀ̵𠳻¿ë]" )
Add this above it:
Code:
#ifdef __EVENT_CMD
ON_TEXTCMDFUNC(TextCmd_EventCmd, "EventCmd", "EventCmd", "EventCmd", "EventCmd", TCM_SERVER, AUTH_ADMINISTRATOR, "EventCmd")
#endif // __EVENT_CMD


Ingame use:
Code:
/EventCmd MOVERID NPCSCRIPT TIME
11/30/2017 14:58 - DK#2
Gesehen, Geschrieben und DONE !! Boooom ! Hammer dieser Kerl :) Ein Thanks reicht dafür nicht :)
11/30/2017 15:53 xhien#3
Very useful, thank you!
12/03/2017 21:26 [BlackThief]#4
Very useful, thank you!
12/04/2017 01:41 Zeljian#5
already added and its working.,
12/07/2017 17:28 Burdenz2007#6
Cool. You already have spawned it. Now how do you remove them? :O
That function would be cool for Short NPC Custom Events. A timer for them would be cool to see.
12/07/2017 17:39 Nortix#7
That's exactly what this command has, lol?
12/19/2017 19:12 babyminion#8
where do i define " TextCmd_EventCmd " i got error
12/20/2017 14:42 Nortix#9
Quote:
Originally Posted by babyminion View Post
where do i define " TextCmd_EventCmd " i got error
You are able to read, aren't you? The post literally tells you where to copy it
12/21/2017 06:15 babyminion#10
Quote:
Originally Posted by Nortix View Post
You are able to read, aren't you? The post literally tells you where to copy it
i already did but i got that error? :handsdown:
12/21/2017 10:09 TheRealFoamy#11
Quote:
Originally Posted by babyminion View Post
i already did but i got that error? :handsdown:
Quote:
Originally Posted by Blouflash View Post
[FuncTextCmd.cpp]
Search for:
Code:
BOOL TextCmd_ChangeShopCost( CScanner & scanner )
Add this above it:
Code:
#ifdef __EVENT_CMD
BOOL TextCmd_EventCmd(CScanner & scanner)
{
#ifdef __WORLDSERVER
	CUser* pUser = (CUser*)scanner.dwValue;

	if (!IsValidObj(pUser))
		return FALSE;

	CString szKey = "";
	DWORD dwId = scanner.GetNumber();

	scanner.GetToken();
	szKey = scanner.Token;

	DWORD dwSec = 0;
	dwSec = scanner.GetNumber();

	CMover* pMover = (CMover*)CreateObj(D3DDEVICE, OT_MOVER, dwId);
	if (pMover == nullptr)
		return FALSE;

	lstrcpy(pMover->m_szCharacterKey, szKey);
	LPCHARACTER lpChar = pMover->GetCharacter();
	pMover->InitNPCProperty();
	pMover->InitCharacter(lpChar);
	pMover->SetPos(pUser->GetPos());
	pMover->InitMotion(MTI_STAND);
	pMover->UpdateLocalMatrix();

	SAFE_DELETE(pMover->m_pAIInterface);
	pMover->SetAIInterface(AII_NONE);
	pMover->m_dwBelligerence = BELLI_PEACEFUL;

	if(dwSec > 0)
		pMover->m_dwTickCreated = GetTickCount() + SEC(dwSec);
	if(pUser->GetWorld())
		pUser->GetWorld()->ADDOBJ(pMover, true, pUser->GetLayer());

#endif // __WORLDSERVER

	return TRUE;
}
#endif // __EVENT_CMD
?
01/04/2018 17:17 klangun#12
how do you remove the summoned npc's?
01/05/2018 17:52 xhien#13
Quote:
Originally Posted by klangun View Post
how do you remove the summoned npc's?
/id
- to check the npc's id

/rmvnpc id#
- repleace id# with the number seen in /id
01/06/2018 15:13 klangun#14
Quote:
Originally Posted by xhien View Post
/id
- to check the npc's id

/rmvnpc id#
- repleace id# with the number seen in /id
tnx mate
01/08/2018 21:59 RaptoxxD#15
Am besten bewegen sich die spieler gar nicht mehr selber..
Ganze ticket und was weiß ich was fürn quatsch^^
Könnts verstehen wenn man erst 2 stunden rennen müsste um in die stadt zu kommen, aber da jeder einen teleport hat mitlerweile, unnötig^^
Ist nur meine Meinung, thx kriegste trotzdem für deine Mühe vielleicht kann ja jemand noch was anderes damit anfangen :>