Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2008, 11:48 AM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default mob fizzle

well to make mobs fizzle you are to insert some code - since there is no way a mob to fizzle normally there is nothing in yet

into mob::CheckFizzle
Code:
	//after player code we should have always 5% to fizzle
	//rest is kinda unimportant here, since mobs have always max skill points
	if (MakeRandomInt(1,100) <= 5) return false;
	return true;
you can play with lowering the success rate by checking the spell level too (saying that you fizzle more on lower levels).

this is not enough you are to insert a line too into mob::CastSpell
Code:
	// check for fizzle
	// note that CheckFizzle itself doesn't let NPCs fizzle,
	// but this code allows for it.
	if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id))
	{
		int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE;
		InterruptSpell(fizzle_msg, 0x121, spell_id);
		
		uint32 use_mana = mana_cost / 4;
		mlog(SPELLS__CASTING_ERR, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana);
		
		// fizzle 1/4 the mana away
		SetMana(GetMana() - use_mana);

******** extra start

		//if NPC fizzles...
		if (IsNPC()) CastToNPC()->AI_Event_SpellCastFinished(false, slot);

******** extra end

		return(false);
	}
inserted all of that block here so you can find it easier
Reply With Quote
  #2  
Old 01-19-2008, 12:06 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default quickfix

quickfix for post #1

instead of "float mult;" write "float mult = 0;"
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:06 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3