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

War3:Source
October 24, 2012, 03:12:53 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: How to teleport front target  (Read 633 times)
gghh3322
Jr. Member
**
Posts: 56


View Profile
« on: September 06, 2010, 07:58:14 AM »

Need Check Hull(wall)
Teleport front target's seeangle
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #1 on: September 06, 2010, 08:15:27 AM »

you can check out human or leave this hero to me
Logged

DarkEnergy
gghh3322
Jr. Member
**
Posts: 56


View Profile
« Reply #2 on: September 06, 2010, 08:25:34 AM »

Code:
public Action:ShotRasengang(Handle:h,any:client){
decl Float:location[3];
decl Float:VecPos[3];
decl Float:foreffect[3];
new Float:dist=400.0;
PrintCenterText(Raattacker[client], "Rasengang!");
GetClientAbsOrigin(client,location);
GetClientAbsOrigin(client,foreffect);
War3_CachedPosition(client,location);
for(new i=1;i<=MaxClients;i++)
{
if(ValidPlayer(i,true)&& GetClientTeam(i)!=Raattacker[client])
{
GetClientAbsOrigin(i,VecPos);
if(GetVectorDistance(location,VecPos)<=dist)
{
War3_DealDamage(i,30,Raattacker[client],_,"rasengang",W3DMGORIGIN_ULTIMATE,W3DMGTYPE_PHYSICAL);
PrintHintText(i,"Attacked by Rasengang -30HP , Stunned");
War3_SetBuff(i,bStunned,thisRaceID,true);
CreateTimer(3.0,EndStunned,i);
}
}
}
TeleportEntity(Raattacker[client], location, NULL_VECTOR, NULL_VECTOR); // That's teleport part, I want teleport Raattacker[client] to location(enemy)'s front with check hull.
for(new i=400;i>=1;i--) // effect
{
TE_SetupBeamRingPoint(foreffect,0.0,dist,BeamSprite,HaloSprite,0,15,2.5,5.0,0.0,{135,206,25,255},10,0);
TE_SendToAll();
i-=10;
dist-=10.0;
foreffect[2]+=3;
}
War3_SetBuff(Raattacker[client],bStunned,thisRaceID,false);
}
public Action:EndStunned(Handle:timer,any:client)
{
if(ValidPlayer(client,true))
{
War3_SetBuff(client,bStunned,thisRaceID,false);
}
}
Logged
gghh3322
Jr. Member
**
Posts: 56


View Profile
« Reply #3 on: September 06, 2010, 04:30:09 PM »

Thx!
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #4 on: September 06, 2010, 05:43:22 PM »

ok, so far i have

teleport to enemy player

what else does it do?
Logged

DarkEnergy
gghh3322
Jr. Member
**
Posts: 56


View Profile
« Reply #5 on: September 06, 2010, 10:16:21 PM »

that's all Thx!
You're so nice!   Grin
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #6 on: September 06, 2010, 10:19:16 PM »

teleports to, but not necessarily in front of an enemy.

Code:
#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
#include <sdktools>
#include <sdktools_functions>
#include <sdktools_tempents>
#include <sdktools_tempents_stocks>

// War3Source stuff
new Float:teleportpos[66][3];
new thisRaceID;
new BeamSprite,HaloSprite;
new String:Rasengang[]="SH/Rasengang.wav";
new Raattacker[66];
public Plugin:myinfo =
{
name = "SH Hero Naruto",
author = "GGHH3322",
description = "SH Hero",
version = "1.0.0.0",
url = "http://war3source.com"
};

// War3Source Functions
public OnPluginStart()
{
}
public OnMapStart()
{
BeamSprite=PrecacheModel("materials/sprites/lgtning.vmt");
HaloSprite=PrecacheModel("materials/sprites/halo01.vmt");
War3_PrecacheSound(Rasengang);
}

public OnWar3LoadRaceOrItemOrdered(num)
{
if(num==30)
{

thisRaceID=SHRegisterHero(
"Naruto",
"naruto",
"Rasengang",
"1.5sec Make Rasengang, and shot target",
true
);

}
}

public OnWar3EventSpawn(client)
{
if(!SHHasHero(client,thisRaceID))
{
War3_SetBuff(client,bStunned,thisRaceID,false);
}
if(SHHasHero(client,thisRaceID))
{
War3_SetBuff(client,bStunned,thisRaceID,false);
}
}
new Float:oldpos[66][3];
new Float:dirRasen[3];
new Float:endpos[3];
new Float:startpos[3];
new ClientTracer;
new Float:distanceRasen=500.0;
new Float:angleRasen[3];
public OnPowerCommand(client,herotarget,bool:pressed){
//PrintToChatAll("%d",herotarget);
if(SHHasHero(client,herotarget)&&herotarget==thisRaceID){
//PrintToChatAll("1");
if(pressed && War3_SkillNotInCooldown(client,thisRaceID,0,true)){
new target = War3_GetTargetInViewCone(client,500.0,false,_,ImmunityFilterFunc);
if(target>0)
{
GetClientAbsOrigin(client,oldpos[client]);

if(!TeleportToPlayer(client,target)){
PrintHintText(client,"Could not find empty location");
}

}
else{
W3MsgNoTargetFound(client,500.0);
}
}
}
}
public bool:ImmunityFilterFunc(entity){
if(!W3HasImmunity(entity,Immunity_Skills)){
return true;
}
return true;
}

new ignoreClient;
public bool:AimTargetFilter(entity){
if(entity==ignoreClient){
return false;
}
return true;
}

bool:TeleportToPlayer(client,target){
new Float:clientpos[3]
new Float:targetpos[3]
GetClientAbsOrigin(client,clientpos);
GetClientAbsOrigin(target,targetpos);

new Float:distanceVector[3];
SubtractVectors(targetpos,clientpos,distanceVector);
new Float:distance=GetVectorDistance(targetpos,clientpos);
new Float:newdistance=distance-30.0;
ScaleVector(distanceVector,newdistance/distance)
PrintToChatAll("scale %f",newdistance/distance);

new Float:newpos[3];
AddVectors(clientpos, distanceVector, newpos)

new Float:returnpos[3];
getEmptyLocationHull(client,newpos,returnpos);
if(GetVectorLength(returnpos)<0.1){
return false;
}
else{
TeleportEntity(client,returnpos,NULL_VECTOR,NULL_VECTOR);
}
return true;
}
new absincarray[]={0,4,-4,8,-8,12,-12,18,-18,22,-22,25,-25};//,27,-27,30,-30,33,-33,40,-40}; //for human it needs to be smaller

public bool:getEmptyLocationHull(client,Float:originalpos[3],Float:returnpos[3]){


new Float:mins[3];
new Float:maxs[3];
GetClientMins(client,mins);
GetClientMaxs(client,maxs);

//PrintToChatAll("min : %.1f %.1f %.1f MAX %.1f %.1f %.1f",mins[0],mins[1],mins[2],maxs[0],maxs[1],maxs[2]);
new absincarraysize=sizeof(absincarray);

new limit=5000;
for(new x=0;x<absincarraysize;x++){
if(limit>0){
for(new y=0;y<=x;y++){
if(limit>0){
for(new z=0;z<=y;z++){
new Float:pos[3]={0.0,0.0,0.0};
AddVectors(pos,originalpos,pos);
pos[0]+=float(absincarray[x]);
pos[1]+=float(absincarray[y]);
pos[2]+=float(absincarray[z]);

//PrintToChatAll("hull at %.1f %.1f %.1f",pos[0],pos[1],pos[2]);
//PrintToServer("hull at %d %d %d",absincarray[x],absincarray[y],absincarray[z]);
TR_TraceHullFilter(pos,pos,mins,maxs,MASK_SOLID,CanHitThis,client);
//new ent;
if(TR_DidHit(_))
{
//PrintToChatAll("2");
//ent=TR_GetEntityIndex(_);
//PrintToChatAll("hit %d self: %d",ent,client);
}
else{
//TeleportEntity(client,pos,NULL_VECTOR,NULL_VECTOR);
AddVectors(Float:{0.0,0.0,0.0},pos,returnpos); ///set this gloval variable
limit=-1;
break;
}

if(limit--<0){
break;
}
}

if(limit--<0){
break;
}
}
}

if(limit--<0){
break;
}

}

}

}
public bool:CanHitThis(entityhit, mask, any:data)
{
if(entityhit == data )
{// Check if the TraceRay hit the itself.
return false; // Don't allow self to be hit, skip this result
}
if(ValidPlayer(entityhit)&&ValidPlayer(data)&&War3_GetGame()==Game_TF&&GetClientTeam(entityhit)==GetClientTeam(data)){
return false; //skip result, prend this space is not taken cuz they on same team
}
return true; // It didn't hit itself
}

Logged

DarkEnergy
gghh3322
Jr. Member
**
Posts: 56


View Profile
« Reply #7 on: September 06, 2010, 10:44:00 PM »

Thx Ownz
Have a good day in Roadtrip!
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!