找回密码
 点一下
查看: 1250|回复: 12

螺旋桨优化的说zinc

[复制链接]
发表于 2011-12-12 11:24:17 | 显示全部楼层 |阅读模式
给骑士看的说.gif
朋友要的.就给优化了一下.应该是没有泄露什么的..只有2个单位放...两个计时器..木有点..
应该是效率上可以过得去了..
代码如下:
[jass]
//! zinc
library   xxx  
{
constant  boolean  MODE =TRUE; //为TURE时,可以跟随英雄移动,为FALSE时 不能
跟随英雄移动.
constant  integer  ABILITY_ID = 'A004'; //触发技能ID
constant  integer  ORDER = 852580; //命令ID
constant  real   GAP=0.02; //施放间隔
constant  real  DURATION=5; //持续时间
constant  integer  TYPE_DUMMY= 'e001'; //马甲类型
//以上是常量.以下是变量
real  ax,ay,bx,by,ang;
timer  at,bt;
unit  u,au,bu;
// real  x = source + dist * Cos(angle * 0.017);
function   act3()
{DestroyTimer(GetExpiredTimer());
DestroyTimer(at);
debug BJDebugMsg("Act3");
}
function   act2()
{ real  aax,aay,bax,bay,ang_a,ang_b,x,y;

if (MODE)
{x=GetUnitX(u);
y=GetUnitY(u);
SetUnitX(au,x);
SetUnitY(au,y);
SetUnitX(bu,x);
SetUnitY(bu,y);
ax=GetUnitX(au);ay=GetUnitY(au);
bx=GetUnitX(bu);by=GetUnitY(bu);
ang+=10;
if (ang>=180)
{
ang =10;
}
ang_a=ang;
ang_b=ang_a+180;
}
else
{
ang=GetUnitFacing(u)+90;

SetUnitFacing(u,ang);

ang_a=ang;
if (ang>=180)
{ang_b=ang_a-180;} else {
ang_b=ang+180;}

}

debug BJDebugMsg(R2S(ang_b));


SetUnitFacing(au,ang_a);
SetUnitFacing(bu,ang_b);


aax=ax+300*Cos(ang_a*0.017);
aay=ay+300*Sin(ang_a*0.017);
bax=bx+300*Cos(ang_b*0.017);
bay=by+300*Sin(ang_b*0.017);
IssuePointOrderById(au,ORDER,aax,aay);
IssuePointOrderById(bu,ORDER,bax,bay);
if (IsUnitType(u,UNIT_TYPE_DEAD)==TRUE )
{DestroyTimer(bt);
DestroyTimer(at);
}
}

function   Act()
{debug BJDebugMsg("Act");
at=CreateTimer();bt=CreateTimer();
u=GetTriggerUnit();
ang=GetUnitFacing(u);

//获得了角度
au=CreateUnit(GetTriggerPlayer(),TYPE_DUMMY,GetUnitX(u),GetUnitY(u),ang);
ax=GetUnitX(au);ay=GetUnitY(au);
bu=CreateUnit(GetTriggerPlayer(),TYPE_DUMMY,GetUnitX(u),GetUnitY(u),ang+180);
bx=GetUnitX(bu);by=GetUnitY(bu);
UnitApplyTimedLife(au,'bhwe',DURATION);
UnitApplyTimedLife(bu,'bhwe',DURATION);
TimerStart(at,GAP,true, function   act2);
TimerStart(bt,DURATION,false, function   act3);


}

function   Cond()->boolean
{
debug BJDebugMsg("条件触发了");
return  GetSpellAbilityId()== ABILITY_ID && IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==TRUE;

}
function   onInit()
{ trigger  t=CreateTrigger();
//TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT);
TriggerRegisterUnitEvent( t, gg_unit_N000_0002, EVENT_UNIT_SPELL_EFFECT );

TriggerAddCondition(t,Condition( function   Cond));
TriggerAddAction(t, function   Act);

t=null;
debug BJDebugMsg("初始化了");
}
}
//! endzinc

[/jass]
螺旋桨 优化zinc.7z (27 KB, 下载次数: 51)

评分

参与人数 1威望 +27 收起 理由
w062c30 + 27 已阅

查看全部评分

发表于 2011-12-12 13:35:33 | 显示全部楼层
能让投射物死亡时直接消失而不播放dead动画么?
回复

使用道具 举报

发表于 2011-12-12 17:16:15 | 显示全部楼层
如果是马甲的话
马甲死亡时间调为0就不会播放死亡动画咯
回复

使用道具 举报

发表于 2011-12-12 17:52:25 | 显示全部楼层
原来是马甲啊,这么多不卡么?
回复

使用道具 举报

发表于 2011-12-12 18:03:26 | 显示全部楼层
说是如果呢
其实自己没下载下来看
回复

使用道具 举报

发表于 2011-12-12 22:50:17 | 显示全部楼层
  我只觉得在我电脑上跑不起来
回复

使用道具 举报

 楼主| 发表于 2011-12-13 18:54:53 | 显示全部楼层
表示是用马甲放的投射技能......怎么会跑不起来呢.
回复

使用道具 举报

发表于 2011-12-13 21:30:26 | 显示全部楼层
果然,和猫咪预想的一样……所以death动画就没办法了……
回复

使用道具 举报

发表于 2011-12-14 01:46:02 | 显示全部楼层
   呀哈 ? 没看出来
回复

使用道具 举报

 楼主| 发表于 2011-12-14 08:45:06 | 显示全部楼层

回 7楼(lo) 的帖子

lo:果然,和猫咪预想的一样……所以death动画就没办法了…… (2011-12-13 21:30)
没有听明白呢.
这个投射模型似乎没有死亡动作吧.我是说死亡是直接消失...
投射物的死亡动作一般都是如此.
话说.除非你用单位模型.死亡才会有死亡动作的吧....
比如:魔兽自带的投射模型.死亡动作就是消失....而且这种消失动作比投射物直接消失要好看一些吧.个人觉得..
回复

使用道具 举报

发表于 2011-12-14 09:58:19 | 显示全部楼层
进来学习一下
回复

使用道具 举报

发表于 2011-12-14 12:34:46 | 显示全部楼层
  如果是马甲的话 淡入是个很好的选择
回复

使用道具 举报

 楼主| 发表于 2011-12-15 10:15:50 | 显示全部楼层

回 11楼(uoer) 的帖子

uoer:  如果是马甲的话 淡入是个很好的选择 (2011-12-14 12:34) 
你说的淡入是神马呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-6-21 03:28 , Processed in 0.212867 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表