| 03-09-2004, 07:30 PM | #1 |
How would I make it so bullets that I shoot out using a custom spell will go in a straight direction, and keep on flying until they run into a doodad/destructible/unit ? Please help! >< |
| 03-09-2004, 11:14 PM | #2 |
Make the spell distance extremely large. |
| 03-09-2004, 11:21 PM | #3 |
change the attack arc |
| 03-09-2004, 11:24 PM | #4 |
You could do it with Triggers but I don't know how efficient that is. Code:
Event - Unit Casts A Spell
Condition - Spell equal to (your bullet spell)
Actions -
funciton bullet takes nothing returns nothing
local real offset = 10
local effect bullet
local location point = GetUnitLoc(GetSpellAbilityUnit)
local real angle = GetUnitFacing(GetSpellAbilityUnit)
set udg_foundTarget = false;
loop
loop
set point = PolarProjectionBJ(point, offset, angle)
call DestroyEffect(bullet)
call AddSpecialEffectLoc(bullet model, point)
set bullet = GetLastCreatedEffectBJ()
// check if something is within X of bullet, if so, set foundTarget=true
if( CountUnitsInGroup(GetUnitsInRangeOfLocAll(110, point)) >= 1 ) then
call ForGroupBJ( GetUnitsInRangeOfLocAll(110, point), function damage )
else
call DoNothing( )
endif
exitwhen(1) // I am not sure if that is legal, correct me if I am wrong
endloop
call TriggerSleepAction(0.01)
exitwhen(udg_foundTarget == true)
endloop
call AddSpecialEffectLoc(some explosion or something, point)
call RemoveLocation(point) //does that funciton take a variable?
endfunction
function damage takes nothing returns nothing
local integer damageDealt = 50;
call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) - damageDealt) )
udg_foundTarget = true;
endfunction
// All that other stuff that goes down hereI can't finish it right now cause I have to go somewhere, but I will when I get back Not sure if it all works cause it has been a while since I have done jass EDIT: Okay, I'm back and I finished up the JASS, I think it should work, best of luck. You will need to make "foundTarget" a global variable. |
| 03-09-2004, 11:27 PM | #5 |
Ok using the spell you need to do a dummy spell like immolation or divine shield. you have to set the duration off zero and the cooldown to (whatever time you want to reload) ok now that u have the dummy spell made, goto units tab in unit editor, make a new unit name it bullets. Goto art model and change it to the rifleman projectile. ok now for the triggers heres what u do: Code:
Name the trigger fire bullets Events- a unit begins the effect of a spell Condition- (optional) casting unit equal to (unit that fires bullets) actions- create one bullet at (offset of 10.00 (direction of casting unit) facing (where casting unit is facing) if last created unit is within 9999999.00 of casting unit then do loop actions Loop actions- Instantly move last created unit to offset of (direction of unit facing) (direction of unit facing) New trigger-Bullet hits something events a unit becomes within 10.00 of an unit conditions-none effects-add life -(how ever much damage u want the bullet to do) |
| 03-10-2004, 12:31 AM | #6 | ||
Quote:
Nononono! >< That wont work! My main problem is making it stop at an obstacle! Quote:
Same problem... :\ To the others of you thanks, I will work out this problem using this info....HOPEFULLY I will be able to... to Mr. Enthusiasm--I don't know JASS too well, so wish me luck! ._. Oops! Forgot this: to Demonos.....whatever! Sorry, lol. But is there a way to make it stop when it runs into a destructible/doodad/high terrain thats in the way? Terrain is optional...I don't REALLY need that. |
