• 🏆 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!

Warp Jump 1.3

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: xDeathKnightx
Warp Jump

Teleports the Warper a long distance, allowing him to move rapidly about the map. Whilst warping the Warper is vulnerable to attacks. Warp time depends on distance travelled. Deals damage on arrival in an area based on distance travelled.

Level 1 : Normal Warp Time, tiny damage and small AOE
Level 2 : 50% reduced Warp Time, small damage and moderate AOE
Level 3 : 66% reduced Warp Time, moderate damage and large AOE

However this ability will automatically scale to any number of levels, just with decreasing reduction time so level 4 is 75%, level 5 is 80%, level 6 is 83%, level 7 is 85% and it approaches 99%

AOE is just 100*level
Damage is just 25*level*distance

I got this idea from the Chronolegionaire from RA2 XD
How they can teleport anywhere but then have to phase in, and then I thought about the "left behind" thing... brilliant.

Give Credits if used...

#Known bugs#
Proper name will not be the same
Proper names will increase per use...

Works perfectly for a non-hero unit

JASS:
// Warp Jump
// 
// By Ross Dubery
// 
// Teleports the Warper a long distance, allowing him to move rapidly about the map. 
// Whilst warping the Warper is vulnerable to attacks. 
// Warp time depends on distance travelled. 
// Deals damage on arrival in an area based on distance travelled.
//
// There are two things that require changing
// 1 - The ability code, highlighted below (A001)
// 2 - The ability code variable (A001)

//
// Checks for ability, change 'A001' to your spell ID
//
function warp_jump_conditions takes nothing returns boolean
    return  ( GetSpellAbilityId() == 'A001' )
endfunction

//
// Main Ability
//
function warp_jump_actions takes nothing returns nothing

//
//Initialise
//
    //Local Variables
    local unit LastUnit
    local unit NewUnit
    local real Distance
    local real Scale
    local real Area
    local real Damage
    local real Phase
    local real SleepLen
    local real Index
    local real IndexInc
    local real TransTicks
    local boolean FixedDamage
    local boolean FixedArea
    local boolean FixedPhase
    local boolean Transparency
    local integer Ability
    local integer LastTrans
    local integer NewTrans
    local integer MinTrans
    local integer TickAmount
    local integer NumTicks
    local effect StompEffect
    local effect LastEffect
    local effect NewEffect
    local location TargetPos
    local location UnitPos 
    
    //Define the scale of distance
    set Scale = 800.0 // Recomended scale
    
    //Choose whether damage, phase time and area are fixed or not
    set FixedDamage = false // Scale damage
    set FixedArea = false // Scale area
    set FixedPhase = false // Scale phase
    
    //Choose if you want the unit to fade in and out or not
    set Transparency = true // Scale transparency
    
    //If you said true for any of the above, modify these values
    set Damage = 100.00 // The damage dealt on arrival || If damage is negative it will heal units
    set Area = 200.00 // The area the damage is dealt in
    set Phase = 1.00 // Phase is not decreased at all
    set MinTrans = 55 // The most transparent a unit can go
    // If phase is > 1.00 it will decrease phase time
    // If phase is < 1.00 it will increase phase time
    // The lowest phase can go is 0.01
    // 0 < MinTrans < 255 
    
    //Define the ability code, replace 'A001' with your abiltiy code
    set Ability = 'A001' // Ability code
    
    //Leave these alone
    set LastUnit = GetSpellAbilityUnit()
    set UnitPos = GetUnitLoc(LastUnit)
    set TargetPos = GetSpellTargetLoc()
    set Distance = (DistanceBetweenPoints(TargetPos, UnitPos)/Scale)
    set IndexInc = 0.05
    
    //If damage, phase time and area are not fixed use the following formulae
    if ( not FixedDamage) then
        set Damage = ( 10 * Distance * I2R(GetUnitAbilityLevel(LastUnit,Ability)) )
    endif
    if (not FixedArea) then
        set Area = ( I2R(GetUnitAbilityLevel(LastUnit,Ability)) * 100.00 )
    endif
    if (not FixedPhase) then
        set Phase = GetUnitAbilityLevel(LastUnit,Ability)
    endif
    
    //Ensure phase and area are greater then 0
    // and TransTicks is greater then 6 and less then 120
    if (Phase < 0.01) then
        set Phase = 0.01
    endif
    if (Area < 0.01) then
        set Area = 0.01
    endif
        if (MinTrans < 0) then
        set MinTrans = 0
    else
        if (MinTrans > 255) then
            set MinTrans = 255
        endif
    endif    
    
    //Calculate Sleep Length and Tick Amount
    if (Transparency) then
        set SleepLen = 0.27
        set TransTicks = SleepLen*(Distance/Phase)
        
        //Calculate Sleep Length and Tick Amount  
        set TickAmount = (R2I((255-MinTrans)/(TransTicks/IndexInc)))   
    else
        set SleepLen = (Distance/Phase)
        if(SleepLen < 0.27) then
            set SleepLen = 0.27
        endif
    endif
      
    //Preload resources
    call Preload("Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl")
    call Preload("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl")
    

//
// Body of Ability
//

    // Damage the target location with magical damage
    call UnitDamagePoint( LastUnit, 0, Area,  GetLocationX(TargetPos),  GetLocationY(TargetPos), Damage, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
    set StompEffect = AddSpecialEffectLoc( "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", TargetPos )
    call DestroyEffect( StompEffect )
    
    // Move casting unit to the target location
    call SetUnitPosition( LastUnit, GetLocationX(TargetPos), GetLocationY(TargetPos))
    
    // Remove positive and negative magical buffs and aura buffs
    call UnitRemoveBuffsEx(LastUnit, true, true, true, false, false, true, true)
    
    // Create "partial" unit from casting unit stats
    set NewUnit = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitTypeId(LastUnit), GetLocationX(UnitPos), GetLocationY(UnitPos), GetUnitFacing(LastUnit) )
        
    // Check if casting unit is a hero || Will not copy items
    if (IsHeroUnitId(GetUnitTypeId(LastUnit))) then    
        call SetHeroLevel(NewUnit, GetHeroLevel(LastUnit), false)
        call ModifyHeroSkillPoints(NewUnit, bj_MODIFYMETHOD_SET, GetHeroSkillPoints(LastUnit))        
    endif
    call SetUnitColor( NewUnit, GetPlayerColor(GetOwningPlayer(LastUnit)) ) 
    call SetUnitUseFood(NewUnit, false) 
    
    // Set Life and Mana 
    call SetUnitState(NewUnit, UNIT_STATE_MANA, GetUnitState(NewUnit, UNIT_STATE_MAX_MANA) * RMaxBJ(0,GetUnitStatePercent(LastUnit, UNIT_STATE_MANA, UNIT_STATE_MAX_MANA)) * 0.01)   
    call SetUnitState(NewUnit, UNIT_STATE_LIFE, GetUnitState(NewUnit, UNIT_STATE_MAX_LIFE) * RMaxBJ(0,GetUnitStatePercent(LastUnit, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE)) * 0.01)
    
    // Add the warp effects
    set NewEffect = AddSpecialEffectTarget( "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl", NewUnit, "overhead" )
    set LastEffect = AddSpecialEffectTarget( "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl", LastUnit, "overhead"  )
    
    // Pauses the units and animation indefinitely and make them partially transparant
    call PauseUnit( LastUnit, true )
    call PauseUnit( NewUnit, true )
    call SetUnitTimeScale( LastUnit, 0.00 )
    call SetUnitTimeScale( NewUnit, 0.00 )
    
    // Sleep for a while, depending on the level of the ability and distance travelled
    // Ensure that the sleep goes for 0.27 seconds
    
    //Loop through transticks if transparency is enabled
    if (not Transparency) then
        call TriggerSleepAction(SleepLen)
    else
        set Index = 0.00
        set LastTrans = MinTrans
        set NewTrans = 255
        loop
            exitwhen (Index > TransTicks)
            call SetUnitVertexColor(LastUnit, 255, 255, 255, LastTrans)
            call SetUnitVertexColor(NewUnit, 255, 255, 255, NewTrans)
            set LastTrans = LastTrans + TickAmount
            set NewTrans = NewTrans - TickAmount
            call TriggerSleepAction(SleepLen)
            set Index = Index + IndexInc
        endloop
        call SetUnitVertexColor(LastUnit, 255, 255, 255, LastTrans)
        call SetUnitVertexColor(NewUnit, 255, 255, 255, NewTrans)
    endif
    
    // Unpause the casting unit
    call SetUnitTimeScalePercent( LastUnit, 100.00 )
    call PauseUnit( LastUnit, false )
    call SetUnitVertexColor(LastUnit, 255, 255, 255, 255)
    
    // Remove warp effects
    call DestroyEffect( LastEffect )
    call DestroyEffect( NewEffect )
    
    // Check if unit died in transit
    if ( not(GetUnitState(NewUnit, UNIT_STATE_LIFE) <= 0) ) then
        if ( not(GetUnitState(LastUnit, UNIT_STATE_LIFE) <= 0) ) then
            call SetUnitState(LastUnit, UNIT_STATE_LIFE, GetUnitState(LastUnit, UNIT_STATE_MAX_LIFE) * RMaxBJ(0,RMinBJ(GetUnitStatePercent(LastUnit, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE), GetUnitStatePercent(NewUnit, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE))) * 0.01)
            call RemoveUnit( NewUnit )
        endif
    else
        call SetUnitExploded(LastUnit, true)
        call KillUnit(LastUnit)
    endif
    
    // Clean up
    call RemoveUnit( NewUnit )
    call RemoveLocation(TargetPos)
    call RemoveLocation(UnitPos)
    set LastUnit = null
    set NewUnit = null
    set StompEffect = null
    set NewEffect = null
    set LastEffect = null
    set TargetPos = null
    set UnitPos = null
endfunction

//
// Anti Leak Filter used to recover trigger leaks
//
function AntiLeakFilter takes nothing returns boolean
    return true
endfunction

//===========================================================================
function InitTrig_Warp_Jump takes nothing returns nothing
    local trigger WarpJump
    local filterfunc filter
    local integer index
    set WarpJump = CreateTrigger(  )
    set filter = Filter(function AntiLeakFilter)
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(WarpJump, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, filter)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition( WarpJump, Condition( function warp_jump_conditions ) )
    call TriggerAddAction( WarpJump, function warp_jump_actions )
    call DestroyFilter(filter)
    set WarpJump = null
    set filter = null
endfunction


22:09 11/07/09
#Fixed some BJ's I missed
#Added code
23:27 11/07/09
#Forgot to reactivate the trigger
11:32 12/07/09
#Fixed the food error
12:05 13/07/09
#Made it easier to modify, allows the choice between fixed damage, aoe and phase time
##or the scaling one
#Added a transparency effect
#Changed the damage type to magic so it doesn't effect magic immune units
#Removed more BJ's
#Ensured that phase and aoe cannot be less then or equal to 0
#Modified the scale for distance from /10 to /8
16:28 15/07/09
#Finished implementing the transparency effect
#Fixed the portrait with the neutral hostile idea (But i'm still not happy about it)
#It is now finished for normal units
19/09/09
#Missed the deadline for spell thingies, so here it is again


Keywords:
Warp, Blink, Teleport, AOE, Red Alert 2, Chronolegionaire
Contents

Warp Jump (Map)

Reviews
12:20, 29th Dec 2009 TriggerHappy: Please use coordinates instead of locations. Initialize your locals directly instead of setting them after. Remove all of the BJ's. There's no need to inline the event.
Status
Not open for further replies.

Moderator

M

Moderator

12:20, 29th Dec 2009
TriggerHappy:

  • Please use coordinates instead of locations.
  • Initialize your locals directly instead of setting them after.
  • Remove all of the BJ's.
  • There's no need to inline the event.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
First of all learn Jass don't make GUI=>Jass conversions.
Look at this horrible example you are giving:

JASS:
function warp_jump_conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A001' ) ) then
        return false
    endif
    return true
endfunction
Real jass looks like:
JASS:
function Condition takes nothing returns boolean
 return GetSpellAbilityId() == SpellID
endfunction
So you should first understand jass and read some tutorials before uploading low quality spells.
Also don't use bjs.
JASS:
    set Ability = 'A001' // Ability code
But that should be above the triggers condition so you actualy use that variable for something.
It should be a global also.
JASS:
globals
 constant integer Ability = 'A001'
endglobals
function Condition takes nothing returns boolean
 return GetSpellAbilityId() == Ability
endfunction
Never use bj's they all have calculations to replace them.
Also why not instantly set some variables?
JASS:
local trigger Warp = CreateTrigger()
Saves up space.
JASS:
GetWidgetLife(widget) > 0.405
Checks if the unit is alive don't use GUI=>Jass version.
Awfull coding style, comments are usualy next to the functions not under them.
JASS:
call SetUnitPositionLoc( LastUnit, TargetPos) // Move casting unit to the target location
All in all one poor Jass spell. You need to learn much more.
 
Level 7
Joined
Dec 30, 2008
Messages
72
Yes, the initial check_condition is converted from gui to jass as I started making this spell in gui and switched halfway through to jass

I have removed all wrapper BJ's and only left the ones that actually do something
(With the exception of Life and Mana, must have missed those on the run through)

I dislike instantly setting variables (old coding habit) so that's simply personal preference

all my comments are above the functions that relate to them??? how are you getting under??

Also I tried the global variable thing (was looking for a way to make globals) but I keep getting endofline errors (Expected End of Line) If you know how to combat that error I would be very appreciative
-EDIT-
Someone finally told me that I'll need the hacked WE for "vJASS"
This is a JASS spell, not vJASS, that's why it's tagged as JASS

I'm moving the code onto hive so it's easier to access
 
Level 6
Joined
Jul 27, 2008
Messages
132
vJass is better...(not eat many memory)
if you change to vJass this will be a great spell
vJass Like this (declare global,optimize the script,removeBj's...and leaks)
and how to hide like that? i'am newbie o_O WTF?
and one thing...
This spell don't work with me...
 
Level 7
Joined
Dec 19, 2008
Messages
276
GetWidgetLife(widget) > 0.405

Fail's for heroes

So don't recommend this shit in everywhere

GetWidgetLife(widget) > 0.405 can produce more heavily bugs then BJ

But there alternative...
Works fine always
IsUnitType(Unit,UNIT_TYPE_DEAD) == false and GetUnitTypeId(Unit)>0
 
Level 7
Joined
Dec 30, 2008
Messages
72
@ Ranger21
I am creating a copy of the unit who cast the ability... you should be able to see that
And thus you can't get rid of the portrait like that.

I've fixed the food error and scoured my code for anything that could be replaced as natives to the highest degree
 
Level 17
Joined
Mar 17, 2009
Messages
1,349
JASS:
call TriggerSleepAction( Distance/GetUnitAbilityLevel(LastUnit,Ability))
This leads to a delay when unpausing the unit by the time the ability is level 3...

Uses some stupid BJ's and you don't null location locals, you only RemoveLocation. You use locations thus...

Umm, spell idea is nothing nice - no offense...

off-topic @ gunggang777:
vJass doesn't take less memory than Jass, vJass is Jass, just a mask for thing too look easier to you. But deep to the core of the script, everything you can make in vJass can be made in Jass but with many many many much more lines.
What I'm saying, efficiency wise, both are the same (depends on how good the scripter is :p); work-wise, vJass takes the lead...
 
Level 7
Joined
Dec 30, 2008
Messages
72
Again, could you tell me exactly what BJ's i am using.. I was pretty certain i had gotten rid of most of them.

Hmm, you don't really *have* to null locations, but i'll fix it as soon as i figure out how to get rid of the hero portrait and fix the hero name.

Might I ask how
JASS:
call TriggerSleepAction( Distance/GetUnitAbilityLevel(LastUnit,Ability))
Is causing a delay??
 
Level 17
Joined
Mar 17, 2009
Messages
1,349
Ok let me tell you what you can do to make this spell at least look good.

It's all about the SFX, what you do is pick a nice little effect (something white-ish/light blue-ish) and when the ability is triggered, you start playing around with unit transparency. You make once fade while you unfade the other and keep on increasing the fading until the original disappears and the new stays.
The SFX, well once one unit fades is gonna start to unfade, you just create, add the 0.01 expiration timer, and the death effect of the SFX would appear on both units, giving an original touch.

Umm, also change the name and make the spell look magical rather then fiery...
 
Level 7
Joined
Dec 30, 2008
Messages
72
However.. I realy didn't want to do it like that. I chose those effects for my ability, I'm not going to change them becuse you don't like them. I made them easy enough to change in the code.

I am currently working on the transparency, doing something like that yeah, but the sfx is staying the same...

@Anachron
Wait... why would you add the locust ID to it?

But that neutral idea is brilliant!!!! Thnx
-EDIT-
Right, well that does solve the portrait problem, however he is not targeted by Neutral Hostile but thats a small error.
However the propername problem is still there... I'm going to post this question in the spell foums
Just to let you know I finished the transparency thing a while ago, but I won't update it until I have this propername thing solved (Unless it can't be solved)
 
Last edited:
Level 7
Joined
Dec 30, 2008
Messages
72
@ Anachron
that completely defeats the purpose of this ability... this ability is not an escape ability, it's an initiating ability...

@ Deuterium
Nah, I like the name Warp Jump, and it lets you use J as a hotkey XD
Besides I have another ability called Warp that I made ages ago
 
Status
Not open for further replies.
Top