Source-X icon indicating copy to clipboard operation
Source-X copied to clipboard

HardCoded Champion System, Stuck candle

Open alexdan2 opened this issue 5 years ago • 24 comments

Hello, i found a bug in hardcoded champion system.

According to information found in Changelog:

[CHAMPION 01]
	DEFNAME=CHAMPION_Abyss
	NAME=Abyss
	LevelMax=5 //Maximum levels of this champion, for default ones it must be 5 (4 npcgroups + boss)
	Spawns=100 //Total npc spawns for this champion (excepting the boss)
	NPCGroup[1] = c_mongbat, c_imp //Group of npcs for level 1
	NPCGroup[2] = c_gargoyle, c_harpy //Group of npcs for level 2
	NPCGroup[3] = c_gargoyle_fire, c_gargoyle_stone //Group of npcs for level 3
	NPCGroup[4] = c_daemon, c_succubus //Group of npcs for level 4
	CHAMPIONID=c_semidar	//The boss

I get this error ERROR:CCChampion:: Trying to create NPCs from undefined NPCGROUP[5] And champion stuck try to spawn group 5 and not boss. I think core try to search NPCGroup[5] and not switch to boss

I try to set LevelMax= 4 but whit this value champion stuck in this state: image Candle no more count and increase.

This my idol code:

[ITEMDEF i_champion_idol_Azog_Lair]
ID=01f18 
TYPE=t_spawn_champion
NAME=Azog Lair Idol

ON=@Create
	TAG.CHAMP_NAME = "Azog Lair"
	more=CHAMPION_Azog
	ATTR |= ATTR_MOVE_NEVER
	
	
ON=@DClick
IF (<timer> == -1)
	IF <REGION.TAG.IDOL_LINK> != <UID>) // Se la region non ha riferimento al idolo del champion
		REGION.TAG.IDOL_LINK = <UID>
	ENDIF  
	// Pulisco tag vecchi risultati
	CLEARTAGS SESSION_POINT_
	IF (<SRC.ISGM>)
		SRC.REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Start in 5 second
		
		TIMERF 5, SERV.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> started.
		TIMERF 5, start
	ELSE
		IF (<SERV.TIME> > <EVAL (<TAG0.LAST_START> + 144000)>)
			TAG0.LAST_START = <SERV.TIME>
			 
			SRC.REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Start in 5 second
			
			TIMERF 5, SERV.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> started.
			TIMERF 5, start
		ELSE
			SRC.SYSMESSAGE Can't start this champ yet.
		ENDIF
	ENDIF
ELSE
	IF (<SRC.ISGM>)
		REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Stopped.
		stop
	ENDIF
ENDIF 
RETURN 1

ON=@AddWhiteCandle
	REGION.ALLCLIENTS SYSMESSAGE @33 [Campion]: White Candle increase

ON=@AddRedCandle
	REGION.ALLCLIENTS SYSMESSAGE @33 [Campion]: Red Candle increase

This my champ definition:

[CHAMPION 01]
DEFNAME=CHAMPION_Azog
NAME=Azog Lair
LevelMax=5
Spawns=100
NPCGroup[1] = c_goblin_archer, c_orc
NPCGroup[2] = c_goblin_elite_archer, c_orc_lord
NPCGroup[3] = c_orc_picchiatore, c_goblin_shaman2
NPCGroup[4] = c_orc_blood_shaman, c_uruk_warmaster
CHAMPIONID=c_Azog

alexdan2 avatar Dec 11 '20 11:12 alexdan2

https://github.com/Sphereserver/Source-X/blob/109532b04602ec8d97185858b438a9b740032799/src/game/components/CCChampion.cpp#L195 hum i am not sure need to test <= ? or we need change the doc level = group of npc.

Nirad avatar Dec 15 '20 01:12 Nirad

https://github.com/Sphereserver/Source-X/blob/109532b04602ec8d97185858b438a9b740032799/src/game/components/CCChampion.cpp#L195

hum i am not sure need to test <= ? or we need change the doc level = group of npc.

I try LevelMax=4 .. but in this case champion stuck and not loger pop candle (Like only have 3 spawn)

alexdan2 avatar Dec 15 '20 22:12 alexdan2

https://github.com/Sphereserver/Source-X/blob/109532b04602ec8d97185858b438a9b740032799/src/game/components/CCChampion.cpp#L195

hum i am not sure need to test <= ? or we need change the doc level = group of npc.

I try LevelMax=4 .. but in this case champion stuck and not loger pop candle (Like only have 3 spawn)

ok i will test it more in deep on my side thx

Nirad avatar Dec 16 '20 20:12 Nirad

@alexdan2 i just read your feature request here on #477 just to be sure the champion system was working fine a this time you have write this?

Nirad avatar Dec 16 '20 21:12 Nirad

@alexdan2 i just read your feature request here on #477 just to be sure the champion system was working fine a this time you have write this?

Uhmm not sure... I not remember for sure but i think yes. Is more time ago..

alexdan2 avatar Dec 16 '20 21:12 alexdan2

look like this if here is missplaced https://github.com/Sphereserver/Source-X/blob/109532b04602ec8d97185858b438a9b740032799/src/game/components/CCChampion.cpp#L345-L348 i will do more test and push a fix thx. if a place it just before level increment all seems to work good https://github.com/Sphereserver/Source-X/blob/109532b04602ec8d97185858b438a9b740032799/src/game/components/CCChampion.cpp#L339

Nirad avatar Dec 18 '20 17:12 Nirad

@Nirad If need help to test link me a compiled version and i can test it easy :)

alexdan2 avatar Dec 19 '20 21:12 alexdan2

Yeah i have a quick way to kill npc by mass to test this one. i found something about Spawns=100 //Total and SPAWNSMAX in the resource . i wiil fix one thing and finish @Complet trigger and send you the build link.

Capture_decran_le_2020-12-18_a_18 46 12 Capture_decran_le_2020-12-18_a_18 45 41

Nirad avatar Dec 20 '20 02:12 Nirad

I tried with latest build and seems like it is working fine for me when I set levelmax=4

xwerswoodx avatar Dec 22 '20 20:12 xwerswoodx

I tested too whit last release (3353)

I try set levelmax = 4 but champ stuck in this candle situation, i try to kill over 100 bobs but candle no POP,

image

This is champion def code:

[CHAMPION 00]
DEFNAME=CHAMPION_Azog
NAME=Azog Lair
LevelMax=4
Spawns=100
NPCGroup[1] = c_goblin_archer, c_orc
NPCGroup[2] = c_goblin_elite_archer, c_orc_lord
NPCGroup[3] = c_orc_picchiatore, c_goblin_shaman2
NPCGroup[4] = c_orc_blood_shaman, c_uruk_warmaster
CHAMPIONID=c_Azog

alexdan2 avatar Dec 22 '20 21:12 alexdan2

FORCHARS 128
  IF !(<isPlayer>)
    KILL
  ENDIF
ENDFOR
clearAround

[FUNCTION clearAround]
FORITEMS 128
  IF (<TYPE> == t_corpse)
    REMOVE
  ENDIF
ENDIF```

Can you use that functions (if you don't have any) and kill the npcs around quickly.

xwerswoodx avatar Dec 22 '20 22:12 xwerswoodx

FORCHARS 128
  IF !(<isPlayer>)
    KILL
  ENDIF
ENDFOR
clearAround

[FUNCTION clearAround]
FORITEMS 128
  IF (<TYPE> == t_corpse)
    REMOVE
  ENDIF
ENDIF```

Can you use that functions (if you don't have any) and kill the npcs around quickly.

Yep i have .allkill (for kill radius).. For corpse in test mode i simple add a timer=1 in createcorpse (on event of champ mobs).

Anyway i try to use your function for future test... Is possibile for reduce difference in test and result

alexdan2 avatar Dec 23 '20 08:12 alexdan2

Can you send me your champion script? I tried the script you gave before just changing characters but I want to try your one to understand what is the reason.

xwerswoodx avatar Dec 23 '20 14:12 xwerswoodx

@xwerswoodx This all data of my champion test

Champion.zip

alexdan2 avatar Dec 23 '20 21:12 alexdan2

Uhm I tested yesterday night, it working fine for me again. When I set it to 4, it works fine without any issue.

xwerswoodx avatar Dec 24 '20 16:12 xwerswoodx

[CHAMPION 01]
DEFNAME=CHAMPION_Azog1
NAME=Azog Lair
LevelMax=4
Spawns=100
NPCGroup[1] = c_horse_brown_dk
NPCGroup[2] = c_horse_brown_lt
NPCGroup[3] = c_horse_gray
NPCGroup[4] = c_horse_tan
CHAMPIONID=c_Azog

[EVENTS e_spawn_champion]
ON=@DeathCorpse
  ARGO.TIMER = 1

[EVENTS e_boss_champion]
ON=@DEATH
REF1=<I.REGION.TAG.IDOL_LINK>			// Link idolo champion

IF (!<DB.CONNECTED>) // Check DB
  DB.CONNECT
ENDIF

LOCAL.SESSION = <SERV.TIME>
FORCLIENTS 250
  IF <ISONLINE>
    IF ( <REGION.DEFNAME> == <REF1.REGION.DEFNAME> ) // Sono nella region del champ
	  IF (<REF1.TAG0.SESSION_POINT_<UID>> > 0) // Ha dei punti
	    // Inserisci DB
		DB.QUERY INSERT INTO SP_CHAMP_PUNTEGGI (CharID,Punti,CharName,Session,ChampName) VALUES ("<UID>","<EVAL <REF1.TAG0.SESSION_POINT_<UID>>>","<NAME>","<LOCAL.SESSION>","<REF1.TAG.CHAMP_NAME>")
	  ENDIF
	  CTAG0.CHAMP_SESSION = <LOCAL.SESSION>
	ENDIF
  ENDIF
ENDFOR

// Apri dialog score
REGION.ALLCLIENTS TIMERF 3, DIALOG d_champion_end	

[EVENTS e_Champion_Record]
On=@Kill
REF1=<I.REGION.TAG.IDOL_LINK>			// Link idolo champion
IF (<REF1.UID>) // Prevengo errori in caso di mancato link
  REF2 = <I.UID>
  IF (<REF2>) // se link a player valido
    CALL f_call_gigacoso_exp <DEF0.gigacoso_<ARGO.BASEID>>	// Strapolo lvl
    REF1.TAG0.SESSION_POINT_<REF2.UID> += <LOCAL.LEVEL>		// Incremento conteggio
  ENDIF
ENDIF

[FUNCTION f_Region_Message]
REGION.ALLCLIENTS SYSMESSAGE @44 <ARGS>

[DIALOG d_champion_end]
50,50

PAGE 0
resizepic 0 0 5120 300 445
resizepic 5 25 3500 290 415
//gumppictiled 5 20 1010 4 2700
//button 975 3 22153 22155 1 0 1 //aggiorna
//button 995 3 22150 22152 1 0 0 //esci

PAGE 1
REF1=<I.REGION.TAG.IDOL_LINK>
dtext 10 1 1152 Champion <REF1.TAG.CHAMP_NAME> Score Board
dorigin 20 38

LOCAL.A = <def.bfont_black>

DB.Query "SELECT * FROM SP_CHAMP_PUNTEGGI WHERE Session='<SRC.CTAG0.CHAMP_SESSION>' ORDER BY Punti DESC"		// Ordino per punti totali 

if (<DB.ROW.NUMROWS> > 0)
	for R 0 <eval <DB.ROW.NUMROWS>-1>
		LOCAL.A = <LOCAL.A><def.bfont_black>- <DB.Row.<EVAL <local.R>>.CharName>: <def.bfont_red><EVAL <DB.Row.<EVAL <local.R>>.Punti>><def.br>
		IF (<EVAL <local.R>> < 4) // Chiamata asssegnazioen SOP ai primi 3
			REF1 = <DB.Row.<EVAL <local.R>>.CharID>
			IF (<REF1>) //NULL Check
				f_SoP_PvP_Assegna_lvl1_2_3_champ <REF1>
			ENDIF
		ENDIF
	ENDFOR
ENDIF
	

dhtmlgump +0 +13 260 365 1 1 <LOCAL.A>


[DIALOG d_champion_end BUTTON]
ON=0
	RETURN 1
ON=1	//refresh del dialog
	I.SDIALOG d_champion_end
	RETURN 1
    
[ITEMDEF i_champion_idol_Azog_Lair_2]
ID=01f18 
TYPE=t_spawn_champion
NAME=Azog Lair Idol

ON=@Create
	TAG.CHAMP_NAME = "Azog Lair"
	more=CHAMPION_Azog1
	ATTR |= ATTR_MOVE_NEVER
	
	
ON=@DClick
IF (<timer> == -1)
	IF <REGION.TAG.IDOL_LINK> != <UID>) // Se la region non ha riferimento al idolo del champion
		REGION.TAG.IDOL_LINK = <UID>
	ENDIF  
	// Pulisco tag vecchi risultati
	CLEARTAGS SESSION_POINT_
	IF (<SRC.ISGM>)
		SRC.REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Start in 5 second
		
		TIMERF 5, SERV.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> started.
		TIMERF 5, start
	ELSE
		IF (<SERV.TIME> > <EVAL (<TAG0.LAST_START> + 144000)>)
			TAG0.LAST_START = <SERV.TIME>
			 
			SRC.REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Start in 5 second
			
			TIMERF 5, SERV.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> started.
			TIMERF 5, start
		ELSE
			SRC.SYSMESSAGE Can't start this champ yet.
		ENDIF
	ENDIF
ELSE
	IF (<SRC.ISGM>)
		REGION.ALLCLIENTS SYSMESSAGE @44 [Campion]: <I.TAG.CHAMP_NAME> Stopped.
		stop
	ENDIF
ENDIF 
RETURN 1

ON=@AddWhiteCandle
	REGION.ALLCLIENTS SYSMESSAGE @33 [Campion]: White Candle increase

ON=@AddRedCandle
	REGION.ALLCLIENTS SYSMESSAGE @33 [Campion]: Red Candle increase

		
////////////////////// MULTI ALTARE /////////////////////

[ITEMDEF i_champion_spawn]
NAME=Champion Spawn
ID=i_stairs_stone
TYPE=t_multi
MULTIREGION=0,0,0,0
COMPONENT=i_stairs_stone 1 0 0 0
COMPONENT=i_stairs_stone -1 0 0 0
COMPONENT=i_stairs_stone 0 1 0 0
COMPONENT=i_stairs_stone 1 1 0 0
COMPONENT=i_stairs_stone -1 1 0 0
COMPONENT=i_stairs_stone 0 -1 0 0
COMPONENT=i_stairs_stone 1 -1 0 0
COMPONENT=i_stairs_stone -1 -1 0 0
COMPONENT=03ef 0 2 0 0
COMPONENT=03ef -1 2 0 0
COMPONENT=03ef 1 2 0 0
COMPONENT=03f8 2 2 0 0
COMPONENT=03f6 -2 2 0 0
COMPONENT=03f2 -2 1 0 0
COMPONENT=03f2 -2 0 0 0
COMPONENT=03f2 -2 -1 0 0
COMPONENT=03f3 -2 -2 0 0
COMPONENT=03f1 -1 -2 0 0
COMPONENT=03f1 0 -2 0 0
COMPONENT=03f1 1 -2 0 0
COMPONENT=03f5 2 -2 0 0
COMPONENT=03f0 2 -1 0 0
COMPONENT=03f0 2 0 0 0
COMPONENT=03f0 2 1 0 0
COMPONENT=0fea 0 0 5 0
COMPONENT=0fee 1 0 5 0
COMPONENT=i_pentagram -1 0 5 0
COMPONENT=0fec 0 1 5 0
COMPONENT=0fed 1 1 5 0
COMPONENT=0fe9 -1 1 5 0
COMPONENT=0fe8 0 -1 5 0
COMPONENT=0feb 1 -1 5 0
COMPONENT=0fe7 -1 -1 5 0

ON=@Create
ATTR=attr_move_never
TIMER -1

[CHARDEF 02f4]
DEFNAME=c_azog
NAME=Azog the Terrible
CAN=MT_WALK|MT_RUN|MT_USEHANDS
ICON=i_pet_orc
ARMOR=5
DAM=45,55
SOUND=875
AVERSIONS=r_civilization,r_water
MOVERATE=80
DESIRES=
RESOURCES=10 i_ribs_raw
TEVENTS=e_boss_champion

ON=@Create
	TAG0.SlayerGroup=ORC
	TAG.NAME.HUE=77
	TAG.NAME.SUFFIX " [Champion]"
   NPC=brain_monster
   FAME={2000 4000}
   KARMA={-2000 -5000}
   STR={350 400}
   MAXHITS=20000
   DEX={100 105}
   INT={1 10}
   RESCOLD=0
   RESENERGY=0
   RESPOISON=0
   RESFIRE=0
   RESPHYSICAL=20
   MAGICRESISTANCE={90.0}
   WRESTLING=210.0
   
[REGIONTYPE r_Champion_Area] 
on=@enter
	if <src.isplayer>
		src.events +e_Champion_Record 
	endif

on=@exit
	if <src.isplayer>
		src.events +e_Champion_Record 
	endif
	 
[AREADEF a_champion_Azog] 
NAME=Champion Azog
GROUP=Champion
FLAGS=region_antimagic_gate|region_antimagic_recall_out
P=2044,1216,0,0
RECT=1973,1188,2118,1271,0//2095,1232
EVENTS=r_default_water,r_default_tree,r_default_grass,r_default_rock
EVENTS=r_Champion_Area
TAG.IDOL_LINK = 0
TAG0.ALLOWMARK=0

[EOF]

Here is the all scp that you sent me.

xwerswoodx avatar Dec 24 '20 16:12 xwerswoodx

I am trying to understand issue to fix it but I have no issue at all :/

xwerswoodx avatar Dec 24 '20 16:12 xwerswoodx

Very strange... I retest again... To use only c_llama For see if is some Connected to npc generate issue

alexdan2 avatar Dec 24 '20 16:12 alexdan2

Let me know the result, so I can test using more than one npc, maybe it causes the issue

xwerswoodx avatar Dec 24 '20 16:12 xwerswoodx

Let me know the result, so I can test using more than one npc, maybe it causes the issue

You can give me your exactly script of champ used for test.. i make same test and see

alexdan2 avatar Dec 25 '20 08:12 alexdan2

I have it above, I used it directly :)

xwerswoodx avatar Dec 25 '20 14:12 xwerswoodx

I make more test

image

When reach this situation i keep killing mobs for a while and after direct come boss, seems not spawn last candle but counting..

alexdan2 avatar Dec 25 '20 20:12 alexdan2

I tried again, I have no issue, but I already agree that this system working a bit strange, like first npc group keep getting longer time than others. I will lookup system and make some digs to find out what can cause that type of issue.

xwerswoodx avatar Dec 25 '20 20:12 xwerswoodx

I tried again, I have no issue, but I already agree that this system working a bit strange, like first npc group keep getting longer time than others. I will lookup system and make some digs to find out what can cause that type of issue.

Yep spawn 1 keep going like 7 red candle

alexdan2 avatar Dec 25 '20 20:12 alexdan2