View Single Post
  #2  
Old 01-20-2008, 03:51 AM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default backstabb with piercer only

Mob::TryBackstab has restriction for player (mr. IsClient()) to backstabb only with piercing weapon.. this i want to apply for mob (npc/pet) too, but got some problem with code (not a pretty one tho')

Code:
	//make sure we have a proper weapon if we are a client.
	//if(IsClient()) {
		
		if (IsClient()) {
			const ItemInst* weapon = NULL;
			weapon = CastToClient()->GetInv().GetItem(SLOT_PRIMARY);
			if(!weapon || (weapon->GetItem()->ItemType != ItemTypePierce)) {  
				Message_StringID(13, BACKSTAB_WEAPON);
				return;
			}
		} else if (IsNPC()) { 
			const Item_Struct* weapon = NULL;
			int32 eid = CastToNPC()->GetEquipment(SLOT_PRIMARY);
			if (eid != 0) weapon = database.GetItem(eid);
			if (!weapon || (weapon->ItemType!=ItemTypePierce && weapon->ItemType!=ItemType2HPierce))
			{
				return;
			}
		}
	//}
so NPC part i was just copy/pasting together and seems not to work.. the cast2npc-getequipbyslot gives always zero value, so the stuff will make exit on every mob backstabb attempt

any idea?
Reply With Quote