• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Bouncing Shot v2.2

A spell, I was bored and my friend had an request. Wanted to share with you also. Throws a projectile (that is a dummy), and bounces off the cliffs and terrain difficulties, also destroys trees. You can change every statistic and modifier in the first trigger. Have fun.

-----------

Fixed the triggers, spell is now MUI and leakless.

-----------

Fixed some bugs, added sounds and effects. Thanks for the code zv27.

-----------

Fixed some more bugs and leaks, changed the damage.

-----------

Stored/loaded caster

Keywords:
Hadeis, bounce, bouncing, shot, throw, gui, trigger
Contents

Bouncing Shot v2.2 (Map)

Reviews
Bouncing Shot v2.2 | Reviewed by Maker | 24th May 2013 APPROVED The spell is leakless and MUI You could precalculate the damage and speed values to avoid repeated calculation You could use SetUnitX and SetUnitY...

Moderator

M

Moderator


Bouncing Shot v2.2 | Reviewed by Maker | 24th May 2013
APPROVED


126248-albums6177-picture66521.png


  • The spell is leakless and MUI
126248-albums6177-picture66523.png


  • You could precalculate the damage and speed values to avoid
    repeated calculation
  • You could use SetUnitX and SetUnitY instead of moving
    unit instantly. The X/Y functions do not check pathing
    and are much faster
[tr]




Bouncing Shot v2.2 | Re-evaluated by Magtheridon96 | 15th May 2013
NEEDS FIX


126248-albums6177-picture66522.png


  • Nothing serious anymore.
126248-albums6177-picture66523.png


  • You could use 0.03 period for smoother movement
  • Make the special effect paths and the sounds configurable from the Init trigger
  • Don't use magic numbers like 60.00%, 25.00 or 0.04, make everything configurable from the Init trigger
  • BS_Loops should be an Integer. Using a Real here would be unsafe and frankly, it's redundant
[tr]


Bouncing Shot v2.1 | Reviewed by Maker | 2nd May 2013
NEEDS FIX


126248-albums6177-picture66522.png


  • There is a point leak when you create the dummy
  • Make the caster deal the damage
  • You have RemoveLocation call in Shot Init, but the location is not set
  • BS_UnitDmg was 1 and 1 for me for two consecutive casts, where it
    should have been 1 and 2, so it does not work properly
  • You have unt groups created only for indexes 0 and 1 so "Is unit in
    damage group" will not work for other indexes
  • Remove the floating text
126248-albums6177-picture66523.png


  • Take visibility actions out of the system's trigger
  • Add importing instructions
  • You have repeated actions in the looping trigger, like Set point = ...
    and Move unit instantly. Do this
    • Untitled Trigger 001
      • Events
      • Conditions
      • Actions
        • Set BS_Loc1 = (Position of BS_Dummy)
        • Hashtable - Save (BS_Timer - 0.04) as (Key timer) of (Key (Picked unit)) in BounceTable
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BS_BounceTrig Equal to 0.00
          • Then - Actions
            • Set BS_Loc2 = (BS_Loc1 offset by BS_Speed towards BS_Angle degrees)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((BS_Angle Greater than or equal to 45.00) and (BS_Angle Less than 135.00)) or...
              • Then - Actions
                • Set BS_Loc2 = (BS_Loc1 offset by BS_Speed towards (BS_Angle x -1.00) degrees)
              • Else - Actions
                • Set BS_Loc2 = (BS_Loc1 offset by BS_Speed towards ((180.00 + BS_Angle) x -1.00) degrees)
        • Unit - Move BS_Dummy instantly to BS_Loc2
  • Destroy only trees
[tr]


Bouncing Shot v1 | Reviewed by Maker | 28th Apr 2013
NEEDS FIX


[tr]
 
Level 10
Joined
Aug 21, 2010
Messages
316
[poor solution]

  • Set BS_Caster = (Triggering unit)
  • Set BS_CasterLoc = (Position of BS_Caster)
  • Set BS_Target = (Target point of ability being cast)
  • Set BS_Angle = (Angle from BS_CasterLoc to BS_Target)
  • Unit - Create 1 Dummy for (Triggering player) at BS_CasterLoc facing (Facing of BS_Caster) degrees
  • Custom script: call RemoveLocation(udg_BS_CasterLoc)
-->
[better solution]
[This is very useful if you have multiple locations]
[All solver with only one real array variable ™ as you can see

  • Set BS_Caster = (Triggering unit)
  • Custom script: set udg_BS_X[0] = GetUnitX(udg_BS_Caster)
  • Custom script: set udg_BS_Y[0] = GetUnitY(udg_BS_Caster)
  • Custom script: set udg_BS_X[1] = GetSpellTargetX()
  • Custom script: set udg_BS_Y[1] = GetSpellTargetY()
  • Set BS_Angle = (Atan2((BS_Y[0] - BS_Y[1]), (BS_X[0] - BS_X[1])))
  • Unit - Create 1 Dummy for (Triggering player) at (Point(BS_X[0], BS_Y[0])) facing BS_Angle degrees
  • -------- or --------
  • Custom script: set udg_BS_Dummy = CreateUnit( GetTriggerPlayer(), 'h000', udg_BS_X[0], udg_BS_Y[0], udg_BS_Angle )
[means you do not need two stupid location]
[Also, the same goes for the other trigger] (replace the stupid location)
[Oh yes spell must be MUI]

I'll post them, if it gets approved. Don't want to spam with wrong triggers in the worst case.

How do you expect someone to help you if you do not see the trigger
So, always post the trigger!


If you want to have more units around the hero
  • Example 1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set BounceTable = (Last created hashtable)
      • -------- --- --------
      • Set BS_AbilCode = Bouncing Shot
      • -------- --- --------
      • Set BS_UnitTypeId = Dummy
      • -------- --- --------
      • Set BS_EffectCount[1] = 3
      • Set BS_EffectCount[2] = 6
      • Set BS_EffectCount[3] = 9
      • Set BS_EffectCount[4] = 12
      • -------- --- --------
      • Set BS_Distance[1] = 100.00
      • Set BS_Distance[2] = 200.00
      • Set BS_Distance[3] = 300.00
      • Set BS_Distance[4] = 400.00
      • -------- --- --------
      • Custom script: call ExecuteFunc( "InitExample1" )
      • Custom script: endfunction
      • -------- --- --------
      • Custom script: function Example1Actions takes nothing returns boolean
      • -------- --- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to BS_AbilCode
        • Then - Actions
          • Set BS_Caster = (Triggering unit)
          • Set BS_AbilLevel = (Level of BS_AbilCode for BS_Caster)
          • Custom script: set udg_BS_X[0] = GetUnitX(udg_BS_Caster)
          • Custom script: set udg_BS_Y[0] = GetUnitY(udg_BS_Caster)
          • -------- --- --------
          • For each (Integer BS_IndexA) from 1 to BS_EffectCount[BS_AbilLevel], do (Actions)
            • Loop - Actions
              • Set BS_X[BS_IndexA] = (BS_X[0] + (BS_Distance[BS_AbilLevel] x (Cos(((360.00 / (Real(BS_EffectCount[BS_AbilLevel]))) x (Real(BS_IndexA)))))))
              • Set BS_Y[BS_IndexA] = (BS_Y[0] + (BS_Distance[BS_AbilLevel] x (Sin(((360.00 / (Real(BS_EffectCount[BS_AbilLevel]))) x (Real(BS_IndexA)))))))
              • Set DS_Angle = (Atan2((BS_Y[0] - BS_Y[BS_IndexA]), (BS_X[0] - BS_X[BS_IndexA])))
              • Unit - Create 1 BS_UnitTypeId for (Triggering player) at (Point(BS_X[BS_IndexA], BS_Y[BS_IndexA])) facing DS_Angle degrees
        • Else - Actions
      • -------- --- --------
      • Custom script: return false
      • -------- --- --------
      • Custom script: endfunction
      • -------- --- --------
      • Custom script: function InitExample1 takes nothing returns nothing
      • Custom script: local trigger t = CreateTrigger()
      • Custom script: call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
      • Custom script: call TriggerAddCondition( t, Condition( function Example1Actions ) )
      • Custom script: set t = null
If you want to have more units around the target point
  • Example 2
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set BounceTable = (Last created hashtable)
      • -------- --- --------
      • Set BS_AbilCode = Bouncing Shot
      • -------- --- --------
      • Set BS_UnitTypeId = Dummy
      • -------- --- --------
      • Set BS_EffectCount[1] = 3
      • Set BS_EffectCount[2] = 6
      • Set BS_EffectCount[3] = 9
      • Set BS_EffectCount[4] = 12
      • -------- --- --------
      • Set BS_Distance[1] = 100.00
      • Set BS_Distance[2] = 200.00
      • Set BS_Distance[3] = 300.00
      • Set BS_Distance[4] = 400.00
      • -------- --- --------
      • Custom script: call ExecuteFunc( "InitExample2" )
      • Custom script: endfunction
      • -------- --- --------
      • Custom script: function Example2Actions takes nothing returns boolean
      • -------- --- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to BS_AbilCode
        • Then - Actions
          • Set BS_Caster = (Triggering unit)
          • Set BS_AbilLevel = (Level of BS_AbilCode for BS_Caster)
          • Custom script: set udg_BS_X[0] = GetSpellTargetX()
          • Custom script: set udg_BS_Y[0] = GetSpellTargetY()
          • -------- --- --------
          • For each (Integer BS_IndexA) from 1 to BS_EffectCount[BS_AbilLevel], do (Actions)
            • Loop - Actions
              • Set BS_X[BS_IndexA] = (BS_X[0] + (BS_Distance[BS_AbilLevel] x (Cos(((360.00 / (Real(BS_EffectCount[BS_AbilLevel]))) x (Real(BS_IndexA)))))))
              • Set BS_Y[BS_IndexA] = (BS_Y[0] + (BS_Distance[BS_AbilLevel] x (Sin(((360.00 / (Real(BS_EffectCount[BS_AbilLevel]))) x (Real(BS_IndexA)))))))
              • Set DS_Angle = (Atan2((BS_Y[0] - BS_Y[BS_IndexA]), (BS_X[0] - BS_X[BS_IndexA])))
              • Unit - Create 1 BS_UnitTypeId for (Triggering player) at (Point(BS_X[BS_IndexA], BS_Y[BS_IndexA])) facing DS_Angle degrees
        • Else - Actions
      • -------- --- --------
      • Custom script: return false
      • -------- --- --------
      • Custom script: endfunction
      • -------- --- --------
      • Custom script: function InitExample2 takes nothing returns nothing
      • Custom script: local trigger t = CreateTrigger()
      • Custom script: call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
      • Custom script: call TriggerAddCondition( t, Condition( function Example2Actions ) )
      • Custom script: set t = null
And we can do this all day hah...blahh
I gave you some examples
And you just plug the imagination and that's it

I forgot to say.
You do not have to use this method
Simply use the normal method
  • Example 1 Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bouncing Shot
    • Actions
      • -------- bla,bla --------
  • Example 1 Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- bla,bla --------
In this case, this is going to map init

  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set BounceTable = (Last created hashtable)
      • -------- --- --------
      • Set BS_AbilCode = Bouncing Shot
      • -------- --- --------
      • Set BS_UnitTypeId = Peasant
      • -------- --- --------
      • Set BS_EffectCount[1] = 3
      • Set BS_EffectCount[2] = 6
      • Set BS_EffectCount[3] = 9
      • Set BS_EffectCount[4] = 12
      • -------- --- --------
      • Set BS_Distance[1] = 100.00
      • Set BS_Distance[2] = 200.00
      • Set BS_Distance[3] = 300.00
      • Set BS_Distance[4] = 400.00
      • -------- --- --------
And now I have to go because I'm on some stupid picnic
The battery of the laptop is at the very end
Shit, 300 kilometers away from home...
Just to even up a serial killer and that's it ... hahahahahahah ... omg...who the fuck is this !!!
 
Last edited:
Top