(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Modding > Requests

Requests Need a resource done for your project? Post your request here, however we cannot guarantee that your request may be answered.

Reply
 
LinkBack Thread Tools Display Modes
Old 11-17-2008, 05:09 PM   #1 (permalink)
 
BlackShogun's Avatar

AKA// theCMNDER
 
Join Date: Jun 2008
Posts: 127

BlackShogun has little to show at this moment (17)BlackShogun has little to show at this moment (17)


Need some vJASS help

Ok this is a spell i am making for the spells and systems contest 16, so i cant take any fixes done by you guys, but im sure it will be ok if someone can just point out why this trigger doesnt work, it has no errors with JASS helper and no matter how many times i look at it i cant find any problems

Bee Swarm
Launches a swarm of angry killer bees that deal damage over time to the enemy. Damage over time increases when the target moves as the bees become more agitated. Damage over time decreases when the target stands still as the bees become less agitated. If damage per second reaches 0 they leave the target. Bees last up to 20 seconds.

Bee Swarm

scope BeeSwarm initializer Init

//=========================Bee Swarm by BlackShogun==========================//
//=================================Setup=====================================//

//spell rawcode
private constant function BeeSwarmRawCode takes nothing returns integer
    return 'A000'
endfunction

//dummy unit rawcode
private constant function BeeSwarmModel takes nothing returns integer
    return 'h000'
endfunction

//dummy unit model
private constant function BeeSwarmSFX takes nothing returns string
    return "Abilities\\Weapons\\CryptFiendMissile\\CryptFiendMissile.mdl"
endfunction

//base damage per second
private function BeeSwarmBaseDPS takes integer lvl returns real
    return 5.0*lvl
endfunction

//increase in damage per second for every second the target is moving
private function BeeSwarmIncDPS takes integer lvl returns real
    return 0.5*lvl
endfunction

//decrease in damage per second for every second the target is moving
private constant function BeeSwarmDecDPS takes nothing returns real
    return 0.5
endfunction

//duration of spell
private constant function BeeSwarmDur takes nothing returns real
    return 20.0
endfunction

//the movement and effects interval
private constant function BeeSwarmInterval takes nothing returns real
    return 0.03
endfunction

//distance moved by projectile each interval
private constant function BeeSwarmDist takes nothing returns real
    return 15.0
endfunction

//===============================EndSetup====================================//
//==================NOTE: DO NOT EDIT ANYTHING BEYOND HERE===================//

struct BeeSwarm_Data
    unit cast
    unit targ
    unit u
    real x
    real y
    real dmg
    real time
    effect sfx
endstruct

globals
    private timer t = CreateTimer()
    private BeeSwarm_Data array ar
    private integer total = 0
endglobals

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == BeeSwarmRawCode()
endfunction

private function Effects takes nothing returns nothing
    local BeeSwarm_Data dat
    local integer i=0
    local real x1
    local real y1
    local real x2
    local real y2
    local real a
    local real mx
    local real my
    local integer lvl

    loop
        exitwhen i>=total
        set dat=ar[i]
        set x1=GetUnitX(dat.u)
        set y1=GetUnitY(dat.u)
        set x2=GetUnitX(dat.targ)
        set y2=GetUnitY(dat.targ)
        set a=Atan2(y2-y1, x2-x1)
        set mx=BeeSwarmDist()*Cos(a)
        set my=BeeSwarmDist()*Sin(a)
        set lvl=GetUnitAbilityLevel(dat.cast, BeeSwarmRawCode())

        if not IsUnitInRange(dat.u, dat.targ, 50) then
            call SetUnitX(dat.u, x1+mx)
            call SetUnitY(dat.u, y1+my)
            call SetUnitFacing(dat.u, 57.29583*a)
        endif

        if IsUnitInRange(dat.u, dat.targ, 50) and (not IsUnitType(dat.targ, UNIT_TYPE_DEAD)) then
            call SetUnitX(dat.u, x2)
            call SetUnitY(dat.u, y2)
            call UnitDamageTarget(dat.cast, dat.targ, (BeeSwarmBaseDPS(lvl)*BeeSwarmInterval())+dat.dmg, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
            if dat.x!=null then
                if IsUnitInRangeXY(dat.targ, dat.x, dat.y, 5) then
                    set dat.dmg=dat.dmg-(BeeSwarmDecDPS()*BeeSwarmInterval())
                else
                    set dat.dmg=dat.dmg+(BeeSwarmIncDPS(lvl)*BeeSwarmInterval())
                endif
            endif
            set dat.x=x2
            set dat.y=y2
        endif

        if (BeeSwarmBaseDPS(lvl)+dat.dmg<=0) or (dat.time>=BeeSwarmDur()) or (IsUnitInRange(dat.u, dat.targ, 50) and IsUnitType(dat.targ, UNIT_TYPE_DEAD)) then
            call DestroyEffect(dat.sfx)
            call RemoveUnit(dat.u)
            set ar[i]=ar[total-1]
            set total=total-1
            call dat.destroy()
        endif

        set dat.time=dat.time+(1*BeeSwarmInterval())
        set i=i+1
    endloop

    if total==0 then
        call PauseTimer(t)
    endif
endfunction

private function Actions takes nothing returns BeeSwarm_Data
    local BeeSwarm_Data dat=BeeSwarm_Data.create()
    local player p

    set dat.cast=GetTriggerUnit()
    set p = GetOwningPlayer(dat.cast)
    set dat.targ=GetSpellTargetUnit()
    set dat.u=CreateUnit(p, BeeSwarmModel(), GetUnitX(dat.cast), GetUnitY(dat.cast), 57.29583*Atan2(GetUnitY(dat.targ)-GetUnitY(dat.cast), GetUnitX(dat.targ)-GetUnitX(dat.cast)))
    set dat.sfx=AddSpecialEffectTarget(BeeSwarmSFX(), dat.u, "chest")
    set dat.dmg=0
    set dat.time=0
    set p=null

    if total==0 then
        call TimerStart(t, BeeSwarmInterval(), true, function Effects)
    endif

    set total=total+1
    set ar[total-1]=dat

    return dat
endfunction

private function Init takes nothing returns nothing
    local trigger T = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(T, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(T, function Actions)
    call TriggerAddCondition(T, Condition(function Conditions))
endfunction

endscope

BlackShogun is offline   Reply With Quote
Old 11-17-2008, 05:30 PM   #2 (permalink)
 
TheBlooddancer's Avatar

Cute Kargo is Cute :3
 
Join Date: Jun 2008
Posts: 2,654

TheBlooddancer is just really nice (415)TheBlooddancer is just really nice (415)TheBlooddancer is just really nice (415)TheBlooddancer is just really nice (415)TheBlooddancer is just really nice (415)


Does it crash it?
Or does it give any errors, or syntax errors?

And ive tried this before, what have you changed?
__________________
Last edited by The Administration; Today at 15:08 PM.. Reason: Do not spam, flame, harass and discriminate other users in a such way.



TheBlooddancer is online now   Reply With Quote
Old 11-17-2008, 05:34 PM   #3 (permalink)
 
BlackShogun's Avatar

AKA// theCMNDER
 
Join Date: Jun 2008
Posts: 127

BlackShogun has little to show at this moment (17)BlackShogun has little to show at this moment (17)


It gives no errors, or syntax errors, it does not crash wc3.
The problem is it creates the dummy unit, and thats it, the dummy just sits there... as far as i can tell the function Effects isnt working properly, sry i shouldve included this information before, and since last i have made it so it sets the values of the locals AFTER refering to the struct (dat=ar[i]), so now it should be able to get the struct data properly. And i thought that was going to fix it but apparently not xD
BlackShogun is offline   Reply With Quote
Old 12-01-2008, 05:32 PM   #4 (permalink)
 
BlackShogun's Avatar

AKA// theCMNDER
 
Join Date: Jun 2008
Posts: 127

BlackShogun has little to show at this moment (17)BlackShogun has little to show at this moment (17)


bump.

although im no longer bothered about this spell, i do need to know what is wrong here etc so i dont make the same mistake again. I still have no idea whats wrong with this even after reading a few more vJASS tutorials, there must be someone who has the know-how that can help :D
BlackShogun is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
vJass Teacher, vJass Demo Map Maker, etc. Dynasti Requests 0 11-10-2008 05:36 PM
[JASS] vJass Alakon Triggers & Scripts 8 09-15-2008 10:23 AM
[JASS] vJass Ciebron Triggers & Scripts 3 04-25-2008 02:52 AM
[JASS] vJASS Ozco Triggers & Scripts 4 01-06-2008 07:03 PM
[JASS] vJass, the new generation UnMi Triggers & Scripts 44 06-05-2007 09:35 AM

All times are GMT. The time now is 08:45 PM.






Your link here 
Mobile Phone | Credit Cards | Loans | Debt Consolidation | Bankruptcy
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle