Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
September 21, 2012, 10:13:29 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Russian] Как реализовать регенерацию для расы  (Read 171 times)
kvip
Newbie
*
Posts: 17


View Profile Email
« on: May 07, 2012, 02:14:13 AM »

Привет всем, пишу расу и в нее нужно добавить возможность восстановления здоровья или по другому регенерацию, вот я бы и хотел узнать как это сделать?

Такая регенерация, как у теневого охотника не подходит потому что она лечит всех вокруг. Хотелось что бы эффект был как от кольца регенерации.
Logged
Divix
Sr. Member
****
Posts: 280


View Profile Email
« Reply #1 on: May 07, 2012, 03:16:05 AM »

Ну неужели мало рас в которых присутствует реген ? Или почему бы не взять из кольца ?
Code:
War3_SetBuff(client, fHPRegen, thisRaceID, 1.0);
Logged
kvip
Newbie
*
Posts: 17


View Profile Email
« Reply #2 on: May 07, 2012, 04:14:05 AM »

У меня мало рас с регенерацией, если есть то скинь, возьму за пример.
Logged
kvip
Newbie
*
Posts: 17


View Profile Email
« Reply #3 on: May 07, 2012, 06:13:40 AM »

Появилась проблема.

Code:
new Float:HPREGEN[5]={0.0,2.5,4.0,5.5,9.5};
SKILL_HPREGEN=War3_AddRaceSkill(thisRaceID, "Регенерация", "Регенерация", false);
War3_SetBuff(client, fHPRegen, thisRaceID, HPREGEN[War3_GetSkillLevel(client, thisRaceID, SKILL_HPREGEN)]);

Добавляю данные фрагменты в код расы, ошибок при компиляции нет, но регенерация не работает.
Logged
Divix
Sr. Member
****
Posts: 280


View Profile Email
« Reply #4 on: May 07, 2012, 10:18:50 AM »

Наверное просто не в то место вставлял или еще что-то упустил (к примеру вставил при смене расы только, а при возрождении забыл). Так сказать нельзя. Вот полный код (регенерация работает если ты возродишься или у тебя сменится раса):
Code:
#pragma semicolon 1

#include <sourcemod>
#include "W3SIncs/War3Source_Interface"

new thisRaceID;

new SKILL_REGEN;

new Float:SkillRegenHP[5] = {0.0, 1.0, 3.0, 4.5, 6.0};

public OnWar3PluginReady()
{
thisRaceID=War3_CreateNewRace("Regen - Test Race", "Regen");
SKILL_REGEN=War3_AddRaceSkill(thisRaceID, "Regeneration", "Regenerates health slowly.", false, 4);
}

public OnRaceChanged(client, oldrace, newrace)
{
if(newrace != thisRaceID)
W3ResetAllBuffRace(client, thisRaceID);
else if(ValidPlayer(client, true))
{
new level = War3_GetSkillLevel(client, thisRaceID, SKILL_REGEN);
War3_SetBuff(client, fHPRegen, thisRaceID, SkillRegenHP[level]);
}
}

public OnWar3EventSpawn(client)
{
new race = War3_GetRace(client);
if(race == thisRaceID)
{
new level = War3_GetSkillLevel(client, thisRaceID, SKILL_REGEN);
War3_SetBuff(client, fHPRegen, thisRaceID, SkillRegenHP[level]);
}
}
Logged
kvip
Newbie
*
Posts: 17


View Profile Email
« Reply #5 on: May 11, 2012, 07:37:56 AM »

Ребят помогите вставить регенерацию, самому не получается.

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_tempents>
#include <sdktools_functions>
#include <sdktools_tempents_stocks>
#include <sdktools_entinput>
#include <sdktools_sound>
#include "W3SIncs/War3Source_Interface"

// War3Source stuff
new thisRaceID, SKILL_LONGJUMP, SKILL_REGEN, SKILL_HEX, SKILL_SPEED, SKILL_DMG, ULT_BURROW;

// Chance/Data Arrays
// skill 1
new bool:bIsLongjumpActivated[MAXPLAYERS];
new Float:ChanceJump[5] = { 0.0, 0.5, 0.6, 0.7, 0.9 };
new m_vecBaseVelocity, m_vecVelocity_0, m_vecVelocity_1;

// skill 2
new HealingWaveAmountArr[]={0,4,6,8,10};
new Float:HealingWaveDistanceArr[]={0.0,5.0,10.0,15.0,30.0};
new ParticleEffect[MAXPLAYERS][MAXPLAYERS];

new Float:CurrentHexChance[MAXPLAYERS];
new Float:HexChanceArr[]={0.00,0.02,0.050,0.075,0.100};

// skill 3
new Float:ZerglingSpeed[5] = { 1.0, 1.1, 1.2, 1.4, 1.55 };
new Health[5] = { 100, 120, 140, 150, 210 };

// skill 4
new Float:g_DrugAngles[20] = { 0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0 };
new String:attack_sound[] = "npc/roller/mine/rmine_blades_out2.wav";
new Float:DMGChance[5] = { 0.0, 0.4, 0.5, 0.6, 0.7 };
new UserMsg:g_FadeUserMsgId;

// skill 5
new String:UltOutstr[] = "npc/scanner/scanner_nearmiss2.wav";
new String:UltInstr[] = "npc/scanner/scanner_nearmiss1.wav";
new Float:UltCooldown[5] = { 0.0, 6.0, 5.0, 4.0, 3.0 };
new bool:bIsBurrowed[MAXPLAYERS];
new SmokeSprite;

public Plugin:myinfo =
{
name = "War3Source Race - Zergling",
author = "xDr.HaaaaaaaXx",
description = "The Zergling race for War3Source.",
version = "1.0",
url = ""
};

public OnWar3LoadRaceOrItemOrdered(num)
{
{
if(num==420)
{
thisRaceID = War3_CreateNewRace( "Песочный змей", "earthsnake" );

SKILL_LONGJUMP = War3_AddRaceSkill( thisRaceID, "Выпад", "Длинный прыжок", false );
SKILL_REGEN = War3_AddRaceSkill( thisRaceID, "Регинерация", "востановление HP", false );
SKILL_HEX=War3_AddRaceSkill(thisRaceID, "HEX, "HEX", false);
SKILL_SPEED = War3_AddRaceSkill( thisRaceID, "Рептилия", "Быстро бегаете", false );
SKILL_DMG = War3_AddRaceSkill( thisRaceID, "Удар", "Быстро атакуете", false );
ULT_BURROW = War3_AddRaceSkill( thisRaceID, "Песок", "Прячитесь под землю", true );

W3SkillCooldownOnSpawn( thisRaceID, ULT_BURROW, 5.0, _, "Burrow" );

War3_CreateRaceEnd( thisRaceID );
}}}

public OnMapStart()
{
War3_PrecacheSound( attack_sound );
War3_PrecacheSound( UltInstr );
War3_PrecacheSound( UltOutstr );
SmokeSprite = PrecacheModel( "sprites/smoke.vmt" );
}

public OnPluginStart()
{
CreateTimer(1.0,CalcHexHealWaves,_,TIMER_REPEAT);
m_vecBaseVelocity = FindSendPropOffs( "CBasePlayer", "m_vecBaseVelocity" );
m_vecVelocity_0 = FindSendPropOffs( "CBasePlayer", "m_vecVelocity[0]" );
m_vecVelocity_1 = FindSendPropOffs( "CBasePlayer", "m_vecVelocity[1]" );
HookEvent( "player_jump", PlayerJumpEvent );
g_FadeUserMsgId = GetUserMessageId( "Fade" );
}

public InitPassiveSkills( client )
{
if( War3_GetRace( client ) == thisRaceID )
{
War3_SetBuff( client, fMaxSpeed, thisRaceID, ZerglingSpeed[War3_GetSkillLevel( client, thisRaceID, SKILL_SPEED )] );

SetEntityHealth( client, Health[War3_GetSkillLevel( client, thisRaceID, SKILL_SPEED )] );

if( GetRandomFloat( 0.0, 1.0 ) <= ChanceJump[War3_GetSkillLevel( client, thisRaceID, SKILL_LONGJUMP )] )
{
bIsLongjumpActivated[client] = true;
PrintToChat( client, "\x03Alien Lunge\x05: \x03You have the ability to Lunge this round." );
}
else
{
bIsLongjumpActivated[client] = false;
}
}
}

public OnRaceSelected( client, newrace )
{
if( newrace != thisRaceID )
{
War3_WeaponRestrictTo( client, thisRaceID, "" );
W3ResetAllBuffRace( client, thisRaceID );
}
else
{
War3_WeaponRestrictTo( client, thisRaceID, "weapon_knife" );
if( IsPlayerAlive( client ) )
{
InitPassiveSkills( client );
}
}
}

public OnSkillLevelChanged( client, race, skill, newskilllevel )
{
InitPassiveSkills(client);
}

public OnWar3EventSpawn( client )
{
StopBurrow( client );
new race = War3_GetRace( client );
if( race == thisRaceID )
{
InitPassiveSkills( client );
}
}

public OnWar3EventDeath( victim, attacker )
{
W3ResetAllBuffRace( victim, thisRaceID );
}

public PlayerJumpEvent( Handle:event, const String:name[], bool:dontBroadcast )
{
new client = GetClientOfUserId( GetEventInt( event, "userid" ) );
new race = War3_GetRace( client );
if( race == thisRaceID )
{
new skill_long = War3_GetSkillLevel( client, race, SKILL_LONGJUMP );
if( skill_long > 0 && bIsLongjumpActivated[client] )
{
new Float:velocity[3] = { 0.0, 0.0, 0.0 };
velocity[0] = GetEntDataFloat( client, m_vecVelocity_0 );
velocity[1] = GetEntDataFloat( client, m_vecVelocity_1 );
velocity[0] *= 1.5 * 0.25;
velocity[1] *= 1.5 * 0.25;
SetEntDataVector( client, m_vecBaseVelocity, velocity, true );
}
}
}

public OnW3TakeDmgBullet( victim, attacker, Float:damage )
{
if( IS_PLAYER( victim ) && IS_PLAYER( attacker ) && victim > 0 && attacker > 0 && attacker != victim )
{
new vteam = GetClientTeam( victim );
new ateam = GetClientTeam( attacker );
if( vteam != ateam )
{
new race_attacker = War3_GetRace( attacker );
new skill_level = War3_GetSkillLevel( attacker, thisRaceID, SKILL_DMG );
if( race_attacker == thisRaceID && skill_level > 0 )
{
if( GetRandomFloat( 0.0, 1.0 ) <= DMGChance[skill_level] && damage < 50 && !W3HasImmunity( victim, Immunity_Skills ) )
{
War3_DealDamage( victim, 30, attacker, _, "adrenal_glands", W3DMGORIGIN_SKILL, W3DMGTYPE_TRUEDMG );
Drug( victim, 1 );
CreateTimer( 1.0, Drug1, victim );
CreateTimer( 2.0, Drug1, victim );
CreateTimer( 3.0, Drug2, victim );
EmitSoundToAll( attack_sound, victim );
}
}
}
}
}

public Action:Drug1( Handle:timer, any:client )
{
if( ValidPlayer( client, true ) )
{
Drug( client, 1 );
}
}

public Action:Drug2( Handle:timer, any:client )
{
if( ValidPlayer( client, true ) )
{
Drug( client, 0 );
}
}

stock Drug( client, mode )
{
if( mode == 1 )
{
new Float:pos[3];
GetClientAbsOrigin( client, pos );

new Float:angs[3];
GetClientEyeAngles( client, angs );

angs[2] = g_DrugAngles[GetRandomInt( 0, 100 ) % 20];

TeleportEntity( client, pos, angs, NULL_VECTOR );

new clients[2];
clients[0] = client;

new Handle:message = StartMessageEx( g_FadeUserMsgId, clients, 1 );
BfWriteShort( message, 255 );
BfWriteShort( message, 255 );
BfWriteShort( message, ( 0x0002 ) );
BfWriteByte( message, GetRandomInt( 0, 255 ) );
BfWriteByte( message, GetRandomInt( 0, 255 ) );
BfWriteByte( message, GetRandomInt( 0, 255 ) );
BfWriteByte( message, 128 );

EndMessage();
}

if( mode == 0 )
{
new Float:pos[3];
GetClientAbsOrigin( client, pos );

new Float:angs[3];
GetClientEyeAngles( client, angs );

angs[2] = 0.0;

TeleportEntity( client, pos, angs, NULL_VECTOR );

new clients[2];
clients[0] = client;

new Handle:message = StartMessageEx( g_FadeUserMsgId, clients, 1 );
BfWriteShort( message, 1536 );
BfWriteShort( message, 1536 );
BfWriteShort( message, ( 0x0001 | 0x0010 ) );
BfWriteByte( message, 0 );
BfWriteByte( message, 0 );
BfWriteByte( message, 0 );
BfWriteByte( message, 0 );

EndMessage();
}
}

public OnUltimateCommand( client, race, bool:pressed )
{
if( race == thisRaceID && pressed && ValidPlayer( client, true ) )
{
new ult_level = War3_GetSkillLevel( client, race, ULT_BURROW );
if( ult_level > 0 )
{
if( War3_SkillNotInCooldown( client, thisRaceID, ULT_BURROW, true ) )
{
ToggleBurrow( client );
AttachSmoke( client );
War3_CooldownMGR( client, UltCooldown[ult_level], thisRaceID, ULT_BURROW, _, _, false, "Burrow" );
}
}
else
{
PrintHintText( client, "Level Your Ultimate First" );
}
}
}

stock StopBurrow( client )
{
if( bIsBurrowed[client] )
{
bIsBurrowed[client] = false;

War3_SetBuff( client, bNoMoveMode, thisRaceID, false );
War3_SetBuff( client, fInvisibilitySkill, thisRaceID, 1.0 );

EmitSoundToAll( UltOutstr, client );

new Float:pos[3];

GetClientAbsOrigin( client, pos );

pos[2] += 70;

TeleportEntity( client, pos, NULL_VECTOR, NULL_VECTOR );
}
}

stock StartBurrow( client )
{
if( !bIsBurrowed[client] )
{
bIsBurrowed[client] = true;

War3_SetBuff( client, bNoMoveMode, thisRaceID, true );
War3_SetBuff( client, fInvisibilitySkill, thisRaceID, 0.0 );

EmitSoundToAll( UltInstr, client );

PrintToChat( client, "\x05: \x04You burrowed underground! Press \x03ultimate \x04again to unburrow!" );
new Float:pos[3];

GetClientAbsOrigin( client, pos );

pos[2] -= 70;

TeleportEntity( client, pos, NULL_VECTOR, NULL_VECTOR );
}
}

stock ToggleBurrow( client )
{
if( bIsBurrowed[client] )
{
StopBurrow( client );
}
else
{
StartBurrow( client );
}
}

stock AttachSmoke( client )
{
new Float:pos[3];
GetClientAbsOrigin( client, pos );

pos[2] += 15;

TE_SetupSmoke( pos, SmokeSprite, 100.0, 10 );
TE_SendToAll();

TE_SetupSmoke( pos, SmokeSprite, 100.0, 10 );
TE_SendToAll();

TE_SetupSmoke( pos, SmokeSprite, 100.0, 10 );
TE_SendToAll();

TE_SetupSmoke( pos, SmokeSprite, 100.0, 10 );
TE_SendToAll();
}

public Action:CalcHexHealWaves(Handle:timer,any:userid)
{
if(thisRaceID>0)
{
for(new i=1;i<=MaxClients;i++)
{
particled[i]=false;
if(ValidPlayer(i,true))
{
if(War3_GetRace(i)==thisRaceID)
{
new bool:value=(GetRandomFloat(0.0,1.0)<=HexChanceArr[War3_GetSkillLevel(i,thisRaceID,SKILL_REGEN)]&&!Hexed(i,false));
War3_SetBuff(i,bImmunitySkills,thisRaceID,value);
HealWave(i); //check leves later
}
}
}
}
}

public HealWave(client)
{
new skill = War3_GetSkillLevel(client,thisRaceID,SKILL_REGEN);
if(skill>0&&!Hexed(client,false))
{
new Float:dist = HealingWaveDistanceArr[skill];
new HealerTeam = GetClientTeam(client);
new Float:HealerPos[3];
GetClientAbsOrigin(client,HealerPos);
new Float:VecPos[3];

for(new i=1;i<=MaxClients;i++)
{
if(ValidPlayer(i,true)&&GetClientTeam(i)==HealerTeam)
{
GetClientAbsOrigin(i,VecPos);
if(GetVectorDistance(HealerPos,VecPos)<=dist)
{
War3_HealToMaxHP(i,HealingWaveAmountArr[skill]);

if(!particled[i])
{
particled[i]=true;
VecPos[2]+=65.0;

War3_TF_ParticleToClient(0, HealerTeam==2?"healthgained_red":"healthgained_blu", VecPos);

}
}
}
}
}
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!