• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Jass Script Not Working

Status
Not open for further replies.
Level 2
Joined
Apr 26, 2007
Messages
17
Hi guys.

I have made a CreateEffectLine function, which is a function which lets you create a certain amounts of a special effect of your choice from location start to location finish. This is the trigger which I am using the function in, but it doesn't work properly. Btw I will quickly explain the 7 parameters. whichModel is the special effects model, location start is where the effects start from, location finish is where the special effects finish, integer amount is the amount of special effects made between the two points, real time is the amount of time that it waits between each of the special effects being made, real duration is the time that the effects last for. These are the two problems:
1) It does not create the line of special effects to point b properly. It starts at location start, but does not go to the location finish. Instead, it starts at location start, and the function always uses a point somewhere near the centre of the map as location finish.

2) It does not remove the special effects, so they stay there for ever.

JASS:
function IceFieldRawcode takes nothing returns integer
return 'A006'
endfunction

function Trig_Ice_Field_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == IceFieldRawcode() ) ) then
        return false
    endif
    return true
endfunction

function CreateEffectLine takes string whichModel, location start, location finish, integer amount, real time, real duration returns nothing
local string a = whichModel
local location b = start
local location c = finish
local integer d = amount
local real e = time
local real f = DistanceBetweenPoints(b,c)
local effect g
local integer i = 0
local real j = AngleBetweenPoints(b,c)
local effect array k
local real l = duration-(e*d)
set f = f/d
loop
exitwhen i == d
set g = AddSpecialEffectLoc(a,b)
set k[i] = GetLastCreatedEffectBJ()
set b = PolarProjectionBJ(b,f,j)
call TriggerSleepAction(e)
set i = i+1
endloop
call TriggerSleepAction(l)
call RemoveLocation(start)
call RemoveLocation(finish)
call RemoveLocation(b)
call RemoveLocation(c)
set i = 0
loop
exitwhen i == d
call DestroyEffect(k[i])
set i = i+1
endloop
endfunction

function Trig_Ice_Field_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local unit b = GetSpellTargetUnit()
local location c = GetUnitLoc(a)
local location d = GetUnitLoc(b)
call CreateEffectLine("units\\critters\\SpiderCrab\\SpiderCrab.mdl", c,d,10,0.1, 5)
endfunction

//===========================================================================
function InitTrig_Ice_Field takes nothing returns nothing
    set gg_trg_Ice_Field = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Field, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( gg_trg_Ice_Field, Condition( function Trig_Ice_Field_Conditions ) )
    call TriggerAddAction( gg_trg_Ice_Field, function Trig_Ice_Field_Actions )
endfunction


Thanks in advance.
__________________
-DeadlySheep_1
deadlysheep_1 is online now Edit/Delete Message
 
Status
Not open for further replies.
Top