Spellpack GUI: Spear Throw & Ball

Trollvottel

never aging title
SPELLPACK

Well, i just wanted to do something in GUI, so i made these 2 spells.

Fully MUI
Fully GUI (except leak removal)
Easy to import
Leakless (of course)

Spear Throw

Found no better description than this:
Throw 3 spears in the target direction. If a spear hits units, they will be damaged and the spear will disappear.

Screenshot:

Code(i had to translate it):

Code:
SpearCast
    Events
        Unit - A Unit Starts the effect of an Ability
    Conditions
        (Ability being cast) equal to Spearthrow 
    Actions
        -------- CONFIGURATION --------
        -------- Maximum Distance --------
        Set Spear_MaxD = (600.00 + (100.00 x (Real((Level of Spearthrow  for (Triggering unit))))))
        -------- Speed with each intervall --------
        Set Spear_Speed = 25.00
        -------- Damage delt to hit units --------
        Set Spear_DMG = (20.00 + (80.00 x (Real((Level of Spearthrow  for (Triggering unit))))))
        -------- Range to collide with units --------
        Set Spear_PickRange = 90.00
        -------- Insert Unit-type here --------
        Set Spear_Rawcode = Spear
        -------- ------------- --------
        -------- SPELL BEGINS --------
        -------- ------------- --------
        Set Spear_Temp_Loc[1] = (Position of (Triggering unit))
        Set Spear_Temp_Loc[2] = (Target point of ability being cast)
        Set Spear_Temp_Angle = (Angle from Spear_Temp_Loc[1] to Spear_Temp_Loc[2])
        Set Spear_Temp_Loc[3] = (Spear_Temp_Loc[2] offset by 120.00 towards (Spear_Temp_Angle + 90.00) degrees)
        Set Spear_Temp_Loc[4] = (Spear_Temp_Loc[2] offset by 120.00 towards (Spear_Temp_Angle - 90.00) degrees)
        -------- -------------------- --------
        Set Spear_Int = (Spear_Int + 1)
        Set Spear_Caster[Spear_Int] = (Triggering unit)
        Set Spear_Direction[Spear_Int] = (Angle from Spear_Temp_Loc[1] to Spear_Temp_Loc[2])
        Set Spear_Curdis[Spear_Int] = 0.00
        Set Spear_Damage[Spear_Int] = Spear_DMG
        Set Spear_MaxDis[Spear_Int] = Spear_MaxD
        Unit - Create 1 Spear_Rawcode for (Owner of (Triggering unit)) at Spear_Temp_Loc[1] facing Spear_Direction[Spear_Int] degrees
        Set Spear_Flying[Spear_Int] = (Last created unit)
        -------- -------------------- --------
        Set Spear_Int = (Spear_Int + 1)
        Set Spear_Caster[Spear_Int] = (Triggering unit)
        Set Spear_Direction[Spear_Int] = (Angle from Spear_Temp_Loc[1] to Spear_Temp_Loc[3])
        Set Spear_Curdis[Spear_Int] = 0.00
        Set Spear_Damage[Spear_Int] = Spear_DMG
        Set Spear_MaxDis[Spear_Int] = Spear_MaxD
        Unit - Create 1 Spear_Rawcode for (Owner of (Triggering unit)) at Spear_Temp_Loc[1] facing Spear_Direction[Spear_Int] degrees
        Set Spear_Flying[Spear_Int] = (Last created unit)
        -------- -------------------- --------
        Set Spear_Int = (Spear_Int + 1)
        Set Spear_Caster[Spear_Int] = (Triggering unit)
        Set Spear_Direction[Spear_Int] = (Angle from Spear_Temp_Loc[1] to Spear_Temp_Loc[4])
        Set Spear_Curdis[Spear_Int] = 0.00
        Set Spear_Damage[Spear_Int] = Spear_DMG
        Set Spear_MaxDis[Spear_Int] = Spear_MaxD
        Unit - Create 1 Spear_Rawcode for (Owner of (Triggering unit)) at Spear_Temp_Loc[1] facing Spear_Direction[Spear_Int] degrees
        Set Spear_Flying[Spear_Int] = (Last created unit)
        -------- -------------------- --------
        Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[1])
        Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[2])
        Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[3])
        Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[4])

SpearFly
    Events
        Time - Every 0.04 seconds of game time
    Conditions
        Spear_Int greater than 0
    Actions
        For each (Integer A) from 1 to Spear_Int, do (Actions)
            Loop - Actions
                Set Spear_Temp_Loc[1] = (Position of Spear_Flying[(Integer A)])
                Set Spear_Temp_Loc[2] = (Spear_Temp_Loc[1] offset by Spear_Speed towards Spear_Direction[(Integer A)] degrees)
                Unit - Move Spear_Flying[(Integer A)] instantly to Spear_Temp_Loc[2]
                Set Spear_Curdis[(Integer A)] = (Spear_Curdis[(Integer A)] + Spear_Speed)
                Set Spear_Temp_Group = (Units within Spear_PickRange of Spear_Temp_Loc[2] matching ((((Matching unit) is alive) Gleich True) and (((Matching unit) belongs to an enemy of (Owner of Spear_Flying[(Integer A)])) Gleich True)))
                Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[1])
                Custom script:   call RemoveLocation(udg_Spear_Temp_Loc[2])
                UnitenGroup - Pick every unit in Spear_Temp_Group and do (Actions)
                    Loop - Actions
                        Set Spear_Release = True
                        Unit - Cause Spear_Caster[(Integer A)] to damage (Picked unit), dealing Spear_Damage[(Integer A)] damage of attack Spells and damage type Normal
                Custom script:   call DestroyGroup(udg_Spear_Temp_Group)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Condtitions
                        (Spear_Release equal to True) or (Spear_Curdis[(Integer A)] greater than or equal to Spear_MaxDis[(Integer A)])
                    'THEN'-Actions
                        Unit - Kill Spear_Flying[(Integer A)]
                        Set Spear_Damage[(Integer A)] = Spear_Damage[Spear_Int]
                        Set Spear_Curdis[(Integer A)] = Spear_Curdis[Spear_Int]
                        Set Spear_Direction[(Integer A)] = Spear_Direction[Spear_Int]
                        Set Spear_Flying[(Integer A)] = Spear_Flying[Spear_Int]
                        Set Spear_Caster[(Integer A)] = Spear_Caster[Spear_Int]
                        Set Spear_MaxDis[(Integer A)] = Spear_MaxDis[Spear_Int]
                        Set Spear_Int = (Spear_Int - 1)
                    'ELSE'-Actions
                Set Spear_Release = False

Ball (well, its more a rock than a ball)

Launches a ball towards the target location. If a unit comes into its way the ball will explode and the unit will be knockbacked and take damage.

Screenshot:

Code (another translation):

Code:
BallCast
    Events
        Unit - A unit starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ball 
    Actions
        -------- CONFIGURATION --------
        -------- Unit Rawcode --------
        Set Ball_UnitType = Bullet
        -------- Damage Calculation --------
        Set Ball_damage = (50.00 + (50.00 x (Real((Level of Ball  for (Triggering unit))))))
        -------- Slide Distance --------
        Set Ball_maxdist = 200.00
        -------- Fly Speed --------
        Set Ball_flyspeed = 25.00
        -------- Slide Speed --------
        Set Ball_slidespeed = 10.00
        -------- Slide SFX --------
        Set Ball_SFX = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
        -------- Collision Range --------
        Set Ball_PickRange = 140.00
        -------- ------------- --------
        -------- SPELL BEGINS --------
        -------- ------------- --------
        Set Ball_temp_loc[1] = (Position of (Triggering unit))
        Set Ball_temp_loc[2] = (Target point of ability being cast)
        Set Ball_Int_1 = (Ball_Int_1 + 1)
        Set Ball_damagetodo[Ball_Int_1] = Ball_damage
        Set Ball_maxflydis[Ball_Int_1] = (Distance between Ball_temp_loc[1] and Ball_temp_loc[2])
        Set Ball_caster[Ball_Int_1] = (Triggering unit)
        Set Ball_curflydis[Ball_Int_1] = 0.00
        Unit - Create 1 Ball_UnitType for (Owner of (Triggering unit)) at Ball_temp_loc[1] facing Vorgabe für Gebäude-Ausrichtung degrees
        Set Ball_Bullet[Ball_Int_1] = (Last created unit)
        Set Ball_angle[Ball_Int_1] = (Angle from Ball_temp_loc[1] to Ball_temp_loc[2])
        Custom script:   call RemoveLocation(udg_Ball_temp_loc[1])
        Custom script:   call RemoveLocation(udg_Ball_temp_loc[2])

Code:
BallFlight
    Events
        Time - Every 0.04 seconds of game time
    Conditions
        Ball_Int_1 greater than 0
    Actions
        For each (Integer A) from 1 to Ball_Int_1, do (Actions)
            Loop - Actions
                Set Ball_temp_loc[1] = (Position of Ball_Bullet[(Integer A)])
                Set Ball_temp_loc[2] = (Ball_temp_loc[1] offset by Ball_flyspeed towards Ball_angle[(Integer A)] degrees)
                Custom script:   call RemoveLocation(udg_Ball_temp_loc[1])
                Unit - Move Ball_Bullet[(Integer A)] instantly to Ball_temp_loc[2]
                Set Ball_unit_group = (Units within Ball_PickRange of Ball_temp_loc[2] matching ((((Matching unit) is alive) Gleich True) and ((Ball_Bullet[(Integer A)] belongs to an enemy of (Owner of (Matching unit))) Gleich True)))
                Unitgroup - Pick every unit in Ball_unit_group and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            'IF'-Conditions
                                Ball_sliding[(Custom value of (Picked unit))] equal to False
                            'THEN'-Actions
                                Set Ball_Release = True
                                Unit - Cause Ball_caster[(Integer A)] to damage (Picked unit), dealing Ball_damagetodo[(Integer A)] damage of attack type Zaubersprüche and damage type Normal
                                Set Ball_Int_2 = (Ball_Int_2 + 1)
                                Set Ball_sliding[(Custom value of (Picked unit))] = True
                                Set Ball_toSlide[Ball_Int_2] = (Picked unit)
                                Set Ball_temp_loc[3] = (Position of (Picked unit))
                                Set Ball_slideangle[Ball_Int_2] = (Angle from Ball_temp_loc[2] to Ball_temp_loc[3])
                                Set Ball_curslidedis[Ball_Int_2] = 0.00
                                Unit - Turn collision for (Picked unit) Aus
                                Custom script:   call RemoveLocation(udg_Ball_temp_loc[3])
                            'ELSE'-Actions
                Custom script:   call DestroyGroup(udg_Ball_unit_group)
                Set Ball_curflydis[(Integer A)] = (Ball_curflydis[(Integer A)] + Ball_flyspeed)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                Ball_curflydis[(Integer A)] Greater than or equal to Ball_maxflydis[(Integer A)]
                                Ball_Release equal to True
                    'THEN'-Actions
                        Unit - Kill Ball_Bullet[(Integer A)]
                        Set Ball_Bullet[(Integer A)] = Ball_Bullet[Ball_Int_1]
                        Set Ball_angle[(Integer A)] = Ball_angle[Ball_Int_1]
                        Set Ball_maxflydis[(Integer A)] = Ball_maxflydis[Ball_Int_1]
                        Set Ball_curflydis[(Integer A)] = Ball_curflydis[Ball_Int_1]
                        Set Ball_caster[(Integer A)] = Ball_caster[Ball_Int_1]
                        Set Ball_Int_1 = (Ball_Int_1 - 1)
                    'ELSE'-Actions
                Set Ball_Release = False
                Custom script:   call RemoveLocation(udg_Ball_temp_loc[2])

Code:
BallSlide
    Events
        Time - Every 0.04 seconds of game time
    Conditions
        Ball_Int_2 greater than 0
    Actions
        Set Ball_EYECANDYINT = (Ball_EYECANDYINT + 1)
        For each (Integer A) from 1 to Ball_Int_2, do (Actions)
            Loop - Actions
                Set Ball_temp_loc[1] = (Position of Ball_toSlide[(Integer A)])
                Set Ball_temp_loc[2] = (Ball_temp_loc[1] offset by Ball_slidespeed towards Ball_slideangle[(Integer A)] degrees)
                Custom script:   call RemoveLocation(udg_Ball_temp_loc[1])
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Conditions
                        (Ball_EYECANDYINT mod 8) equal to 0
                    'THEN'-Actions
                        Spezialeffekt - Create a special effect at Ball_temp_loc[2] using Ball_SFX
                        Spezialeffekt - Destroy (Last created special effect)
                    'ELSE'-Actions
                Unit - Move Ball_toSlide[(Integer A)] instantly to Ball_temp_loc[2]
                Custom script:   call RemoveLocation(udg_Ball_temp_loc[2])
                Set Ball_curslidedis[(Integer A)] = (Ball_curslidedis[(Integer A)] + Ball_slidespeed)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    'IF'-Conditions
                        Ball_curslidedis[(Integer A)] greater than or equal to Ball_maxdist
                    'THEN'-Actions
                        Unit - Turn collision for Ball_toSlide[(Integer A)] Ein
                        Set Ball_sliding[(Custom value of Ball_toSlide[(Integer A)])] = False
                        Set Ball_toSlide[(Integer A)] = Ball_toSlide[Ball_Int_2]
                        Set Ball_slideangle[(Integer A)] = Ball_slideangle[Ball_Int_2]
                        Set Ball_curslidedis[(Integer A)] = Ball_curslidedis[Ball_Int_2]
                        Set Ball_Int_2 = (Ball_Int_2 - 1)
                    'ELSE'-Actions


Import Instructions Inside, download here:
 

Attachments

Daskunk

SC2 Forum MVP - TheSkunk #386
First thing I noticed from screenshot.. Change Art - Shadow Image (Unit) to flyer instead of normal for Spear Throw, it looks better that way. Other than that, I'll test it and see.
 

Trollvottel

never aging title
thx for the reply, i will change it :)

/edit: changed shadow image and also the model, now its a real spear
 
Lol, I was about to say that :D Could have used dryad projectile for spear.

Either way, nice spells. Pretty user friendly for people who don't know Jass too XD
 

quraji

zap
Some of the code is still in German, could be confusing ;)

Namely in the If statements...Gleich...or "is", "equals".


I didn't try the spells but they look nice :)
 

Romek

Super Moderator
Staff member
The spears don't explode. According to the description, they should.
 

Trollvottel

never aging title
right, it did before when i used the ballista model :p. thx for the replies

/edit: made code more english
 

Furberg

Ultra Cool Member
that cute dancing avatar deserves a comment. Well unfortunately i got no WC3 or WE around me in the next few days, so i can't test it sorry ^^ but i really like the spear spell. Btw does the ball bounce?

EDIT: oh it don't ._. You should make it bounce :p
 

Andrewgosu

The Silent Pandaren Helper
Staff member
Very nice spellpack!

Well done for a GUI submission, especially because of the MUI factor.


I tested the map and the spells were working correctly, but on one occasion, the spear got stuck and left floating in the air.



Anyway, resource approved.
 
D

dxthegreat

Guest
Just wondering... you made the arrays size 1, but u seem to access parts of the array more than that are indexed greater than 0...

(e.g)
Code:
Set Ball_curslidedis[(Integer A)] = (Ball_curslidedis[(Integer A)] + Ball_slidespeed)
From my c programming, that's syntactically valid... but a huge faux pas

I was wondering if there would be any potential problems with doing that...
 

Trollvottel

never aging title
array size in Jass is always 8192. in GUI "size" is just the value to which the array is initialized. but because it set it to 0 at spell start, i dont have to initialize it at map init.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!
    +1
  • Blackveiled Blackveiled:
    :( feels bad I can't ever get selected for any beta I sign up for. It's annoying as heck.
    +1
  • The Helper The Helper:
    Hello mgarcia! Happy Monday everyone!
  • The Helper The Helper:
    Happy Tuesday! :)

    The Helper Discord

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top