wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-19-2007, 12:00 AM   #1
Tiku
User
 
Tiku's Avatar
 
Join Date: Jan 2007
Posts: 172

Submissions (1)

Tiku is on a distinguished road (22)

Default Shooting trigger, need help.. =[

Im trying to make a Trigger that makes a unit shoot a bullet at an area, and if the bullet collides into a unit then the bullet will disapear and deal damage, like on Elimination Tournament, well this is my first attempt, it works creating the bullet and ordering it, but it doesnt collide into people or deal damage...

Heres the code:
Collapse JASS:
function Trig_Shoot_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A000' )
endfunction

function Trig_Shoot_Actions takes nothing returns nothing
    local unit uu     = GetTriggerUnit()
    local player u    = GetOwningPlayer( uu )
    local real spawnx = GetLocationX(PolarProjectionBJ(GetUnitLoc(uu), 20.0, GetUnitFacing(uu)))
    local real spawny = GetLocationY(PolarProjectionBJ(GetUnitLoc(uu), 20.0, GetUnitFacing(uu)))
    local real gotox  = GetLocationX(GetSpellTargetLoc())
    local real gotoy  = GetLocationY(GetSpellTargetLoc())
    local real bulletx
    local real bullety
    local real bulletloc
    local real gotoloc
    local unit targ 
    set udg_bullet = CreateUnit( u, 'h001', spawnx, spawny, GetUnitFacing(uu))
    call IssuePointOrder( udg_bullet, "move", gotox, gotoy ) 
    //=====
    loop 
    exitwhen bulletloc == gotoloc + 1.0
    set udg_collision = GetUnitsInRangeOfLocAll( 20.0, GetUnitLoc(udg_bullet) )
    set targ = GroupPickRandomUnit(udg_collision)
    if bulletloc == gotoloc then
    call RemoveUnit( udg_bullet )
    endif
    if ( CountUnitsInGroup(udg_collision) >= 1 ) then
    call UnitDamageTarget( uu, targ, 500.0, false, true, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
    call RemoveUnit(udg_bullet)
    endif  
    set bulletx = GetUnitX( udg_bullet )
    set bullety = GetUnitY( udg_bullet )
    set bulletloc = (bulletx + bullety)
    endloop
    set uu     = null
    set u    = null
    set targ = null
    set udg_bullet = null
    set udg_collision = null
endfunction

//===========================================================================
function InitTrig_Shoot takes nothing returns nothing
    set gg_trg_Shoot = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Shoot, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Shoot, Condition( function Trig_Shoot_Conditions ) )
    call TriggerAddAction( gg_trg_Shoot, function Trig_Shoot_Actions )
endfunction


If you could help id appreciate it.. =]
__________________
Quote:
Originally Posted by Dark.Revenant
Imagine... You are playing a map in which you have no idea what to do, with no documentation or tips in the map whatsoever. No, not even the 7 others playing the map can figure out what the hell the point is supposed to be. You wonder what sadistic mind trick the map author is trying to impose on you. Suddenly, the only person who remotely understands the map (the mapmaker himself) sends swarms of high-level stuff at your base and heroes, completely crushing you. This sadistic onslaught on your units and, more importantly, your brain, begins to make you question your sanity and makes you quickly put all of the sharp objects in close proximity to you under lock and key. During this one-sided fight, the mapmaker continues to exclaim, "Dis shit is teh dope man!" You leave the game in defeat, wondering why life was so cruel as to waste 8 minutes of your life in such a mind-rottenly disgusting manner...
Tiku is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-19-2007, 12:25 AM   #2
1337D00D
User
 
1337D00D's Avatar
 
Join Date: Dec 2006
Posts: 67

1337D00D has little to show at this moment (2)

Default

You should make it slide forward instead of issuing it an order.

And if you want a premade bullet system, use iNfraNe's particle system. That's the system used in Elimination Tournament.
1337D00D is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:00 PM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services