Raised This Month: $ Target: $400
 0% 

Holy Shield Skill diablo2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Akka3223
Member
Join Date: Oct 2016
Old 08-03-2017 , 09:10   Holy Shield Skill diablo2
Reply With Quote #1

Hey guys i need help i want to make a skill holy shield
i dont know how i can make it i want to make it like
add 125% armor at 20lvl skill and 26seconds cooldown

This is what i try to change to give armor
instead to push player and deal 125%damage
Code:
#include <amxmodx>
#include <d2lod>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

new PLUGIN_NAME[] = "Holy Shield"
new PLUGIN_AUTHOR[] = "Akka"
new PLUGIN_VERSION[] = "1.1"

new Skill_Level = 12;
new Mana_Charge = 5;

new const ChargeCastSpr[] = "sprites/effects/ripple.spr";

new const HolyShield[MAX_P_SKILLS] =  // Armor add %
{
	15, 20, 25, 30, 40, 50, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125
};

#define CHARGE_DELAY 3.0

#define TASKID_CHARGE 140

new g_SkillId;

new Float:g_LastPressedSkill[33];
new g_iCurSkill[33];
new bool:IsChargeDelay[33];

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

	g_SkillId = register_d2_skill(PLUGIN_NAME, "Adds alot of armor to the player", PALADIN, Skill_Level, DISPLAY)

	RegisterHam(Ham_Spawn, "player", "fwd_PlayerSpawn", 1);
}

public plugin_precache()
{
	precache_sound( ChargeCast );
	precache_model( ChargeCastSpr );
}
public client_disconnect(id)
{
	Reset_Charge(id);

	remove_task( id + TASKID_CHARGE );

	IsChargeDelay[id] = false;
}
public fwd_PlayerSpawn(id)
{
	if ( !is_user_alive(id) )
		return;

	remove_task( id + TASKID_CHARGE );

	IsChargeDelay[id] = false;
}

public d2_skill_selected(id, skill_id)
{
	g_iCurSkill[id] = skill_id
}

public d2_skill_fired(id)
{
	if ( g_iCurSkill[id] == g_SkillId )
	{
		static Float:cdown;
		cdown = 1.0;

		if (get_gametime() - g_LastPressedSkill[id] <= cdown) 
		{
			return PLUGIN_HANDLED;
		}
		else if ( get_gametime() - g_LastPressedSkill[id] >= cdown )
		{
			g_LastPressedSkill[id] = get_gametime()
		}

		if ( get_p_skill( id, g_SkillId ) > 0 && get_p_mana(id) >= Mana_Charge )
		{
			if ( !get_p_item_wear_type(id, TYPE_SHIELD) )
			{
				client_print(id, print_chat, "You must wear shield, to use this skill!");
				return PLUGIN_HANDLED;
			}

			emit_sound(id, CHAN_ITEM, ChargeCast, 1.0, ATTN_NORM, 0, PITCH_NORM);
		
			set_p_mana(id, get_p_mana(id) - Mana_Charge );

			static Float: velocity[3];

			velocity_by_aim(id, 1600, velocity);

			set_pev(id, pev_velocity, velocity);

			Set_Sprite_Task(id, ChargeCastSpr, 4.0, 1, 1.2, "Morph");

			IsChargeDelay[id] = true;

			set_task( CHARGE_DELAY, "Task_Charge", id + TASKID_CHARGE);
		}
	}
	
	return PLUGIN_CONTINUE;
}
public Task_Charge(id)
{
	id -= TASKID_CHARGE;

	IsChargeDelay[id] = false;
}

public d2_logged(id, log_type)
{
	if ( log_type == UNLOGGED )
	{
		Reset_Charge(id);

		remove_task( id + TASKID_CHARGE );

		IsChargeDelay[id] = false;
	}
}
public d2_takedamage(victim, attacker, Float:iDamage[1])
{
	if ( !IsPlayerNearByMonster(victim) && IsChargeDelay[attacker] && get_p_skill( attacker, g_SkillId ) > 0 && get_p_hero(attacker) == ROGUE && g_iCurSkill[attacker] == g_SkillId )
	{
		iDamage[0] += (iDamage[0] * PalChDmg[ get_p_skill( attacker, g_SkillId ) - 1 ] / 100.0);
	}
}
public Set_Sprite_Task(id, const sprite[], Float:scale, istask, Float:task_time, const classname[])
{
	new sprite_ent = create_entity("env_sprite")

	entity_set_string(sprite_ent, EV_SZ_classname, classname)
	entity_set_int(sprite_ent, EV_INT_movetype, MOVETYPE_FOLLOW)
	entity_set_edict(sprite_ent, EV_ENT_aiment, id );
	entity_set_model(sprite_ent, sprite)

	entity_set_int( sprite_ent, EV_INT_rendermode, kRenderTransAdd)
	entity_set_float( sprite_ent, EV_FL_renderamt, 200.0 )
    
	entity_set_float( sprite_ent, EV_FL_framerate, 22.0 )
	entity_set_float( sprite_ent, EV_FL_scale, scale )
	entity_set_int( sprite_ent, EV_INT_spawnflags, SF_SPRITE_STARTON)
	DispatchSpawn( sprite_ent )

	if ( istask )
	{
		set_task(task_time, "End_Sprite_Task", sprite_ent);
	}
}
public End_Sprite_Task(sprite_ent)
{
	if ( is_valid_ent(sprite_ent) )
	{
		remove_entity(sprite_ent);
	}
}
public Reset_Charge(id)
{
	if ( get_p_hero(id) == ROGUE )
	{
		new sprite_ent = find_ent_by_class(-1, "Morph")
	
		if ( is_valid_ent(sprite_ent) ) 
		{
			remove_entity(sprite_ent)
			sprite_ent = find_ent_by_class(sprite_ent, "Morph")
		}
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1063\\ f0\\ fs16 \n\\ par }
*/
And this is diablo2lod.inc
Code:
// Diablo II LoD Include File //
#if defined _diablo2LOD_included
  #endinput
#endif
#define _diablo2LOD_included

#define MAX_P_SKILLS 20

// Gets the max skills are loaded
native MAX_SKILLS_ACTIVE();
// Gets the max items are loaded
native MAX_ITEMS_ACTIVE();

// Hero class values
enum
{
	HUNTER = 0,
	ASSASSIN,
	WARLOCK,
	WARRIOR,
	ROGUE,
	DRUID,
	MAGE
}

// Log type values
enum
{
	UNLOGGED = 0,
	LOGGED
}

// Display value, while selecting skill 'E' button.
enum
{
	NOT_DISPLAY = 0,
	DISPLAY
}

// Item types
enum
{
	TYPE_GLOVES = 0,
	TYPE_BOOTS,
	TYPE_BELT,
	TYPE_ARMOR,
	TYPE_HELM,
	TYPE_SHIELD,
	TYPE_WEAPON,
	TYPE_RING,
	TYPE_AMULET,
	TYPE_BOLTS
}

// Called when you pressed E button and selected the skill.
forward d2_skill_selected(id, skill_id);

// Called when you fired a skill, bind t +skills.
forward d2_skill_fired(id);

// Called when player gets damaged, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done.
forward d2_takedamage(victim, attacker, Float:iDamage[1]);

// Called when player gets damaged by skill, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done.
forward d2_skill_takedamage(victim, attacker, Float:iDamage[1]);

// Called when player gets damaged by weapon with poison, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done.
forward d2_dagger_poisondamage(victim, attacker, Float:iDamage[1]);

// Called when player gets damaged by RANGED attack, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done.
forward d2_ranged_takedamage(victim, attacker, Float:iDamage[1]);

// Called when player successfully fires arrow, 1-st parameter is playerid, 2-nd is entityid.
forward d2_ranged_actshoot(id, entity);

// Called when the player is logged/unlogged.
forward d2_logged(id, log_type);

// Gets the player's current speed.
native Float:get_current_speed(id);

// if is player logged/unlogged.
native get_player_logged(id);

// Gets player's max health.
native get_p_maxhealth(id);

// Sets player's max health.
native set_p_maxhealth(id, value);

// Sets player xp with X value.
native set_p_xp(id, value);

// Gets player xp.
native get_p_xp(id);

// Gets player current hero.
native get_p_hero(id);

// Gets player level.
native get_p_level(id);

// Sets player current mana.
native set_p_mana(id, value);

// Gets player current mana.
native get_p_mana(id);

// Gets player vitality.
native get_p_vitality(id);

// Sets player vitality.
native set_p_vitality(id, value);

// Sets player gold.
native set_p_gold(id, value);

// Sets player inventory gold.
native set_p_gold_inventory(id, value);

// Gets player gold.
native get_p_gold(id);

// Gets player inventory gold.
native get_p_gold_inventory(id);

// Gets player skill's value.
native get_p_skill(id, skill_id);

// Resets player model to custom.
native reset_p_model(id);

// Gets player's current item count.
native get_p_item_count(id, item_id);

// If is player wear item returns true.
native get_p_item_is_worn(id, item_id);

// Gets if player wears any item with specified type
native bool:get_p_item_wear_type(id, type);

// Gets if player wears any item with specified data type
native bool:get_p_item_data(id, data);

// Gets if player is in safe zone ( Near Akara, Charsi, Inventory ).
native bool:get_p_in_safezone(id);

// Gets if is player protected, if spawn protection time passed.
native bool:is_p_protected(id);

// Checks if is a freezetime.
native is_freezetime();

// Checks if is player near monster
native bool:IsPlayerNearByMonster(id);

// Damages a player, 1-st parameter is victim, 2-nd is attacker, 3-rd is damage , 4-th is weapon type string.
native dmg_kill_player(id, attacker, Float:damage, weaponDescription[])

// Drops coins from give id/victim with specified classname and gold value stored in entity.
native drop_coins(victim, classname[], goldvalue);

// Sets user model.
native set_user_model(id, const model[]);

stock find_itemplugin()
{
	for(new i = 0; i < get_pluginsnum(); ++i)
	{
		new temp[2], name[64]
		get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1)
 		if(equali(name, "diablo2LOD.amxx")) 
		{
 			return i;
		}
	}

 	return -1;
}

stock find_itemindex()
{
	new temp[2], name[64], pluginname[64]
	get_plugin(-1, pluginname, 63, temp, 1, temp, 1, temp, 1, temp, 1)
	for (new i = 0; i < get_pluginsnum(); ++i)
	{
		get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1)
 		if(equal(name, pluginname))
		{
 			return i
		}
	}

 	return -1
}
stock register_d2_skill(skill_name[], skill_desc[], skill_hero, skill_level, skill_display)
{
	new SkillId = find_itemindex()
	new SkillPlugin = find_itemplugin()
	new SkillRegFunc = get_func_id("register_skill", SkillPlugin)

	new temp = callfunc_begin_i(SkillRegFunc, SkillPlugin)
	if(temp == -1 || temp == -2)
	{
		log_amx("Plugin not found or function is not executable!")
		return PLUGIN_HANDLED;		
	}

	callfunc_push_int(SkillId)
	callfunc_push_str(skill_name)
	callfunc_push_str(skill_desc)
	callfunc_push_int(skill_hero)
	callfunc_push_int(skill_level)
	callfunc_push_int(skill_display)
	
	temp = callfunc_end()
	if(temp == -1 || temp == -2) 
	{
		return PLUGIN_HANDLED;
	}

	return temp;
}
stock client_printcolor(const id, const input[], any:...)
{
	new count = 1, players[32];

	static msg[191];
	vformat(msg,190,input,3);

	replace_all(msg,190,"/g","^4");// green txt
	replace_all(msg,190,"/y","^1");// orange txt
	replace_all(msg,190,"/ctr","^3");// team txt

	if (id) players[0] = id; 
	else get_players(players,count,"ch");

	for (new i=0;i<count;i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
Akka3223 is offline
Reply


Thread Tools
Display Modes

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 22:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode