Thread: Random fixes
View Single Post
  #4  
Old 09-02-2004, 03:32 AM
Branks
Sarnak
 
Join Date: May 2004
Posts: 58
Default

updated my little checklist of whats broken in my first post, you dont need to do anything with that i simply did it in hopes that someone will pick one of the none working one and start hacking at it with me.

also updated the flurry code from an earlier post, the part in client_process.cpp due to the message being displayed at incorrect times such as when the target was out of range and the skill triggered.

updated SE_CurrentHP in spells.cpp from an earlier post due to something allowing a warrior to get an exceptional heal....only happened onces and i dont really know why but i cleaned it up a little and it hasnt happened since.

updated the lifetap code in attack.cpp from an earlier post due to once again something without the skill got the benefit and a necro pet this time had an exceptional heal... anyone see something obviously wrong im missing?

so! ive spent a ton of time with swarm pets and and have yet to get them perfect, so im posting the progress ive made with them currently in hopes that someone will help finish up, the current minor issues are commented in the code for things like incorrect textures/models or details i dont know of them, the only magor issue at the moment is that after the swarm pets despawn if you had a pet already you no longer see the pet in the group window or in the pet information window, however all command line instructions work perfectly still, this one is driving me insane as ive tried just about everything i believe to be possible. also since this isnt exactly finished im not removing my comment or custom pets i threw in for fun.

wake the dead and doppelganger, these both require getting textures from pop+ which ive been unable to do and havent spent much time looking into yet. so doppelganger only trys to reproduce the primary item slot from the caster and i just gave it a kedge robe for the time being.

wake the dead, again with the textures thing, it works out nicely for NPC corpses but its far from perfect with clients.

fading memories and escape, the invisibility effect on these isnt working correctly since i dont yet understand how to make a client use their hide skill by code, and when i just flagged the player invisable the effect doesnt fade thus every mob in the zone cons indifferent after the skill had been used, as a temporary solution i added the spell improved invis to the skills and plan on coming back to this later, also when i know for sure if fading memories uses 900 mana or only checks that the player has 900 mana.

rampage...well it works perfectly, but i added an area message to it just as i did with flurry, just cause well i think its more fun that way~

ae taunt... see rampage

the god swarm pets i havent been able to get much information on, i know the shaman swarm pets from god proc a 640 poison based DD however i havent been able to figure out what spell this is.

swarm of decay, again with the freakin texture thing, their bows are not the correct model, i also had to guess as to their attack animation speed since it seems no one has seen it enough to remember.

anyway i think thats the magority of it and instead of posting the code per skill im just lumping it all together here, also keep in mind this is a work in progress so dont expect perfection with this just yet.

zone\MobAI.cpp search for "Mob::AI_Process" then scroll down a few lines till you see the bit saying "if (CombatRange(target))" then ABOVE THAT LINE add.

Code:
		if((GetBodyType()==63)&&(GetClass()==4)
			&&(attack_timer->Check())&&(IsAttackAllowed(target)))
		{	//Dook- Swarm Pets -Swarm of Decay
			if(Dist(*target)<=100)
			{
				FaceTarget(target);
				DoAnim(20, 9);
				int dmg=MakeRandomInt(50,200);
				target->Damage(this, dmg, 0xffff, 0x07, true);
			}
			return;
		}

		if((GetBodyType()==63)&&(GetRace()==89)&&(IsAttackAllowed(target))
			&&(attack_timer->Check())&&(Dist(*target)<=100))
		{
			//Dook- Servant of Ro castin Bolt of Lava
			CastSpell(3005,target->GetID(),9,3000,0,0,0);
			return;
		}

		if((GetBodyType()==63)&&(GetRace()==127)&&(IsAttackAllowed(target))
			&&(attack_timer->Check())&&(CombatRange(target))&&(GetClass()==90)
			&&(MakeRandomInt(0,10)>=9))
		{
			CastSpell(1638,target->GetID(),9,0,0,0,0);
		}

		if((GetBodyType()==63)&&(GetRace()==120)&&(IsAttackAllowed(target))
			&&(attack_timer->Check())&&(CombatRange(target))&&(GetClass()==91)
			&&(MakeRandomInt(0,10)>=9))
		{
			//Dook- ToDo Add GoD shaman swarm puppy proc here
		}
now on to zone\entity.cpp do a search for "EntityList::GetFreeID" then ABOVE THAT LINE add the following.

Code:
Mob* EntityList::GetMobInZoneByRange(Mob *client, int type, int range)	//Dook- AA skills
{
	if(type==1)		//Dook- find a corpse within range
	{
		LinkedListIterator<Corpse*> iterator(corpse_list);
		iterator.Reset();
		Mob* corp;
		while(iterator.MoreElements())
		{
			corp = iterator.GetData();
			if(corp->Dist(*client)<=range)
			{
				return iterator.GetData();
			}
			iterator.Advance();
		}
		return 0;
	}
	if(type==2)		//Dook- todo add mob by range here
	{
		return 0;
	}
}

void EntityList::WipeHateAll(Mob *client)		//Dook- FM, Escape and such
{
	LinkedListIterator<Mob*> iterator(mob_list);
	Mob *agroed;
	
	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
	{
		agroed = iterator.GetData();
		if(agroed->IsNPC())
		{
			agroed->RemoveFromHateList(client);
		}
	}	
}

void EntityList::AETaunt(Mob *client)	//Dook- AE Taunt of course..
{		//Dook- no horse no players
	LinkedListIterator<Mob*> iterator(mob_list);
	Mob *taunte;	
	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
	{
		taunte = iterator.GetData();
		if((taunte->Dist(*client) <= 30)&&(client->IsAttackAllowed(taunte))&&(taunte != client)
			&&(taunte->IsNPC())&&(taunte->GetRace() != 216))
		{
			Mob* hated=taunte->GetHateTop();
			int hate=0;
			if(hated)
			{
				hate=taunte->GetHateAmount(hated);
				taunte->SetHate(client,(hate+100));
			}
			else
			{
				taunte->AddToHateList(client,100);
			}
		}
	}	
}

void EntityList::AEAttack(Mob *attacker, float dist)	//Dook- Rampage and stuff
{		//Dook- Will need tweaking, currently no pets or players or horses
	LinkedListIterator<Mob*> iterator(mob_list);
	Mob *curmob;
	
	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
	{
		curmob = iterator.GetData();
		if((curmob->Dist(*attacker) <= dist)&&(attacker->IsAttackAllowed(curmob))&&(curmob != attacker)
			&&(curmob->IsNPC())&&(curmob->GetRace() != 216))
			attacker->Attack(curmob,13);
	}	
}
then on to zone\entity.h do a search for "GetMobByNpcTypeID" then above or below it, doesnt really matter add the following.

Code:
	Mob*	GetMobInZoneByRange(Mob* client, int type, int range);//Dook- For AA skills etc
	void	WipeHateAll(Mob* client);					//Dook- Escape and Fading Memories etc
	void	AETaunt(Mob* client);						//Dook- AE Taunt of course
	void	AEAttack(Mob *attacker, float dist);		//Dook- Rampage and such
then on to zone\mob.cpp and do a search for
"attack_timer_dw = new Timer(2000);" then below this line add the following.

Code:
	swarm_timer = new Timer(0);		//Dook- swarm pets
	swarm_timer->Disable();
then in mob.cpp still search for "safe_delete(spellend_timer);" and on the line below it add.
Code:
	safe_delete(swarm_timer);			//Dook- swarm pets
then still in moc.cpp do a search for "Mob* Mob::GetOwnerOrSelf" and replace exsisting with this.
Code:
Mob* Mob::GetOwnerOrSelf() {
	if (!GetOwnerID())
		return this;
	Mob* owner = entity_list.GetMob(this->GetOwnerID());
	if (!owner) {
		SetOwnerID(0);
	}
	else if (owner->GetPetID() == this->GetID()) {
		return owner;
	}
    else if (owner->GetFamiliarID() == this->GetID()) {
        return owner;
    }
	else if (this->GetBodyType() == 63) {			//Dook- swarm pets
		return owner;
	}
	else {
		SetOwnerID(0);
	}
	return this;
}
still in mob.cpp right below the code we just did you should see "Mob* Mob::GetOwner" replace exsisting with this.

Code:
Mob* Mob::GetOwner() {
	Mob* owner = entity_list.GetMob(this->GetOwnerID());
	if (owner && owner->GetPetID() == this->GetID()) {

		return owner;
	}
    if (owner && owner->GetFamiliarID() == this->GetID())
    {
        return owner;
    }
	if(this->GetBodyType() == 63)	//Dook- Swarm Pets
	{
		return owner;
	}
	this->SetOwnerID(0);
	return 0;
}
now move over to zone\mob.h and search for "spellend_timer"
and right below this add.
Code:
	Timer*	swarm_timer;     //Dook- swarm pets
now move to zone\npc.cpp and search for "if (p_depop)" and replace exsisting with.
Code:
    if (p_depop)
    {
        Mob* owner = entity_list.GetMob(this->ownerid);
        if((owner != 0)&&(this->GetBodyType() != 63))	//Dook- Swarm Pets
        {
            owner->SetPetID(0);
			this->ownerid = 0;
            this->petid = 0;
        }
		if(this->GetBodyType() ==63)			//Dook- Swarm Pets
		{
			this->ownerid = 0;
			this->petid = 0;
		}
        return false;
    }
then move to zone\spdat.h and search for "SE_StackingCommand_Block" and alter that area to look like this.
Code:
#define SE_StackingCommand_Block	148
#define SE_StackingCommand_Overwrite 149
#define SE_DeathSave				150
#define SE_TemporaryPets			152	//Dook- Swarm Pets
#define SE_BalanceHP				153	// Divine Arbitration
#define SE_DispelDetrimental		154
#define SE_IllusionCopy				156	// Deception
#define SE_SpellDamageShield		157	// Petrad's Protection
#define SE_Reflect					158
#define SE_AllStats					159	// Aura of Destruction
#define SE_FadingMemories			194	//Dook- ....
#define SE_Blank					254
#define SE_WakeTheDead				299	//Dook- ....
#define SE_Doppelganger				300	//Dook- ...
then on to zone\spells.cpp and search for "Mob::SpellProcess" and add the bit at the bottom so that it looks like this.
Code:
void Mob::SpellProcess()
{
	// check the rapid recast prevention timer
	if(delaytimer == true && spellend_timer->Check())
	{
		spellend_timer->Disable();
		delaytimer = false;
		return;
	}

	// a timed spell is finished casting
	if (casting_spell_id != 0 && spellend_timer->Check())
	{
		spellend_timer->Disable();
		delaytimer = false;
		CastedSpellFinished(casting_spell_id, casting_spell_targetid, casting_spell_slot, casting_spell_mana, casting_spell_inventory_slot);
	}

	//Dook- swarm pets
	if((swarm_timer->Check()) && (GetBodyType() == 63))
	{
		Depop();
		swarm_timer->Disable();
	}
}
then still in spells.cpp search for "The basic types of spells" and move 3 or so lines up and alter it so it looks like this.
Code:
	if(IsEffectInSpell(spell_id, SE_TemporaryPets))			//Dook- swarm pet
	{
		target_id = this->GetID();
	}


/*
	solar: The basic types of spells:
making a second post now as the next bit is huge and i think im nearing the end of this post.
Reply With Quote