Tuesday, 2025-06-17, 11:44 PM


Main
Registration
Login
Welcome Guest | RSS  
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: JonNny, Hanky  
Trigger Question
d3therDate: Monday, 2008-06-09, 6:01 PM | Message # 1
Private
Group: Users
Reputation: 1
Status: Offline
Wow. Looks like I'm the first posting in this thread...

Well, I need help on importing Hanky spells with NewGen 5a.

I tried to syntax check the Crush Spell (Random Spellpack from Hanky). And the errors are :

Here's The Trigger {Crush(Random Spellpack from Hanky) (I cut some for the "Message text is too long" reason.)

Code
//Crush by OrkOfMordor aka Hanky aka MDZ-OrkOfMordor

//Constants
scope Crush
   globals
      private constant integer SpellId  ='A001'
      private constant integer BuffAddId='A002'
      private constant string BuffOrder ="berserk"
      private constant real MotionSpeed =10.00
      private constant real PeriodicTime=0.03
      private constant real MaxPushTime =0.50
      private constant real MaxWaitTime =4.00
      private constant string PushMdl   ="Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
      private constant string PushAtt   ="origin"
   endglobals

   private constant function Cr_Percent takes real lvl returns real
     return 70+(5*lvl)
   endfunction

   //Conditions

   private function Trig_Crush_Conditions takes nothing returns boolean
     return GetUnitAbilityLevel(GetAttacker(),SpellId) > 0
   endfunction

   //Actions
   private struct CrushDatas extends MotionLoop
     real tt
     unit attacked
     real angle
      
     method motion takes nothing returns nothing
       local real x        =GetUnitX(.attacked)+MotionSpeed*Cos(.angle*3.14159/180)
       local real y        =GetUnitY(.attacked)+MotionSpeed*Sin(.angle*3.14159/180)

       call SetUnitX(.attacked,x)
       call SetUnitY(.attacked,y)
       call DestroyEffect(AddSpecialEffectTarget(PushMdl,.attacked,PushAtt))
       set .tt=PeriodicTime+.tt

       if .tt>MaxPushTime then
         set .active=false
       endif
     endmethod
      

Any idea to fix it?
Hmm. Is there any add-on that i should dl ?

Really - really much love and thanks. smile


<img src="http://i289.photobucket.com/albums/ll228/d3ther/userbar635313os0.gif" border="0" alt="Photobucket"></a>
 
WaRadiusDate: Monday, 2008-06-09, 7:49 PM | Message # 2
Admin
Group: Administrators
Messages: 27
Reputation: 6
Status: Offline
Quote (d3ther)
(I cut some for the "Message text is too long" reason.)

Oh, sorry, fixed happy 40k symbols max now.
 
HankyDate: Monday, 2008-06-09, 7:52 PM | Message # 3
Lieutenant colonel
Group: Moderators
Messages: 116
Reputation: 9
Status: Offline
Hmm yea you are the first who post here ;). A happy hello and welcome to you.

At first you should check if you have also importet the main script its at the header of the trigger editor. It should look like this:

Code
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//All functions are made by OrkOfMordor aka Hanky aka MDZ-OrkOfMordor! //
// //
// Thanx to Vexorian for his JassNewGenPack (download the modificated editor at: www.wc3campaigns.net)! //
// //
// This Spellpack uses: //
// - JassNewGenPack //
// - some Systems from OrkOfMordor aka Hanky aka MDZ-OrkOfMordor //
// //
// To use this spellpack you need: //
// - JassNewGenPack //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! textmacro CostumInterface takes Loop,End,path,periodic
library CostumInterface$path$ initializer init
interface $path$Loop
boolean active=false
boolean paused=false

method $Loop$ takes nothing returns nothing
method $End$ takes nothing returns nothing
endinterface

globals
private $path$Loop array $path$_loopObject
private integer $path$_size=0

private trigger $path$_loop
constant real periodic=$periodic$
endglobals

function AddObjectTo$path$ takes $path$Loop loopObject returns integer
set $path$_loopObject[$path$_size]=loopObject
set $path$_loopObject[$path$_size].active=true
set $path$_size=$path$_size+1

if not IsTriggerEnabled($path$_loop) then
call EnableTrigger($path$_loop)
endif

return $path$_size
endfunction

private function Loop$path$ takes nothing returns nothing
local integer index=0

loop
exitwhen index==$path$_size
if $path$_loopObject[index].active and not $path$_loopObject[index].paused then
call $path$_loopObject[index].$Loop$.execute()
set index=index+1
elseif $path$_loopObject[index].paused then
set index=index+1
else
call $path$_loopObject[index].$End$()
set $path$_size=$path$_size-1
set $path$_loopObject[index]=$path$_loopObject[$path$_size]
endif
endloop

if $path$_size<=0 then
call DisableTrigger($path$_loop)
endif
endfunction

private function init takes nothing returns nothing
set $path$_loop=CreateTrigger()
call TriggerRegisterTimerEvent($path$_loop,periodic,true)
call TriggerAddAction($path$_loop,function Loop$path$)
call DisableTrigger($path$_loop)
endfunction
endlibrary
//! endtextmacro

//! runtextmacro CostumInterface("motion","endmotion","Motion","0.03")

library MainFunctions initializer init
globals
private group loopG =null
private item getWalkable=null
private location loc =null
private constant integer getWalkable_id='sehr'
private constant integer flyHack ='Amrf'
constant integer GCI =1
endglobals

function H2I takes handle h returns integer
return h
return 0
endfunction

function I2U takes integer i returns unit
return i
return null
endfunction

function I2TRIG takes integer i returns trigger
return i
return null
endfunction

function I2E takes integer i returns effect
return i
return null
endfunction

function I2L takes integer i returns lightning
return i
return null
endfunction

function I2TXT takes integer i returns texttag
return i
return null
endfunction

function GetProVal takes real value returns real
if value<0. then
return value*-1
endif
return value
endfunction

function ClearTextMessagesForPlayer takes player p returns nothing
if (GetLocalPlayer()==p) then
call ClearTextMessages()
endif
endfunction

function UnitAddFly takes unit u returns nothing
call UnitAddAbility(u,flyHack)
call UnitRemoveAbility(u,flyHack)
endfunction

function A2PXY takes real x,real y,real xt,real yt returns real
return ModuloReal(bj_RADTODEG*Atan2(yt-y,xt-x),360.)
endfunction

function D2PXY takes real x,real y,real xt,real yt returns real
local real dx=xt-x
local real dy=yt-y
return SquareRoot(dx*dx+dy*dy)
endfunction

function IsPointWalkable takes real x,real y returns boolean
call SetItemPosition(getWalkable,x,y)
call SetItemVisible(getWalkable,false)
return GetItemX(getWalkable)==x and GetItemY(getWalkable)==y
endfunction

function Enum_AntiLeak takes nothing returns boolean
return true
endfunction

function GetUnitsInRange takes real radius,real x,real y returns group
call GroupClear(loopG)
call GroupEnumUnitsInRange(loopG,x,y,radius,Filter(function Enum_AntiLeak))
return loopG
endfunction

function GetUnitsInRangeEx takes real radius,real x,real y returns group
call GroupEnumUnitsInRange(loopG,x,y,radius,Filter(function Enum_AntiLeak))
return loopG
endfunction

function RangedReal takes real v,real min,real max returns real
if v<min then
return min
elseif v>max then
return max
endif

return v
endfunction

function GetZ takes real x,real y returns real
call MoveLocation(loc,x,y)
return GetLocationZ(loc)
endfunction

function GetFlyParabel takes real x1,real y1,real bz,real ez,real maxtime,real temptime,real maxheight,real speed,real x2,real y2,real x3,real y3 returns real
local real tdist = D2PXY(x1,y1,x2,y2) / maxtime * speed
local real z1
local real z2
local real zxy
set z1 = GetZ(x1,y1)+bz
set z2 = GetZ(x2,y2)
set zxy = (GetZ(x3,y3)-z1) / D2PXY(x1,y1,x3,y3)
return maxheight - maxheight / maxtime / maxtime * 4 * (temptime-maxtime/2) * (temptime-maxtime/2) + temptime / speed * tdist * zxy + z1 - z2 + ez
endfunction

function IsUnitNotImmun takes unit c,unit u returns boolean
return c!=u and not IsUnitType(u,UNIT_TYPE_STRUCTURE) and not IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) and IsUnitEnemy(u, GetOwningPlayer(c)) and GetUnitState(u,UNIT_STATE_LIFE) > 0.00
endfunction

function TerrainDeformationRippleXY takes real duration, boolean limitNeg, real x,real y, real startRadius, real endRadius, real depth, real wavePeriod, real waveWidth returns terraindeformation
local real spaceWave
local real timeWave
local real radiusRatio

if (endRadius <= 0 or waveWidth <= 0 or wavePeriod <= 0) then
return null
endif

set timeWave = 2.0 * duration / wavePeriod
set spaceWave = 2.0 * endRadius / waveWidth
set radiusRatio = startRadius / endRadius

set bj_lastCreatedTerrainDeformation = TerrainDeformRipple(x,y, endRadius, depth, R2I(duration * 1000), 1, spaceWave, timeWave, radiusRatio, limitNeg)
return bj_lastCreatedTerrainDeformation
endfunction

function AB_DestroyTrigger takes trigger trig returns nothing
if trig!=null then
call TriggerClearActions(trig)
call TriggerClearConditions(trig)
call DestroyTrigger(trig)
endif
endfunction

function AB_DestroyTimer takes timer t returns nothing
if t!=null then
call PauseTimer(t)
call DestroyTimer(t)
endif
endfunction

function AB_DestroyGroup takes group g returns nothing
if g!=null then
call GroupClear(g)
call DestroyGroup(g)
endif
endfunction

function AB_DialogDestroy takes dialog log returns nothing
if log!=null then
call DialogClear(log)
call DialogDestroy(log)
endif
endfunction

function AB_DestroyMultiboard takes multiboard lb returns nothing
if lb!=null then
call MultiboardClear(lb)
call DestroyMultiboard(lb)
endif
endfunction

private function init takes nothing returns nothing
set getWalkable=CreateItem(getWalkable_id,0,0)
set loc =Location(0,0)
set loopG =CreateGroup()
call SetItemVisible(getWalkable,false)
endfunction
endlibrary

// Screen Solution: 1280x1024
// MultiIndexSystem ©
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

// Credits:
// ¯¯¯¯¯¯¯
// ·· JassGenNewPack: Vexorian ··
// ·· Script by: Hanky ··

// Made from the clan
// _________ _________ ________________________ _______________________
// |®®®®®®®®®\ |®®®®®®®®®| |®®®®®®®®®®®®®®®®®®®®®®®®| |®®®®®®®®®®®®®®®®®®®®®®®|
// |® ®\ |® ®| |® ®| |® ®|
// |® ®\ |® ®| |® ®| |® ®|
// |® ®\ |® ®| |® ®| |® ®|
// |® ®\ |® ®| |® ®®®®®®®®®®®®®®®| |® ®®®®®®® ®|
// |® ®\|® ®| |® ®|¯¯¯¯¯¯¯¯¯¯¯¯¯ |® ® ® ®|
// |® ®|® ®| |® ®| |® ® ® ®|
// |® ® ®® ®| |® ®| _________ |® ® ® ®|
// |® ® ® ®| |® ®| |®®®®®®®®®| |® ® ® ®|
// |® ® ®| |® ®|___|® ®| |® ® ® ®|
// |® ®® ®| |® ®®®®®®® ®| |® ®®®®®®® ®|
// |® ®|® ®| |® ®| |® ®|
// |® ®|\® ®| |® ®| |® ®|
// |® ®| \® ®| |® ®| |® ®|
// |®®®®®®®®®| \®®®®®®®®®®®®| |®®®®®®®®®®®®®®®®®®®®®®®®| |®®®®®®®®®®®®®®®®®®®®®®®|
// ¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Visit: - No Homepage -

// FAQ - How to add your own slots manual?
// First Step: - add to the struct MultiIndex$id$ a slot (in this example the slot we add is 7777)
// For example:
// globals
// integer array MultiIndex_$id$1
// integer array MultiIndex_$id$2
// integer array MultiIndex_$id$3
// integer array MultiIndex_$id$4
// integer array MultiIndex_$id$7777
// endglobals

// Second Step: -add your own two functions
// For example:
// function Set_MultiIndex_$id$7777 takes nothing returns nothing
// ¯¯¯¯
// set MultiIndex_$id$7777[ExtentedMultiCache_handleIndex]=ExtentedMultiCache_handleAttach
// ¯¯¯¯
// endfunction

// function Get_MultiIndex_$id$7777 takes nothing returns nothing
// ¯¯¯¯
// set ExtentedMultiCache_handleAttach=MultiIndex_$id$7777[ExtentedMultiCache_handleIndex]
// ¯¯¯¯
// endfunction

// Hint: Look at the highlighted words in the example.

//! textmacro MIS takes id,path
library MultiIndexSystem$path$ requires ExtentedMultiCache
globals
integer array MultiIndex_$id$1
integer array MultiIndex_$id$106
integer array MultiIndex_$id$107
integer array MultiIndex_$id$108
endglobals

function Set_MultiIndex_$id$1 takes nothing returns nothing
set MultiIndex_$id$1[ExtentedMultiCache_handleIndex]=ExtentedMultiCache_handleAttach
endfunction

function Get_MultiIndex_$id$1 takes nothing returns nothing
set ExtentedMultiCache_handleAttach= MultiIndex_$id$1[ExtentedMultiCache_handleIndex]
endfunction

function Set_MultiIndex_$id$106 takes nothing returns nothing
set MultiIndex_$id$106[ExtentedMultiCache_handleIndex]=ExtentedMultiCache_handleAttach
endfunction

function Get_MultiIndex_$id$106 takes nothing returns nothing
set ExtentedMultiCache_handleAttach= MultiIndex_$id$106[ExtentedMultiCache_handleIndex]
endfunction

function Set_MultiIndex_$id$107 takes nothing returns nothing
set MultiIndex_$id$107[ExtentedMultiCache_handleIndex]=ExtentedMultiCache_handleAttach
endfunction

function Get_MultiIndex_$id$107 takes nothing returns nothing
set ExtentedMultiCache_handleAttach= MultiIndex_$id$107[ExtentedMultiCache_handleIndex]
endfunction

function Set_MultiIndex_$id$108 takes nothing returns nothing
set MultiIndex_$id$108[ExtentedMultiCache_handleIndex]=ExtentedMultiCache_handleAttach
endfunction

function Get_MultiIndex_$id$108 takes nothing returns nothing
set ExtentedMultiCache_handleAttach= MultiIndex_$id$108[ExtentedMultiCache_handleIndex]
endfunction
endlibrary
//! endtextmacro

//! runtextmacro MIS("1","A")
//! runtextmacro MIS("2","B")
//! runtextmacro MIS("3","C")
//! runtextmacro MIS("4","D")

//! textmacro EMCode takes id
globals
constant string setcode$id$="Set_MultiIndex_$id$"
constant string getcode$id$="Get_MultiIndex_$id$"
endglobals
//! endtextmacro

//! runtextmacro EMCode("1")
//! runtextmacro EMCode("2")
//! runtextmacro EMCode("3")
//! runtextmacro EMCode("4")

library ExtentedMultiCache requires MainFunctions
globals
private constant integer handleLimit =32760 //Set here your handle limit currently its "32760"
private constant boolean delay =true //Set if you want that your handle count starts delayed
private constant real delaytime =0.03 //Set your delay time
private constant integer minHandleIndex=0x100000

public integer handleIndex =0
public integer handleAttach =0

private constant integer limit1=8190
private constant integer limit2=16380
private constant integer limit3=24570
private constant integer limit4=32760

private constant string error="|c00FF0000YOU HIT THE LIMIT! (LIMIT: 32760)"
endglobals

function SetHandleAttach takes handle h,integer key,integer attach returns nothing
set handleIndex=H2I(h)-minHandleIndex
set handleAttach=attach

if handleIndex<=limit1 then
call ExecuteFunc(setcode1+I2S(key))
elseif handleIndex<=limit2 then
set handleIndex=handleIndex-limit1
call ExecuteFunc(setcode2+I2S(key))
elseif handleIndex<=limit3 then
set handleIndex=handleIndex-limit2
call ExecuteFunc(setcode3+I2S(key))
elseif handleIndex<=limit4 then
set handleIndex=handleIndex-limit3
call ExecuteFunc(setcode4+I2S(key))
else
call BJDebugMsg(error)
endif
endfunction

function GetHandleAttach takes handle h,integer key returns integer
set handleIndex=H2I(h)-minHandleIndex
set handleAttach=0

if handleIndex<=limit1 then
call ExecuteFunc(getcode1+I2S(key))
elseif handleIndex<=limit2 then
set handleIndex=handleIndex-limit1
call ExecuteFunc(getcode2+I2S(key))
elseif handleIndex<=limit3 then
set handleIndex=handleIndex-limit2
call ExecuteFunc(getcode3+I2S(key))
elseif handleIndex<=limit4 then
set handleIndex=handleIndex-limit3
call ExecuteFunc(getcode4+I2S(key))
else
call BJDebugMsg(error)
endif

return handleAttach
endfunction
endlibrary

//----------------------------------------------------------------------------------------------------------------------
//* Timed Dead *
//----------------------------------------------------------------------------------------------------------------------
library TimedHandleDead requires MainFunctions,ExtentedMultiCache
function U2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call RemoveUnit(I2U(GetHandleAttach(t,GCI)))
call AB_DestroyTimer(t)
set t=null
endfunction

function U2Null takes unit u,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function U2Death)
call SetHandleAttach(t,GCI,H2I(u))
set t = null
endfunction

function T2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
local trigger tr = I2TRIG(GetHandleAttach(t,GCI))

if tr!=null then
call DestroyTrigger(tr)
endif
call AB_DestroyTimer(t)
set t =null
set tr=null
endfunction

function T2Null takes trigger tt,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function T2Death)
call SetHandleAttach(t,GCI,H2I(tt))
set t = null
endfunction

function E2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyEffect(I2E(GetHandleAttach(t,GCI)))
call AB_DestroyTimer(t)
set t=null
endfunction

function E2Null takes effect e,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function E2Death)
call SetHandleAttach(t,GCI,H2I(e))
set t = null
endfunction

function L2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyLightning(I2L(GetHandleAttach(t,GCI)))
call AB_DestroyTimer(t)
set t=null
endfunction

function L2Null takes lightning l,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function L2Death)
call SetHandleAttach(t,GCI,H2I(l))
set t = null
endfunction

function TT2Death takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyTextTag(I2TXT(GetHandleAttach(t,GCI)))
call AB_DestroyTimer(t)
set t=null
endfunction

function TT2Null takes texttag tt,real duration returns nothing
local timer t = CreateTimer()
call TimerStart(t,duration,false,function L2Death)
call SetHandleAttach(t,GCI,H2I(tt))
set t = null
endfunction
endlibrary

library CountDestructable requires MainFunctions
globals
private rect dat_prove=Rect(0,0,0,0)
endglobals

private function EnumCountDestructables takes nothing returns nothing
if GetDestructableLife(GetEnumDestructable())>0 then
set bj_forLoopAIndex=bj_forLoopAIndex+1
endif
endfunction

function CountDestructableInRangeOfXY takes real x,real y,real range returns integer
call SetRect(dat_prove,x-range,y-range,x+range,y+range)
set bj_forLoopAIndex=0
call EnumDestructablesInRect(dat_prove,Filter(function Enum_AntiLeak),function EnumCountDestructables)
return bj_forLoopAIndex
endfunction
endlibrary

//================================================================================================
//Passiv - Damage Skill
//================================================================================================
library DamageSkill requires ExtentedMultiCache,MainFunctions
private struct DmgData
trigger GetDamage
trigger GetOrder
unit attacker
timer check

method onDestroy takes nothing returns nothing
call AB_DestroyTrigger(.GetDamage)
call AB_DestroyTrigger(.GetOrder)
call AB_DestroyTimer(.check)

set .GetDamage=null
set .GetOrder =null
set .attacker =null
set .check =null
endmethod
endstruct

function DestroyDamageTrig_Vars takes trigger tt returns nothing
local DmgData datas =GetHandleAttach(tt,GCI)
call DmgData.destroy(datas)
endfunction

private function TimerDestroy_DamageTrigger takes nothing returns nothing
local DmgData datas =GetHandleAttach(GetExpiredTimer(),GCI)
call DmgData.destroy(datas)
endfunction

private function TriggerDestroy_DamageTrigger takes nothing returns nothing
local DmgData datas =GetHandleAttach(GetTriggeringTrigger(),GCI)
call DmgData.destroy(datas)
endfunction

function DamageEvent_Condition takes nothing returns boolean
local DmgData datas =GetHandleAttach(GetTriggeringTrigger(),GCI)
return GetEventDamageSource()==datas.attacker
endfunction

function TriggerAddDamageEvent takes unit attacked,real duration,unit attacker,code func returns nothing
local DmgData datas =DmgData.create()

//Init
set datas.GetDamage=CreateTrigger()
set datas.GetOrder =CreateTrigger()
set datas.check =CreateTimer()
set datas.attacker =attacker

//Storing
call SetHandleAttach(datas.GetDamage,GCI,datas)
call SetHandleAttach(datas.GetOrder,GCI,datas)
call SetHandleAttach(datas.check,GCI,datas)

//Trigger Settings
call TriggerAddAction(datas.GetDamage,func)
call TriggerAddCondition(datas.GetDamage,Condition(function DamageEvent_Condition))
call TriggerRegisterUnitEvent(datas.GetDamage,attacked,EVENT_UNIT_DAMAGED)

call TriggerAddAction(datas.GetOrder,function TriggerDestroy_DamageTrigger)
call TriggerRegisterUnitEvent(datas.GetOrder,attacker, EVENT_UNIT_ISSUED_ORDER )

//Timer Start
call TimerStart(datas.check,duration,false,function TimerDestroy_DamageTrigger)
endfunction
endlibrary

//Motion System
library MotionDatabase initializer init requires MainFunctions,CostumInterfaceMotion
globals
private constant real MinimalChaseRange=10.

unit tm //Temp Missle
unit tc //Temp Caster
unit tv //Temp Victim

private rect MaxArea =null
endglobals

struct JumpDatabase extends MotionLoop
unit u

real distance
real angle
real speed

real mtime
real ctime

real array x[2]
real array y[2]
real array z[3]

method motion takes nothing returns nothing
local real curv
local real x
local real y

set .ctime=.ctime+periodic

if .ctime>.mtime then
call UnitAddFly(.u)
call SetUnitFlyHeight(.u,.z[2],0)
set .active=false
else
set x=GetUnitX(.u)+.speed*Cos(.angle*3.14159/180)
set y=GetUnitY(.u)+.speed*Sin(.angle*3.14159/180)
set curv=GetFlyParabel(.x[0],.y[0],.z[0],.z[2],.mtime,.ctime,.z[1],.speed,x,y,.x[1],.y[1])

if RectContainsCoords(MaxArea,x,y) then
call SetUnitX(.u,x)
call SetUnitY(.u,y)
endif
call UnitAddFly(.u)
call SetUnitFlyHeight(.u,curv,0)
endif
endmethod

method endmotion takes nothing returns nothing
call .destroy()
endmethod

method onDestroy takes nothing returns nothing
set .u =null

set .distance=0.
set .angle =0.
set .speed =0.

set .ctime =0.
set .mtime =0.

set .x[0] =0.
set .y[0] =0.
set .z[0] =0.
set .x[1] =0.
set .y[1] =0.
set .z[1] =0.
set .z[2] =0.
endmethod
endstruct

struct ChaseDatabase extends MotionLoop
unit u
unit target
unit attacker

real speed
real z
real Rz

string endfunc

method motion takes nothing returns nothing
local real Ux =GetUnitX(.u)
local real Uy =GetUnitY(.u)
local real Tx =GetUnitX(.target)
local real Ty =GetUnitY(.target)
local real distance=D2PXY(Ux,Uy,Tx,Ty)
local real angle

if distance>MinimalChaseRange then
set angle=A2PXY(Ux,Uy,Tx,Ty)
set Ux=Ux+.speed*Cos(angle*3.14159/180)
set Uy=Uy+.speed*Sin(angle*3.14159/180)

call SetUnitPosition(.u,Ux,Uy)
call UnitAddFly(.u)
call SetUnitFlyHeight(.u,.z,.Rz)
else
set .active=false
endif
endmethod

method endmotion takes nothing returns nothing
set tv=.target
set tm=.u
set tc=.attacker
call ExecuteFunc(.endfunc)
call .destroy()
endmethod

method onDestroy takes nothing returns nothing
set .u =null
set .target =null
set .attacker=null

set .speed =0.
set .z =0.
set .Rz =0.
endmethod
endstruct

struct CollisionDatabase extends MotionLoop
unit u
unit attacker

real speed
real angle
real z
real Rz
real range
real distance
real x
real y

string endfunc

method motion takes nothing returns nothing
local unit a
local group g
local integer c

set .distance=.distance-.speed

if .distance>0. then
set .x=.x+.speed*Cos(.angle*3.14159/180)
set .y=.y+.speed*Sin(.angle*3.14159/180)
call SetUnitPosition(.u,.x,.y)

set g=GetUnitsInRange(.range,.x,.y)
set c=0
loop
set a=FirstOfGroup(g)
exitwhen a==null
call GroupRemoveUnit(g,a)

if IsUnitNotImmun(.attacker,a) and a!=.u then
set c=c+1
endif
endloop
call GroupClear(g)
set g=null

if c>0 then
set .active=false
endif
else
set .active=false
endif
endmethod

method endmotion takes nothing returns nothing
set tc=.attacker
set tm=.u
call ExecuteFunc(.endfunc)
call .destroy()
endmethod

method onDestroy takes nothing returns nothing
set .u =null
set .attacker=null

set .speed =0.
set .angle =0.
set .z =0.
set .Rz =0.
set .range =0.
set .distance=0.
set .x =0.
set .y =0.
endmethod
endstruct

function LaunchMissileAtPointEx takes unit u,real x1,real y1,real bZ,real maxZ,real x2,real y2,real speed returns nothing
local JumpDatabase JD =JumpDatabase.create()

set JD.u =u
set JD.ctime =0.
set JD.z[0] =bZ
set JD.z[1] =maxZ
set JD.z[2] =0.
set JD.x[0] =x1
set JD.y[0] =y1
set JD.x[1] =x2
set JD.y[1] =y2
set JD.speed =speed
set JD.distance =D2PXY(x1,y1,x2,y2)
set JD.angle =A2PXY(x1,y1,x2,y2)
set JD.mtime =JD.distance/JD.speed*periodic

call SetUnitPosition(u,x1,y1)
call AddObjectToMotion(JD)
endfunction

function LaunchNormalChaseMissileAtPointEx takes unit attacker,unit missile,real x1,real y1,real z,unit victim,real speed,real Zrate,string colfunc returns nothing
local ChaseDatabase CD =ChaseDatabase.create()

set CD.u =missile
set CD.z =z
set CD.attacker =attacker
set CD.target =victim
set CD.speed =speed
set CD.endfunc =colfunc
set CD.Rz =Zrate

call SetUnitPosition(missile,x1,y1)
call AddObjectToMotion(CD)
endfunction

function LaunchNormalCollisionMissileAtPointEx takes unit attacker,unit missile,real x1,real y1,real z,real x2,real y2,real speed,real range,string colfunc returns nothing
local CollisionDatabase CD =CollisionDatabase.create()

set CD.u =missile
set CD.attacker =attacker
set CD.z =z
set CD.Rz =0.
set CD.x =x1
set CD.y =y1
set CD.range =range
set CD.speed =speed
set CD.endfunc =colfunc
set CD.distance =D2PXY(x1,y1,x2,y2)
set CD.angle =A2PXY(x1,y1,x2,y2)

call SetUnitPosition(missile,x1,y1)
call AddObjectToMotion(CD)
endfunction

private function init takes nothing returns nothing
set MaxArea=bj_mapInitialPlayableArea
endfunction
endlibrary

After you importet that you should also of course import the dummy and the spells from the ability editor. Also compare the ids of the spells in the ability editor with the ids in the spellscript. If all that dont work you can sent me your map and I will fix it.



Made by Smoe reworked by GiR aka Darkt3mpl3r
 
d3therDate: Tuesday, 2008-06-10, 6:53 AM | Message # 4
Private
Group: Users
Reputation: 1
Status: Offline
Well, usually, before i import the spells. I tried it first in the spell map it self...

And Boom. It didn't work out. I haven't imported it in my map.

Hmm... I met lots of problem like this, I can't play the map with vJass after i mess it up with WE (most of it, i just mess the damage and chance things).

I think the problem is not your map, the problem goes to my WE. Is there anything that i should DL? (I'm using NewGen 5a, just this, i don't know whether any things have been updated).

I'm wondering why my WE always show syntax error when there's a scope...

Thanks soooooooo muchhhhhhhh biggrin biggrin biggrin .


<img src="http://i289.photobucket.com/albums/ll228/d3ther/userbar635313os0.gif" border="0" alt="Photobucket"></a>
 
HankyDate: Tuesday, 2008-06-10, 12:32 PM | Message # 5
Lieutenant colonel
Group: Moderators
Messages: 116
Reputation: 9
Status: Offline
Maybe it help if you reinstall wc3 and the we ... well dunno :/ but at first check if you got really the newest NewGenPack version.


Made by Smoe reworked by GiR aka Darkt3mpl3r
 
d3therDate: Tuesday, 2008-06-10, 6:41 PM | Message # 6
Private
Group: Users
Reputation: 1
Status: Offline
Yeah. I've re-installed my WC and re-downloaded my WE. And still can't. Your spellpack map can't be played after i changed the chance of crush. Hmm.. Is it because of Pjass / Jasshelper?
Thanks In Advance biggrin biggrin biggrin .


<img src="http://i289.photobucket.com/albums/ll228/d3ther/userbar635313os0.gif" border="0" alt="Photobucket"></a>
 
HankyDate: Tuesday, 2008-06-10, 7:12 PM | Message # 7
Lieutenant colonel
Group: Moderators
Messages: 116
Reputation: 9
Status: Offline
Maybe you forgot to enable the jass helper look under JassHelper and check if hes enabled. It should look like this:

and




Made by Smoe reworked by GiR aka Darkt3mpl3r
 
  • Page 1 of 1
  • 1
Search:

Clan NgO © 2025Powered by uCoz