HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Errors when copying jass into my map?

09-23-2008, 04:23 PM#1
hillbillyboi
hey guys, ive been having this problem for a while now and i was wondering if anyone has it too? and if there is a solution?

every time i atempt to feature someone elses jass script in my map it comes up with hundreds of compile errors and no matter what i do i cant seem to fix it :(

im quite inexperienced with jass, and was hoping if anyone could help me out it would be most appreciated :)

thank you.
09-23-2008, 04:29 PM#2
moyack
What code and errors please...
09-23-2008, 04:34 PM#3
Blubb-Tec
if those scripts are vJass, make sure you have the JassNewGen Pack installed, and have the option 'JassHelper'->'Enable JassHelper' checked.
Else, yeah, I second moyack, give any of the scripts you wanted to implement, and give a few of the errors(screenshot?).
09-24-2008, 11:12 AM#4
hillbillyboi
the one im doing atm is xxdingo93xx's "Spike Impact" spell.
i have that tool, just never used it before lol, i used it and now only one problem arises.
thank you Blubb-Tec :)

it says "the trigger "SpikeImpact Copy" must have an initialization function called "InitTrig_SpikeImpact_Copy".

im not really sure how to implement that, any ideas?
this is the script:

Collapse JASS:
//TESH.scrollpos=36
//TESH.alwaysfold=0
/////////////////////////////
// ***Hello Everybody***
// credit me if you use this
// Greetz, xxdingo93xx
/////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////
// ***CREDITS*** //
//
//To: Interflo 
//For: 
// -teaching me the basics of JASS 
// -helping me a lot with this spell
// -helping me to get out of a wc3-crash
//
//To: Flame_Phoenix 
//For: 
// -Helping me out with leaky and evil functions 
// -overwriting my spell into JESP
// -overwriting my spell into vJASS
//
//////////////////////////////////////////////////////////////////////////////////////////////


scope SpikedImpact initializer Init

//========================================================================================
//====================================SETUP START=========================================
//========================================================================================
    globals
        private constant integer AID = 'A000' //the rawcode of the ability
        private constant integer SPIKED_ONE = 'n000' //the rawcode of the unit spike 1
        private constant integer SPIKED_TWO = 'n001' //the rawcode of the unit spike 2
        private constant integer SPIKED_THREE = 'n002' //the rawcode of the unit spike 3
        private constant integer SPIKED_FOUR = 'n003' //the rawcode of the unit spike 4
        private constant string START_ANIMATION = "Morph" //the animation the caster will play when he casts the spell
        private constant string END_ANIMATION = "Morph Defend" //the animation the caster will play when the spell ends
        private constant real RED = 100. //The red RGB color of the affected units from 0 to 100
        private constant real GREEN = 15. //The green RGB color of the affected units from 0 to 100
        private constant real BLUE = 15. //The blue RGB color of the affected units from 0 to 100
        private constant string ENEMY_EFFECT = "Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl" //the that will be created at the enemy when it is affected, in this case is blood.
        private constant string ENEMY_EFFECT_REGION = "chest" //the place on the enemy's body where the enemyEffect will be created
        private constant string ENEMY_DAMAGE = "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl" //the that will be created at the enemy when damaged by the spell
        private constant string ENEMY_DAMAGE_REGION = "chest" //the place on the enemy's body where the enemyDamage will be created
    endglobals

    private constant function Radius takes integer level returns real
        return 650. + (level * 50.) //the AOE of the spell
    endfunction

    private constant function Damage takes integer level returns real
        return level * 300. //the amount of damage the enemy will take per level
    endfunction

//========================================================================================
//====================================SETUP END===========================================
//========================================================================================
    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == AID
    endfunction
//=======================================================================================
    private function RecolorEnemies takes nothing returns nothing
        local unit Enemy = GetEnumUnit()

        if (IsUnitEnemy(Enemy, GetOwningPlayer(GetSpellAbilityUnit()))) then
            call PauseUnit(Enemy, true)
            call SetUnitTimeScale(Enemy, 0.00)
            call SetUnitVertexColor(Enemy, PercentToInt(RED, 255), PercentToInt(GREEN, 255), PercentToInt(BLUE, 255), PercentToInt(100, 255))
            call DestroyEffect(AddSpecialEffectTarget(ENEMY_EFFECT, Enemy, ENEMY_EFFECT_REGION))
        endif

        set Enemy = null
    endfunction
//========================================================================================
    private function KillEnemies takes nothing returns nothing
        local unit Enemy = GetEnumUnit()
        local unit Caster = GetSpellAbilityUnit()
        local real DamageToDeal = Damage(GetUnitAbilityLevel(Caster, AID))

        if (IsUnitEnemy(Enemy, GetOwningPlayer(Caster))) then
            call SetUnitTimeScale(Enemy, 100. * 0.01)
            if(GetWidgetLife(Enemy) <= DamageToDeal) then
                call SetUnitExploded(Enemy, true)
                call KillUnit(Enemy)
            else
                call UnitDamageTarget(Caster, Enemy, DamageToDeal, true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
                call SetUnitVertexColor(Enemy, 255, 255, 255, 255)
                call DestroyEffect(AddSpecialEffectTarget(ENEMY_DAMAGE, Enemy, ENEMY_DAMAGE_REGION))
            endif
        endif

        set Enemy = null
        set Caster = null
    endfunction
//========================================================================================
    private function Actions takes nothing returns nothing
        //Creates the local variables and gives them a value

        local unit Caster = GetTriggerUnit() //GetTriggerUnit() is the faster and better way
        local group EnemiesInRange = CreateGroup()
        local player CastingPlayer = GetOwningPlayer(Caster)
        local real CasterX = GetUnitX(Caster)
        local real CasterY = GetUnitY(Caster)
        local real Degrees = 0.00
        local real x = GetUnitX(Caster) + 10.0 * Cos(Degrees * bj_DEGTORAD)
        local real y = GetUnitY(Caster) + 10.0 * Sin(Degrees * bj_DEGTORAD)
        local unit array Spikes
        local integer i = 0
        local integer Counter = 0

        call PauseUnit(Caster, true)
        call SetUnitAnimation(Caster, START_ANIMATION)
                                                               
        //this will create the spikes
        loop
            exitwhen (i == 8)
            set Degrees = (45.00 * I2R(i))
            set x = GetUnitX(Caster) + 10.0 * Cos(Degrees * bj_DEGTORAD)
            set y = GetUnitY(Caster) + 10.0 * Sin(Degrees * bj_DEGTORAD)
            set Spikes[Counter] = CreateUnit(CastingPlayer, SPIKED_ONE, x, y, Degrees)
            set Spikes[Counter + 1] = CreateUnit(CastingPlayer, SPIKED_TWO, x, y, Degrees)
            set Spikes[Counter + 2] = CreateUnit(CastingPlayer, SPIKED_THREE, x, y, Degrees)
            set Spikes[Counter + 3] = CreateUnit(CastingPlayer, SPIKED_FOUR, x, y, Degrees)
            set Counter = Counter + 4
            set i = i + 1                                                       
        endloop
                                                        
        call TriggerSleepAction(0.20)

        // -- Pause spikes to show them a few seconds --
        set i = 0
        loop
            exitwhen (i == 36)
  
            call PauseUnit(Spikes[i], true)
            call SetUnitTimeScale(Spikes[i], 0.00 * 0.01)
 
            set i = i + 1
        endloop                                                            
    
        call GroupEnumUnitsInRange(EnemiesInRange, CasterX, CasterY, Radius(GetUnitAbilityLevel(Caster, AID)), null) //this adds all units to EnemiesInRange

        // -- Recolor enemies and pause them --
        call ForGroup(EnemiesInRange, function RecolorEnemies)
        call TriggerSleepAction(1.50)
        call PauseUnit(Caster, false)
        call SetUnitAnimation(Caster, END_ANIMATION)


        // -- Remove Spikes --
        set i = 0
        loop
            exitwhen (i == 36)

            call PauseUnit(Spikes[i], false)
            call UnitApplyTimedLife(Spikes[i], 'BTLF', 1.00)
            call SetUnitTimeScale(Spikes[i], 100.00 * 0.01)

            set Spikes[i] = null
            set i = i + 1
        endloop

        // -- Damage/Kill enemies --
        call ForGroup(EnemiesInRange, function KillEnemies)
        call TriggerSleepAction(1.20)
        call SetUnitAnimation(Caster, "stand")
        call DestroyGroup(EnemiesInRange)

        set Caster = null
        set CastingPlayer = null
        set EnemiesInRange = null

    endfunction
//===========================Creating the trigger=====================================
    private function Init takes nothing returns nothing
        local trigger SpikeImpactTrigger = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(SpikeImpactTrigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddAction(SpikeImpactTrigger, function Actions)
        call TriggerAddCondition(SpikeImpactTrigger, Condition(function Conditions))
    
        set SpikeImpactTrigger = null
      
        call Preload(ENEMY_EFFECT)
        call Preload(ENEMY_DAMAGE)
    endfunction
endscope
09-24-2008, 11:35 AM#5
hillbillyboi
Hey guys ive worked it out now. thank you for your help!
it was most useful :)

+Rep
..if i had any to give lol :s

but thank you very much :)
09-24-2008, 11:36 AM#6
Alexander244
Make sure you have the latest version of JassHelper.