Ok, i was playing DotA and i noticed one of the heroes had an ability to actually create a stationary unit that was on his back that attacked separately. Now i'm not 100% sure how he did it, but this is what i think he did to get this to work.
He made a looping trigger that simply moved the unit to the alotted position?
Perhaps someone can verify if this is indeed how such a thing was done, or if there's a different way.
I know i'm double posting but this is what i've found to be the JASS script for the ability. Hopefully comeone can decipher it enough for me to understand how it worked.
BTW there seems to be a trigger used to restore the gatling gun so thats also in the scripts too.
//=========================================================================== // Trigger: Gattling Cannon // // New Skill for the tinker, very cool. //=========================================================================== function Trig_Gattling_Cannon_Conditions takes nothing returns boolean if ( not ( GetLearnedSkillBJ() == 'A0E8' ) ) then return false endif if InstanceGetMemberUnit("x","g")!=null then
function GattlingCannon takes nothing returns nothing local unit caster=InstanceGetMemberUnit("x","c") call SetUnitX(InstanceGetMemberUnit("x","g"), GetUnitX(caster)+6*CosBJ(GetUnitFacing(caster)+180)) call SetUnitY(InstanceGetMemberUnit("x","g"),GetUnitY(caster)+6*SinBJ(GetUnitFacing(caster)+180)) set caster=null endfunction
function GattlingControl takes nothing returns nothing local unit g=InstanceGetMemberUnit("x","g") if (GetTriggerEventId()==EVENT_UNIT_DEATH) then call ShowUnitHide( g) call UnitAddTypeBJ( UNIT_TYPE_PEON, g ) call IssueImmediateOrderBJ(g, "stop" ) else call ShowUnitShow( g ) call UnitRemoveAbility(g, 'Aloc') call UnitAddAbility(g,'Aloc') call IssueImmediateOrderBJ(g, "holdposition" ) call UnitRemoveTypeBJ( UNIT_TYPE_PEON, g ) call RemoveGuardPosition( g ) endif set g=null endfunction function GattlingRefresh takes nothing returns nothing
function Trig_Gattling_Cannon_Actions takes nothing returns nothing local timer t=CreateTimer() local unit gun local trigger tr=CreateTrigger() local trigger r=CreateTrigger() set gun=CreateUnit( GetOwningPlayer(GetTriggerUnit()), 'e00G', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0 )
//=========================================================================== function InitTrig_Gattling_Cannon takes nothing returns nothing set gg_trg_Gattling_Cannon = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Gattling_Cannon, EVENT_PLAYER_HERO_SKILL ) call TriggerAddCondition( gg_trg_Gattling_Cannon, Condition( function Trig_Gattling_Cannon_Conditions ) ) call TriggerAddAction( gg_trg_Gattling_Cannon, function Trig_Gattling_Cannon_Actions ) endfunction
that's all of it, maybe someone can tell me if this can be done via triggers, or simply how it was done. Now that i look at the triggering, it seems that a peon type unit was used. Perhaps the gun doesn't actualy attack, but rather simply faces a random target that is setup and attacks that target until the target dies or until it moves out of range. I suppose you could simply make a trigger to spawn a unit at the same spot as the gatling gun and order that you to attack once the random designated unit and continue so until triggers found the unit was out of range. Still, the gun seemed to attack based on priority.
[edit] Perhaps someone might just explain what this triggers is doing (and telling me when they used an unknown ability and such.
well most aren't too complicated, but i'd kind of like to see how they made the meat hook ability although i know of a way to make it, i'm simply cutrious.
Aside from that, i figured that lowering to 0 any factors that might hinder the unit to attack (besides attack cooldown) would allow you to attach the unit and get it to fire freely, however, the shots seemed to be badly timed, but i feel i know how to fix that by triggers. Now all you need is a simple way to monitor if it's attacking a unit or not, and also add priority to units over buildings and such.
Aside from that, none of the spells seem to be very difficult to figure out.
If you want to know how to make any of the other spells, i could probably teel you how to do it.
still i only wanted to test this to see if such was the way the ability was done, although my poor translation of the script hasn't led me to believe so, however, if someone could transfer the script so i could understand, then wed be in business.
So far, i knoew that the object sets the height value of the gun, and uses the flight trick toi do so, as well as periodically summond a peon unit for some reason, perhaps to check for the unit being attacked....dunno however.