Okay, so I had a quick idea and put in a few lines of code, so far all it does is roam around randomly. I intend to add more functionality in the future, but what do you think of it so far?
v0.1.0----------
Spoiler
# Jumper.crpl
# Author: GameGibu
# ------------------------------------------
once
if ( IsEditMode ) ShowTraceLog endif
$Amt:20
$Interval:15
$Frequency:300
$Range:20
$Movetime:2.0
"
" ->nl
0 ->myTime
0 ->isInJump
0 ->jumpStart
CurrentCoords ->startY ->startX
SetUnitAttribute( Self CONST_CREATEPZ 0 )
SetUnitAttribute( Self CONST_CELLWIDTH 5 )
SetUnitAttribute( Self CONST_CELLHEIGHT 5 )
SetImageScale( Self "main" 2.0 2.0 )
SetImage( Self "main" "CustomEmitter" )
SetPopupText( "Amt: " <-Amt concat <-nl concat "Interval: " concat <-Interval asfloat 30.0 div concat )
endonce
@run
:run
<-myTime 1 add ->myTime
if ( <-isInJump not <-myTime <-Interval mod eq0 and )
AddCreeper( CurrentCoords <-Amt )
endif
if ( <-myTime <-Frequency mod eq0 <-isInJump not and )
RandCoordsInRange( CurrentCoords <-Range ) ->TargY ->TargX
1 ->isInJump
<-myTime ->jumpStart
endif
if ( <-isInJump )
if ( <-myTime <-jumpStart sub eq0 )
SetImageScale( Self "main" 1.8 dup )
endif
if ( <-myTime <-jumpStart sub 1 eq )
SetImageScale( Self "main" 1.6 dup )
endif
if ( <-myTime <-jumpStart sub 2 eq )
<-TargX <-TargY dup2 CellToPixel <-startX <-startY CellToPixel Distance <-Movetime 30 mul div QueueMove
endif
if ( <-myTime <-jumpStart sub 3 eq )
endif
if ( <-myTime <-jumpStart sub dup 2 gt swap <-Movetime 30.0 mul floor 2 add lt and )
#ShowTraceLog
#GetImageScale( Self "main" )
#0.5 add ->ys 0.5 add ->xs
<-myTime <-jumpStart sub 2 add ->xvar
-8.0 <-Movetime 30.0 mul 2.0 pow div <-xvar 2.0 pow mul 8.0 <-Movetime 30.0 mul div <-xvar mul add 2.0 add ->sc
SetImageScale( Self "main" <-sc <-sc )
endif
if ( <-myTime <-jumpStart sub 5 eq )
endif
if ( <-myTime <-jumpStart sub 6 eq )
endif
if ( <-myTime <-jumpStart sub 7 eq )
endif
if ( <-myTime <-jumpStart sub 8 eq )
endif
if ( <-myTime <-jumpStart sub 9 eq )
endif
if ( <-myTime <-jumpStart sub <-Movetime 30.0 mul 2 add gte )
0 ->isInJump
SetImageScale( Self "main" 2.0 2.0 )
CurrentCoords ->startY ->startX
endif
endif
v0.2.0----------
Changes:
- Made the core avoid jumping into shields/fields
- Made the core avoid jumping onto Void
- Added ability to stun with snipers and Beams
- Has a slight cooldown to prevent being trapped
- Still has to be killed by a nullifier
- Snipers can hit it while jumping, but need a line of sight when it's not in the air
- Beams can only hit it in the air
- Made the jump look all nice
Spoiler
# Jumper.crpl
# Author: GameGibu
# ------------------------------------------
once
if ( IsEditMode ) ShowTraceLog endif
$Amt:20
$Interval:15
$Frequency:300
$Range:20
$Movetime:2.0
$Stuntime:150
"
" ->nl
0 ->myTime
0 ->isInJump
0 ->jumpStart
CurrentCoords ->startY ->startX
SetUnitAttribute( Self CONST_CREATEPZ 0 )
SetUnitAttribute( Self CONST_CELLWIDTH 5 )
SetUnitAttribute( Self CONST_CELLHEIGHT 5 )
SetUnitAttribute( Self CONST_SNIPERTARGET 1 )
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 1 )
SetUnitAttribute( Self CONST_MAXHEALTH 30.0 )
SetUnitAttribute( Self CONST_HEALTH 30.0 )
#SetUnitAttribute( Self CONST_HEALRATE 1.0 )
#GetUnitAttribute( Self CONST_MAXHEALTH ) Trace
SetImageScale( Self "main" 2.0 2.0 )
SetImage( Self "main" "CustomEmitter" )
SetPopupText( "Amt: " <-Amt concat <-nl concat "Interval: " concat <-Interval asfloat 30.0 div concat )
endonce
@run
:run
<-myTime 1 add ->myTime
if ( <-isInJump not <-myTime <-Interval mod eq0 and )
AddCreeper( CurrentCoords <-Amt )
endif
<-stunnedTimer 1 sub ->stunnedTimer
if ( Self CONST_HEALTH GetUnitAttribute Self CONST_MAXHEALTH GetUnitAttribute lt )
SetUnitAttribute( Self CONST_SNIPERTARGET 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 0 )
<-Stuntime ->stunnedTimer
if ( <-isInJump )
AbortMove
endif
else
if ( <-stunnedTimer <-Stuntime neg 3 mul gt )
SetUnitAttribute( Self CONST_SNIPERTARGET 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 0 )
else
SetUnitAttribute( Self CONST_SNIPERTARGET 1 )
#SetUnitAttribute( Self CONST_BEAMTARGET 1 )
endif
endif
if ( <-stunnedTimer 0 gt )
SetUnitAttribute( Self CONST_HEALTH GetUnitAttribute( Self CONST_MAXHEALTH ) )
if ( <-stunnedTimer <-Stuntime eq )
14 CurrentPixelCoords GetImagePositionZ( Self "main" ) 1.0 sub 2.0 2.0 1.0 <-Stuntime 30 mul div CreateEffect
endif
endif
if ( <-myTime <-Frequency mod eq0 <-isInJump not and <-stunnedTimer 0 gt not and )
Trace ( "Attempting Jump..." )
RandCoordsInRange( CurrentCoords <-Range ) ->TargY ->TargX
if ( <-TargX <-TargY @IsInField <-TargX <-TargY GetVoid or )
0 ->isInJump
5 0 do
if ( <-TargX <-TargY @IsInField <-TargX <-TargY GetVoid or not )
1 ->isInJump
<-myTime ->jumpStart
else
Trace ( "Could not jump to position: " <-TargX concat " " concat <-TargY concat )
RandCoordsInRange( CurrentCoords <-Range ) ->TargY ->TargX
endif
loop
else
1 ->isInJump
<-myTime ->jumpStart
endif
endif
if ( <-isInJump )
#SetText( "isInJump" )
if ( <-myTime <-jumpStart sub eq0 )
SetImageScale( Self "main" 1.9 dup )
endif
if ( <-myTime <-jumpStart sub 1 eq )
SetImageScale( Self "main" 1.7 dup )
endif
if ( <-myTime <-jumpStart sub 2 eq )
<-TargX <-TargY dup2 CellToPixel <-startX <-startY CellToPixel Distance <-Movetime 30 mul div QueueMove
if ( <-stunnedTimer <-Stuntime neg 3 mul lt )
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 1 )
SetUnitAttribute( Self CONST_BEAMTARGET 1 )
endif
endif
if ( <-myTime <-jumpStart sub 3 eq )
endif
if ( <-myTime <-jumpStart sub dup 2 gt swap <-Movetime 30.0 mul floor 2 add lt and )
#ShowTraceLog
#GetImageScale( Self "main" )
#0.5 add ->ys 0.5 add ->xs
<-myTime <-jumpStart sub 2 add ->xvar
-8.0 <-Movetime asfloat 30.0 mul 2.0 pow div <-xvar 2.0 pow mul 8.0 <-Movetime asfloat 30.0 mul div <-xvar mul add 2.0 add ->sc
SetImageScale( Self "main" <-sc <-sc )
endif
if ( <-myTime <-jumpStart sub 5 eq )
endif
if ( <-myTime <-jumpStart sub 6 eq )
endif
if ( <-myTime <-jumpStart sub 7 eq )
endif
if ( <-myTime <-jumpStart sub 8 eq )
endif
if ( <-myTime <-jumpStart sub 9 eq )
endif
if ( <-myTime <-jumpStart sub <-Movetime 30.0 mul 2 add gte )
0 ->isInJump
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 0 )
SetImageScale( Self "main" 2.0 2.0 )
CurrentCoords ->startY ->startX
endif
else
#SetText( "" )
endif
:IsInField #Args: X, Y
GetFieldCell neq0 swap neq0 and swap neq0 and swap neq0 and
v0.2.48----------
Changes:
- Made code a little shorter while bughunting
- Bug with snipers renamed as unintentional feature
Spoiler
# Jumper.crpl
# Author: GameGibu
# ------------------------------------------
once
if ( IsEditMode ) ShowTraceLog endif
$Amt:20
$Interval:15
$Frequency:300
$Range:20
$Movetime:2.0
$Stuntime:150
"
" ->nl
0 ->myTime
0 ->isInJump
0 ->jumpStart
CurrentCoords ->startY ->startX
SetUnitAttribute( Self CONST_CREATEPZ 0 )
SetUnitAttribute( Self CONST_CELLWIDTH 5 )
SetUnitAttribute( Self CONST_CELLHEIGHT 5 )
SetUnitAttribute( Self CONST_SNIPERTARGET 1 )
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 1 )
SetUnitAttribute( Self CONST_MAXHEALTH 30.0 )
SetUnitAttribute( Self CONST_HEALTH 30.0 )
#SetUnitAttribute( Self CONST_HEALRATE 1.0 )
#GetUnitAttribute( Self CONST_MAXHEALTH ) Trace
SetImageScale( Self "main" 2.0 2.0 )
SetImage( Self "main" "CustomEmitter" )
SetPopupText( "Amt: " <-Amt concat <-nl concat "Interval: " concat <-Interval asfloat 30.0 div concat )
endonce
@run
:run
<-myTime 1 add ->myTime
if ( <-isInJump not <-myTime <-Interval mod eq0 and )
AddCreeper( CurrentCoords <-Amt )
endif
<-stunnedTimer 1 sub ->stunnedTimer
ClearTraceLog Trace ( "myTime = " <-myTime concat ) Trace ( "stunnedTimer = " <-stunnedTimer concat )
if ( Self CONST_HEALTH GetUnitAttribute Self CONST_MAXHEALTH GetUnitAttribute lt )
SetUnitAttribute( Self CONST_SNIPERTARGET 0 )
#SetUnitAttribute( Self CONST_BEAMTARGET 0 )
<-Stuntime ->stunnedTimer
Trace ( <-stunnedTimer )
if ( <-isInJump )
AbortMove
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 0 )
endif
endif
if ( <-stunnedTimer 0 gt )
SetText( "Stunned" )
SetUnitAttribute( Self CONST_SNIPERTARGET 0 )
SetUnitAttribute( Self CONST_HEALTH GetUnitAttribute( Self CONST_MAXHEALTH ) )
#if ( <-stunnedTimer <-Stuntime eq )
# 14 CurrentPixelCoords GetImagePositionZ( Self "main" ) 1.0 sub 2.0 2.0 1.0 <-Stuntime 30 mul div CreateEffect
#endif
else
SetText( "" )
endif
if ( <-stunnedTimer <-Stuntime 3 mul neg gt )
Trace2 ( <-Stuntime 3 mul neg <-stunnedTimer )
SetUnitAttribute( Self CONST_SNIPERTARGET 0 )
"CONST_SNIPERTARGET = " GetUnitAttribute( Self CONST_SNIPERTARGET ) concat Trace
Trace ( "Invince" )
#SetText( "" )
else
Trace2 ( <-Stuntime 3 mul neg <-stunnedTimer )
SetUnitAttribute( Self CONST_SNIPERTARGET 1 )
"CONST_SNIPERTARGET = " GetUnitAttribute( Self CONST_SNIPERTARGET ) concat Trace
Trace ( "Not Invince" )
endif
if ( <-myTime <-Frequency mod eq0 <-isInJump not and <-stunnedTimer 0 gt not and )
Trace ( "Attempting Jump..." )
RandCoordsInRange( CurrentCoords <-Range ) ->TargY ->TargX
if ( <-TargX <-TargY @IsInField <-TargX <-TargY GetVoid or )
0 ->isInJump
5 0 do
if ( <-TargX <-TargY @IsInField <-TargX <-TargY GetVoid or not )
1 ->isInJump
<-myTime ->jumpStart
else
Trace ( "Could not jump to position: " <-TargX concat " " concat <-TargY concat )
RandCoordsInRange( CurrentCoords <-Range ) ->TargY ->TargX
endif
loop
else
1 ->isInJump
<-myTime ->jumpStart
endif
endif
if ( <-isInJump )
#SetText( "isInJump" )
if ( <-myTime <-jumpStart sub eq0 )
SetImageScale( Self "main" 1.9 dup )
endif
if ( <-myTime <-jumpStart sub 1 eq )
SetImageScale( Self "main" 1.7 dup )
endif
if ( <-myTime <-jumpStart sub 2 eq )
<-TargX <-TargY dup2 CellToPixel <-startX <-startY CellToPixel Distance <-Movetime 30 mul div QueueMove
if ( <-stunnedTimer <-Stuntime neg 3 mul lt )
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 1 )
SetUnitAttribute( Self CONST_BEAMTARGET 1 )
endif
endif
if ( <-myTime <-jumpStart sub 3 eq )
endif
if ( <-myTime <-jumpStart sub dup 2 gt swap <-Movetime 30.0 mul floor 2 add lt and )
#ShowTraceLog
#GetImageScale( Self "main" )
#0.5 add ->ys 0.5 add ->xs
<-myTime <-jumpStart sub 2 add ->xvar
-8.0 <-Movetime asfloat 30.0 mul 2.0 pow div <-xvar 2.0 pow mul 8.0 <-Movetime asfloat 30.0 mul div <-xvar mul add 2.0 add ->sc
SetImageScale( Self "main" <-sc <-sc )
endif
if ( <-myTime <-jumpStart sub 5 eq )
endif
if ( <-myTime <-jumpStart sub 6 eq )
endif
if ( <-myTime <-jumpStart sub 7 eq )
endif
if ( <-myTime <-jumpStart sub 8 eq )
endif
if ( <-myTime <-jumpStart sub 9 eq )
endif
if ( <-myTime <-jumpStart sub <-Movetime 30.0 mul 2 add gte )
0 ->isInJump
SetUnitAttribute( Self CONST_SNIPERIGNORELOS 0 )
SetUnitAttribute( Self CONST_BEAMTARGET 0 )
SetImageScale( Self "main" 2.0 2.0 )
CurrentCoords ->startY ->startX
endif
else
#SetText( "" )
endif
:IsInField #Args: X, Y
GetFieldCell neq0 swap neq0 and swap neq0 and swap neq0 and