• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Easy way to trigger missiles?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I made a triggered attack with a bow, but the villager just swings the bow, and deals the damage, and no arrow is thrown. I based the ability con Channel, and seems like the 'Missile Art' field doesn't work on that spell, since I placed the arrow there, and doesn't work.
 
Level 8
Joined
Dec 9, 2009
Messages
397
In the trigger you used before, with the ability not being refreshed fast enough, try to remove the ability, and re add the ability.

I assume your trying to find a different method for that.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You were too serious about the 'easy' part xD but it works :p

EDIT:Its a bit messy though. The skill is removed when the missile reaches the target. Avoid casting 'easily' and can't target ground =/
 
Level 8
Joined
Dec 9, 2009
Messages
397
Add a trigger to remove and re add with event begins the effect of an ability.
and take it out of your damage trigger.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well.. not so god. it remains a bit messy.
  • Skill Refresh
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Mindstaff
    • Actions
      • Set ItemSkill = (Ability being cast)
      • Wait 0.01 seconds
      • Unit - Remove ItemSkill from (Triggering unit)
      • Unit - Add ItemSkill to (Triggering unit)
Removing the 'Wait' avoid the spell of being cast.

It's a bit difficult because if the player does a bad math, he/she would be selecting the target, instead of casting on it. Lets say, it's not 'comfortable', at least not as using Channel ability.... but it has a missile... (mm) At this point, i'm not sure about what is better :p
 
Level 8
Joined
Dec 9, 2009
Messages
397
So, you want it to be removed and put back when the missile is somewhere mid air?

So, try this
Unit starts effect of ability
condition
bla bla
Actions
add unit to skillremove unit group
Enable Skill Remove Trigger



Skill Remove Trigger
effect
every .2 game seconds
actions
Pick all units in skillremove unit group
remove picked unit from skillremove
remove skill
add skill
if
number of units in skillremove = 0
then
turn off this trigger
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
The thing is, no matter what I do, removing/adding the ability is always messy :(. Channel is the best of the best, despite of not having a missile effect. I can handle al the magic skills like this, but attack with an arrow without an arrow model.. that's ugly xD

(In my map, attacking with arrows is basicaly casting an skill) and I can't use any morph ability =/ (
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
That's what I was thinking. ¿How to do it?

I mean, I add the unit a Model arrow, add locust to it, set attack range to 1, everything else to 0, and when the Dummy reaches the target, remove the dummy and then order the Hero to cause the damage? I would go straight though, without an arc or parabola =/

Honestly... this thing about missiles is just making me crazy... I'm getting tired of all this. The easiest solution is just creating a Ranged hero and a Melee hero, and create item for both. That was my last option, since I wanted to make the game more realistic =/
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok, I managed to get it working and, honestly, I like it, though I think there must be some 'more efficient' way to do it, since I have to create a dummy for each one of these skills, and 3 triggers.


This one adds the ability to the unit that equips the item.
JASS:
scope Mindstaff initializer Init

    private function onEquip takes nothing returns nothing
        local integer id = GetTriggeringItemId()
        if id == 'I01I' then 
            call UnitAddAbilityBJ( 'Abun', GetEquippingUnit() )
            call UnitAddAbilityBJ( 'A00I', GetEquippingUnit() )
        endif
    endfunction
    
    private function onUnequip takes nothing returns nothing
        local integer id = GetTriggeringItemId()
        if id == 'I01I' then 
            call UnitRemoveAbilityBJ( 'Abun', GetEquippingUnit() )
            call UnitRemoveAbilityBJ( 'A00I', GetEquippingUnit() )
        endif
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterItemEquipEvent(t)
        call TriggerAddAction(t,function onEquip)
        
        set t = CreateTrigger()
        call TriggerRegisterItemUnequipEvent(t)
        call TriggerAddAction(t,function onUnequip)
    endfunction
endscope

This one Creates the dummy.
  • Mindstaff DUMMY
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mindstaff
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Unit - Create 1 DummyMindstaff for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack (Target unit of ability being cast)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Temp_Point)
This is the Damage

  • Mindstaff DAMAGE
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Unit-type of GDD_DamageSource) Equal to DummyMindstaff
    • Actions
      • Trigger - Turn off (This trigger)
      • Set A = Heroes[(Player number of (Owner of GDD_DamageSource))]
      • Set Real[1] = (Real((Strength of A (Include bonuses))))
      • Set Real[2] = (Real((Agility of A (Include bonuses))))
      • Set Real[3] = (Real((Intelligence of A (Include bonuses))))
      • Set Real[4] = (Real[1] + (Real[2] + Real[3]))
      • Unit - Cause A to damage GDD_DamagedUnit, dealing Real[4] damage of attack type Hero and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 5) Less than or equal to (5 + ((Integer(Real[3])) / 3))
        • Then - Actions
          • Unit - Cause A to damage GDD_DamagedUnit, dealing Real[3] damage of attack type Hero and damage type Normal
          • Floating Text - Create floating text that reads (|cffff0000+ + ((String((Integer(Real[3])))) + |r)) above GDD_DamagedUnit with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
        • Else - Actions
      • Trigger - Turn on (This trigger)
 
Status
Not open for further replies.
Top