After countless attempts to add JUMPAD, LADDER, MANTLING and DODGE effects, I only had success with JUMPAD (the effect related to you jumping high when you step on a certain floor in a certain sector, represented by the letter J in the image). First, I looked for all the codes I could related to the movement mechanics linked to jumping and climbing. I found a lot of them. I put them in a customized .CON file to work with the others from the Legacy mod and also other customized ones that I created myself, but that don't interfere here. I started trying to add JUMPAD because right away I saw that of all the movement effects it seemed to be the simplest and most obvious to find the necessary codes and adjust them to work with the mod I'm using as a base. After so much trial and error, with the help of an AI assistant, I managed to create the effect. At first I started with errors, but then I managed to add a forward momentum and make the jump higher than the Dukeplus, which I used this effect as a base.
I'm basically trying to add Dukeplus's movement effects to Legacy. In other words, the JUMPAD effect works successfully!
Now my focus is on the stairs. I've tried everything, even with the help of my artificial assistant, but I'm still just going around in circles, not knowing how to make this effect work in Legacy. I put all the events and states I could find in the script in USERPLUS.CON, PLAYERPLUS.CON and DUKEPLUS.CON. I'm not sure, but I suspect that some code or other escaped my notice in these files, or there may be specific errors that I still don't have a clue about. I also tried to make the mantling and dodge effects, but without success. Out of desperation I even added onevent EVENT_JUMP and others of the sort, but still couldn't do it. There's even the pythagoras state, but without success. Another problem could be the order of the codes, but I don't have a clear clue about that. There are even codes within the states and events that may be related to things that I don't intend to add to the mod. But as I'm afraid of changing the code too much and ending up doing something wrong, I left such codes.
I tried to make this work for DAYS!
One thing that really made it difficult for me was the fact that code for the same mechanic seems to be spread across multiple files. That's why I always prefer to put everything related to something in a single file. The day I make a real mod, I'll put each type of thing in its own file, so I can organize myself better and avoid conflicts and confusion. But unfortunately, sharing code between files is something that is common in game mods, unfortunately, even more so when it comes to complex mechanics of effects and movement. For someone like me (newbie in coding) who wants to extract a particular effect or function, it gets complicated and very frustrating!
Here is a picture of how the icons related to the effects look in Mapster32. "J" is the JUMPAD, while "L" is the ladder effect.
The way the icons are on the map is exactly like on the Dukeplus effects test map.
And now, the code (that sucks, so prepare yourself)
:
Because the script is BIG, I'll separate in parts.
Note: At least on Legacy and on my computer, there were no compilation errors. The desired effects just didn't occur.
/////////////////////////////////////////////
Part 1: Definitions and variations
// LADDER.CON - Advanced Player Movement Mechanics
// Global Configuration Flags
define MANTLING YES
define DODGING YES
define FREERUNNER YES
define REALRUNNING YES
define MANTCHECK 6
define MANTDIST 480
define DODGE_IMPULSE_MULTIPLIER 2
define DODGE_DISTANCE 640
// DEFINES FOR RUNNING: THESE DO NOTHING UNLESS REALRUNNING IS ON
define SPEED1 45000 // the speed that you start at when you begin to run
define SPEED2TIME 30 // the number of ticks of acceleration before reaching RUNNINGSPEED
define RUNACCEL 256 // the rate of acceleration between SPEED1 and SPEED2
define LADDER 2951
define MOVEMENT 2952
define LADDER_CLIMB_SPEED -256
define LADDER_DETECT_DIST 480
define LADDER_STATE_NONE 0
define LADDER_STATE_CLIMBING 1
define LADDER_STATE_DISMOUNTING 2
define pforward 1
define pbackward 2
gamevar cannonid -1 1
gamevar sleeping 0 1
gamevar numallies 0 0
gamearray ptrails 100
gamevar ptrailtimer 0 1
gamevar dpsounds YES 0
gamevar menunag 1 1
gamevar nomenu 0 0
gamevar nagpos 900 1
gamevar menutoggle 0 1
gamevar ONCAR 0 1
gamevar timer 0 0
gamevar canmantle MANTLING 0
gamevar mantling 0 1
gamevar mantwait 0 1
gamevar mantwaittime 0 1
gamevar mantcheck 0 1
gamevar mantz 0 1
gamevar jumped 0 1
gamevar backview 0 1
gamevar holding -1 1
gamevar pickup 0 1
gamevar holdingpic 0 1
gamevar drinksoda 0 1
gamevar monstflags 0 2
gamevar hitag 0 2
gamevar lotag 0 2
gamevar spriteid 0 0
gamevar monstatus 0 2
gamevar target -1 2
gamevar candodge DODGING 0
gamevar dodge 0 1
gamevar botdodge 0 2
gamevar dodgeagain 0 1
gamevar dodgeang 0 1
gamevar nofalldamage 0 1
gamevar ftap 0 1
gamevar fpresstime 0 1
gamevar btap 0 1
gamevar bpresstime 0 1
gamevar ltap 0 1
gamevar lpresstime 0 1
gamevar rtap 0 1
gamevar rpresstime 0 1
gamevar fhold 0 1
gamevar bhold 0 1
gamevar lhold 0 1
gamevar rhold 0 1
gamevar mx 0 0
gamevar my 0 0
gamevar mz 0 0
gamevar initx 0 2
gamevar inity 0 2
gamevar initz 0 2
gamevar walljump 0 1
gamevar jumptap 0 1
gamevar jumpadxvel 0 1
gamevar onladder 0 1
gamevar topladder 0 2
gamevar laddervel 0 1
gamevar lastladderx 0 1
gamevar lastladdery 0 1
gamevar laddersound -1 1
gamevar scaled NO 0
gamevar doubled NO 0
gamevar onblock 0 1
gamevar bits 0 1
gamevar thrust 0 1
gamevar extbits 0 1
gamevar fpress 0 1
gamevar bpress 0 1
gamevar mysector -1 2
gamevar mywall -1 2
gamevar underwater 0 2
gamevar xvel 0 0
gamevar yvel 0 0
gamevar zvel 0 0
gamevar tempc 0 0
gamevar tempd 0 0
gamevar tempe 0 0
gamevar zdist 0 0
gamevar xydist 0 0
gamevar xydist2 0 0
gamevar angvar 0 0
gamevar canseeplayer 0 2
gamevar canshootplayer 0 2
gamevar mysin 0 1
gamevar mycos 0 1
gamevar hitsector 0 1
gamevar hitwall 0 1
gamevar hitwall2 0 1
gamevar nextsector 0 1
gamevar hitsprite -1 1
gamevar scannedsprite -1 1
gamevar hitx 0 2
gamevar hity 0 2
gamevar hitz 0 2
gamevar clipmask 4294901808 0
gamevar hp 0 2
gamevar slowrunaccel REALRUNNING 0
gamevar pspeed 0 1
gamevar camshake 0 1
gamevar runcount 0 1
gamevar runflag 0 1
gamevar strafedir 0 1
gamevar laststrafedir 0 1
gamevar forbackdir 0 1
gamevar lastforbackdir 0 1
gamevar oposxv 0 1 // velocities from last tick
gamevar oposyv 0 1
gamevar oposzv 0 1
gamevar offground 0 1 // counter
gamevar weight 0 2
gamevar activator 0 2
gamevar initshade 0 2
gamevar playerally 0 2
gamevar pal 0 2
gamevar peractor1 0 2
gamevar peractor2 0 2
gamevar peractor3 0 2
gamevar fallflag 0 2
gamevar peractor4 0 2
gamevar peractor5 0 2
gamevar peractor6 0 2
gamevar peractor7 0 2
gamevar target2 -1 2
gamevar intensity 0 2
gamevar mtype 0 2
gamevar countvar 0 2
gamevar countvarb 0 2
gamevar myspawner -1 2
gamevar teleported 0 2
gamevar digx 0 1
gamevar digy 0 1
gamevar digz 0 1
gamevar orientation 0 1
gamevar shade 0 1
gamevar superkicking 0 1
gamevar superkickdone 0 1
gamevar spinkick 0 1
gamevar reversekick 0 1
gamevar kicktarg -1 1
gamevar kickimpact 0 1
define KENERGY 780
gamevar kickenergy KENERGY 1
action PSTAND 0 1 5 1 1
/////////////////////////////////////////////
Part 2: Pythagoras and JUMPAD codes (that seemed to work somehow)
state pythagoras
setvarvar xydist x
subvarvar xydist hitx
mulvarvar xydist xydist
setvarvar tempb y
subvarvar tempb hity
mulvarvar tempb tempb
addvarvar xydist tempb
sqrt xydist xydist
ends
/////////////////////////////////////////////
eventloadactor JUMPAD
readgamevar scaled
getactor[THISACTOR].extra monstflags
ifvare monstflags -1 setvar monstflags 0
getactor[THISACTOR].lotag lotag
getactor[THISACTOR].hitag hitag
// Default hitag if not set
ifvare hitag 0 setvar hitag 640
// Initialize velocity components
getactor[THISACTOR].xvel initx
getactor[THISACTOR].yvel inity
ifvare inity 0 setvar inity 26
getactor[THISACTOR].zvel initz
mulvar initz -8
ifvare scaled YES
{
// More controlled scaling
mulvar initx 1.5 // Less aggressive horizontal scaling
mulvar initz 2 // More vertical boost
}
// Ensure minimum and maximum velocity limits
ifvarg initx 1024 setvar initx 1024
ifvarg initz 512 setvar initz 512
// Optional scaling for jump pad
ifvare scaled YES
{
mulvar initx 2
mulvar initz 3
divvar initz 2
}
ifvare candodge YES
{
ifvarn jumpadxvel 0
{
mulvarvar xvel jumpadxvel
mulvarvar yvel jumpadxvel
}
getincangle dodgeang angvar sprite[spriteid].ang
}
enda
/////////////////////////////////////////////
// Jump Pad Activation Logic
useractor notenemy JUMPAD 0
ifvare DODGING NO break // Global dodge disable
ifvarn lotag 1 break
cstat 32768
getplayer[THISACTOR].i spriteid
ldist xydist THISACTOR spriteid
// Distance-based jump pad activation
ifvarvarl xydist hitag
{
getplayer[THISACTOR].falling_counter temp
// Falling counter logic
ifvarg temp 8
{
ifpdistg 1536 setvar temp 0
}
else
{
ifpdistl 1024 setvar temp 1
else ifpdistl 8192 ifvarn dodge 0 setvar temp 1
else setvar temp 0
}
// Jump pad activation
ifvarn temp 0
{
getplayer[THISACTOR].i spriteid
getactor[spriteid].z mz
subvar mz 8192
setactor[spriteid].z mz
getplayer[THISACTOR].posz z
subvar z 8192
setplayer[THISACTOR].posz z
setplayer[THISACTOR].jumping_counter 0
setplayer[THISACTOR].jumping_toggle 0
setplayer[THISACTOR].poszv initz
getplayer[THISACTOR].ang angvar
cos xvel angvar
sin yvel angvar
mulvar xvel 256
mulvar yvel 256
setplayer[THISACTOR].posxv xvel
setplayer[THISACTOR].posyv yvel
getactor[THISACTOR].ang dodgeang
setvarvar dodge inity
setvarvar jumpadxvel initx
setplayer[THISACTOR].falling_counter 0
setvar nofalldamage 1
soundonce LAUNCHSND
}
}
ifvare candodge YES
{
ifvarn dodge 0
{
setvarvar jumpadxvel initx
mulvar jumpadxvel DODGE_IMPULSE_MULTIPLIER
divvar initz 2
}
}
enda
/////////////////////////////////////////////
Part 3: Codes related to ladder (the only thing seemed to work was related to extra value that made "L" sprite invisible. The rest... nothing!)
eventloadactor LADDER
{
getactor[THISACTOR].extra monstflags
setactor[THISACTOR].cstat 32768
setactor[THISACTOR].extra -1
getactor[THISACTOR].hitag hitag
getactor[THISACTOR].lotag lotag
setvar monstatus 0
setvar mtype 0
setvar myspawner -1
setactor[THISACTOR].clipdist 32
setactor[THISACTOR].xrepeat 32
setactor[THISACTOR].yrepeat 32
}
enda
/////////////////////////////////////////////
state laddercheck
{
getplayer[THISACTOR].i spriteid
ifvarn onladder 0 break
setvar temp 0
whilevarn temp 16384
{
getactor[temp].picnum picnum
ifvare picnum LADDER ifvarvarn temp THISACTOR
{
ldist xydist temp spriteid
ifvarl xydist LADDER_DETECT_DIST
{
getactor[temp].z mz
getplayer[THISACTOR].posz z
ifp pducking subvar z 4096
ifvarvarg z mz
{
addvar mz 16384
ifvarvarl z mz
{
setvarvar myspawner temp
setvar mtype 1
setvarvar topladder mz
getactor[temp].x lastladderx
getactor[temp].y lastladdery
break
}
}
}
}
addvar temp 1
}
}
ends
/////////////////////////////////////////////
state laddercode
{
ifvare onladder 0 break
setvar mantling 0
setvar dodge 0
setvar walljump 0
setplayer[THISACTOR].horiz 0
ifaction PSTAND nullop else action PSTAND
setplayer[THISACTOR].falling_counter 0
ifvare fpress 1
{
setvar laddervel LADDER_CLIMB_SPEED
soundonce DUKE_GRUNT
}
else ifvare bpress 1
{
setvar laddervel 256
soundonce DUKE_GRUNT
}
else
{
setvar laddervel 0
setplayer[THISACTOR].posxv 0
setplayer[THISACTOR].posyv 0
setplayer[THISACTOR].posx lastladderx
setplayer[THISACTOR].posy lastladdery
}
setplayer[THISACTOR].poszv laddervel
getplayer[THISACTOR].posz z
ifvarvarg z topladder
{
setvar onladder 0
break
}
ifp pjumping
{
setvar onladder 0
setvar laddervel -512
}
else
{
subvar onladder 1
}
}
ends
/////////////////////////////////////////////
useractor notenemy LADDER 0
{
ifp palive
ifvare mantling 0
ifvare dodge 0
{
getplayer[THISACTOR].i spriteid
ldist xydist THISACTOR spriteid
ifvarvarl xydist LADDER_DETECT_DIST
{
state laddercheck
ifvare mtype 1
{
setvar onladder 15
setplayer[THISACTOR].falling_counter 0
setvar nofalldamage 1
state laddercode
}
}
}
}
enda
/////////////////////////////////////////////
Part 4: Codes related to mantling (no hint on how to make this work)
state checkwall // checks to see if there is a close wall to grab onto
// mantling will be set to 1 if the answer is yes, 0 otherwise
ifvare MANTLING NO break // Global mantle disable
ifp pjumping
{
state checkwall
ifvare mantling 1
{
getplayer[THISACTOR].posz mantz
setplayer[THISACTOR].poszv 256
}
}
setvar mantling 0
getactor[THISACTOR].z z
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].sectnum mysector
getactor[THISACTOR].ang angvar
setvar zdist 0
cos mycos angvar
sin mysin angvar
hitscan x y z mysector mycos mysin zdist hitsector hitwall hitsprite hitx hity hitz clipmask
state pythagoras
setvarvar xydist2 xydist // saves the distance
ifvarn hitsprite -1
{
getactor[hitsprite].cstat tempb
ifvarand tempb 32768 break // Skip invisible sprites
ifvarand tempb 1 break // Skip non-solid sprites
getactor[hitsprite].picnum picnum
}
subvar z 1536
hitscan x y z mysector mycos mysin zdist hitsector hitwall2 hitsprite hitx hity hitz clipmask
state pythagoras
ifvarn hitsprite -1
subvar z 4096
setvar hp 10
whilevarn hp 0
{
setvar initcstat 1
hitscan x y z mysector mycos mysin zdist hitsector hitwall hitsprite hitx hity hitz clipmask
state pythagoras
ifvarn hitsprite -1 ifvarl xydist MANTDIST getactor[hitsprite].cstat initcstat
setvarvar xydist2 xydist
subvar z 512 //256
hitscan x y z mysector mycos mysin zdist hitsector hitwall2 hitsprite hitx hity hitz clipmask
state pythagoras
ifvarn hitsprite -1 ifvarl xydist MANTDIST
{
getactor[hitsprite].picnum picnum
ifvarn picnum BGRATE1 ifvarn picnum FANSPRITEBROKE
getactor[hitsprite].cstat initcstat
}
ifvarg xydist2 MANTDIST nullop else
ifvare hitsprite -1 ifvare hitwall -1 nullop else
ifvarn hitwall -1 ifvarvare hitwall hitwall2 nullop else
ifvarand initcstat 1
{
ifvarvarg xydist xydist2
{
setvar mantling 1
ifvare hitsprite -1
setvar mantling 1 else
{
getactor[hitsprite].cstat tempb
ifvarand tempb 32768 nullop else
ifvarand tempb 1 setvar mantling 1
}
}
else ifvarn hitsprite -1
{
ifvare picnum BGRATE1
setvar mantling 1
ifvare picnum FANSPRITEBROKE
setvar mantling 1
}
}
subvar hp 1
ifvare mantling 1 setvar hp 0 //10
subvar z 512 // 256
}
ends
/////////////////////////////////////////////
state mantlingcode
ifvarn onladder 0 { setvar mantling 0 break }
ifvare MANTLING NO break
ifvare DODGING NO break
ifonwater nullop else
ifonwater nullop else
ifvare scaled NO
{
// ifp ponsteroids setvar tempb 901 else
setvar tempb 721
ifvarvare player[THISACTOR].jumping_counter tempb setplayer[THISACTOR].jumping_counter 0
}
ifp ponground ifvare jumped 1 setvar jumped 0
ifvarl mantling 0 addvar mantling 1
ifvare mantling 1 addvar mantwait 1 else setvar mantwait 0
ifvarn onladder 0 { setvar mantling 0 break }
ifvarg dodge 0 { setvar mantling 0 break }
ifvarn holding -1 { setvar mantling 0 break }
ifp pjetpack { setvar mantling 0 break }
ifvare mantling 0 ifvare jumpadxvel 0
{
getplayer[THISACTOR].posx x
getplayer[THISACTOR].posy y
getactor[THISACTOR].z z
getplayer[THISACTOR].cursectnum mysector
ifvare mysector -1 getsector[THISACTOR].floorz mz else
getflorzofslope mysector x y mz // mz is the return var
subvarvar mz z // mz is now the distance to the ground
setvar temp 0
ifvarg mz 6144 setvar temp 1
ifvarg underwater 0
{
ifvarg mz 3072 setvar temp 1
ifvarand bits 1 nullop else setvar temp 0
}
ifvare temp 1
{
getplayer[THISACTOR].poszv zvel
ifvare jumped 1 setvar tempb 0 else setvar tempb 1536
ifvarg underwater 0 setvar zvel 2048
//ifonwater setvar zvel 2048
//ifinwater setvar zvel 2048
ifvarvarg zvel tempb
{
state checkwall
ifvare mantling 1
{
getplayer[THISACTOR].posz mantz
ifvarg underwater 0
setplayer[THISACTOR].sound_pitch 0
sound DUKE_GRUNT
wackplayer
getplayer[THISACTOR].posz z
subvar z 512
setplayer[THISACTOR].posz z
shiftvarr zvel 7
addvar zvel 3
setvarvar mantwaittime zvel
ifvarg mantwaittime 40 setvar mantwaittime 40
}
}
}
}
setplayer[THISACTOR].poszv 256
ifvarg mantling 0
{
ifvare mantling 1 // hanging there, possibly strafing
{
// More controlled horizontal movement during mantle
getplayer[THISACTOR].posxv xvel
getplayer[THISACTOR].posyv yvel
divvar xvel 4 // Even more reduced horizontal movement
divvar yvel 4
setplayer[THISACTOR].posxv xvel
setplayer[THISACTOR].posyv yvel
setplayer[THISACTOR].falling_counter 0
setplayer[THISACTOR].posz mantz
setplayer[THISACTOR].poszv -256 // 0
state checkwall
ifvare mantling 0
{
ifvarg underwater 0 ifvarand bits 1 setvar mantling 2 else
ifvarg mantcheck 0 setvar mantling 1
} else setvar mantcheck 6 // 6 ticks grace period
}
else
{
setplayer[THISACTOR].poszv -1536
getplayer[THISACTOR].ang angvar
cos xvel angvar
sin yvel angvar
mulvar xvel 64
mulvar yvel 64
setplayer[THISACTOR].posxv xvel
setplayer[THISACTOR].posyv yvel
getactor[THISACTOR].z z
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].sectnum mysector
getactor[THISACTOR].ang angvar
setvar zdist 0
cos mycos angvar
sin mysin angvar
hitscan x y z mysector mycos mysin zdist hitsector hitwall hitsprite hitx hity hitz clipmask
state pythagoras
ifvarg xydist 384 ifvarg mantling 5 setvar mantling -10
else
ifvarand bits 1 addvar mantling 1 else setvar mantling -10
ifvarg mantling 23 setvar mantling -10
setplayer[THISACTOR].jumping_toggle 1
}
}
ifvare candodge YES
{
ifvarg dodge 0
{
// More precise dodge velocity reduction
setvarvar xvel jumpadxvel
setvarvar yvel jumpadxvel
mulvar xvel DODGE_IMPULSE_MULTIPLIER
mulvar yvel DODGE_IMPULSE_MULTIPLIER
// Gradual dodge cooldown
addvar dodgeagain 1
ifvarg dodgeagain DODGE_DISTANCE
{
setvar dodge 0
setvar dodgeagain 0
setvar jumpadxvel 0 // Reset jump pad velocity
}
}
}
ends
/////////////////////////////////////////////
Part 5: Codes related to dodge (no hint on how to make this work)
state dodgewallcheck // checks to see if there is a close wall in the actor's path at angvar
getactor[THISACTOR].z z
subvar z 6144
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].sectnum mysector
setvar zdist 0
cos mycos angvar
sin mysin angvar
hitscan x y z mysector mycos mysin zdist hitsector hitwall hitsprite hitx hity hitz clipmask
// temp will be set to 1 if the answer is yes, 0 otherwise
setvar temp 0
ifvarn hitsprite -1
{
getactor[hitsprite].cstat tempb
ifvarand tempb 16 nullop else
break
ifvarand tempb 1 nullop else
}
espawn NOTHING
setactor[RETURN].x hitx
setactor[RETURN].y hity
setactor[RETURN].z hitz
ldist xydist THISACTOR RETURN
// next code gets distance between (x,y) and (hitx,hity), puts result in xydist
ifvarg xydist 512 break
setvar temp 1
ends
/////////////////////////////////////////////
state walljumpcode
{
ifvarn onladder 0 break
setvarvar angvar dodgeang
addvar angvar 1024
state dodgewallcheck
ifvare temp 1
{
addvar walljump 1
addvar runcount 3
getplayer[THISACTOR].falling_counter digz
ifvarg digz 8
{
subvar digz 8
setplayer[THISACTOR].falling_counter digz
setvar dodgeagain 5
}
setvar dodge 7
randvar tempb 3
ifvare tempb 0 sound DUKE_GRUNT
ifvare tempb 1 sound JUMP5 else
ifvare tempb 2 sound JUMP2 else
sound DUKE_GRUNT
}
}
ends
/////////////////////////////////////////////
state dodgecode
ifvarn onladder 0 break
ifvarg dodgeagain 0 subvar dodgeagain 1
setvarvar tempb dodge
ifvarn walljump 0 setvar tempb 0
ifvarn holding -1
{
ifvarg actorvar[holding].weight 40 break
}
ifp palive
ifvare tempb 0
ifvare dodgeagain 0
{
setvar temp 0
ifp ponground ifvare walljump 0 setvar temp 1
ifvare ltap 2
{
getplayer[THISACTOR].ang dodgeang
subvar dodgeang 512
ifvare temp 0 state walljumpcode
}
ifvare rtap 2
{
getplayer[THISACTOR].ang dodgeang
addvar dodgeang 512
ifvare temp 0 state walljumpcode
}
ifvare ftap 2
{
getplayer[THISACTOR].ang dodgeang
ifvare temp 0 state walljumpcode
}
ifvare btap 2
{
getplayer[THISACTOR].ang dodgeang
addvar dodgeang 1024
ifvare temp 0 state walljumpcode
}
}
ifvarg dodge 0
{
cos xvel dodgeang
sin yvel dodgeang
ifvarn jumpadxvel 0
{
mulvarvar xvel jumpadxvel
mulvarvar yvel jumpadxvel
}
else
{
ifvarg superkicking 0
{
ifvare spinkick 1
{
shiftvarl xvel 7
shiftvarl yvel 7
} else
{
ifvarn kicktarg -1
{
ifvarn sprite[kicktarg].statnum 1 setvar kicktarg -1
else
{
getactor[kicktarg].x mx
getactor[kicktarg].y my
subvarvar mx player[THISACTOR].posx
subvarvar my player[THISACTOR].posy
getangle angvar mx my
setplayer[THISACTOR].ang angvar
}
}
shiftvarl xvel 8
shiftvarl yvel 8
}
ifp pducking { divvar xvel 3 divvar yvel 3 }
}
else
{
mulvar xvel 352
mulvar yvel 352
}
ifvarg walljump 0
{
shiftvarr xvel 1
shiftvarr yvel 1
}
}
ifvarg walljump 0
{
setvar zvel -1536
ifvarg walljump 1
{
setvarvar tempb walljump
divvar tempb 2
ifvare tempb 0 setvar tempb 1
divvarvar zvel tempb
}
setplayer[THISACTOR].poszv zvel
}
setplayer[THISACTOR].posxv xvel
setplayer[THISACTOR].posyv yvel
ifvarn jumpadxvel 0
{
setplayer[THISACTOR].falling_counter 0
ifaction PJUMPING nullop else action PJUMPING
}
}
ends
/////////////////////////////////////////////
Part 6: Other codes (the only thing I noticed was the custom Dukeplus sounds while jumping).
onevent EVENT_MOVEFORWARD
setvar fpress 2
ifp prunning setvar runflag 2
setvar forbackdir 2
ifvarg onladder 0 ifp palive
{
setvar RETURN -1
ifp ponground
{
getplayer[THISACTOR].posz z
subvar z 1024
setplayer[THISACTOR].posz z
addvar z 8192
getplayer[THISACTOR].i temp
setactor[temp].z z
setplayer[THISACTOR].jumping_counter 901
}
setvar temp RUNNINGSPEED
divvar temp -50
setvarvar laddervel temp
}
addvar fpresstime 1
ifvarvare timer fpresstime addvar fhold 1 else
{
addvar ftap 1
setvar fhold 0
}
setvarvar fpresstime timer
endevent
/////////////////////////////////////////////
onevent EVENT_MOVEBACKWARD
setvar bpress 2
ifp prunning setvar runflag 2
setvar forbackdir -2
ifvarg onladder 0 ifp palive
{
setvar RETURN -1
setvar temp RUNNINGSPEED
divvar temp 50
subvar temp 512
setvarvar laddervel temp
}
addvar bpresstime 1
ifvarvare timer bpresstime addvar bhold 1 else
{
addvar btap 1
setvar bhold 0
ifvarg ftap 1 setvarvar fpresstime timer
}
setvarvar bpresstime timer
endevent
/////////////////////////////////////////////
onevent EVENT_STRAFELEFT
ifp prunning setvar runflag 2
setvar strafedir -13
addvar lpresstime 1
ifvarvare timer lpresstime addvar lhold 1 else
{
addvar ltap 1
setvar lhold 0
}
setvarvar lpresstime timer
endevent
/////////////////////////////////////////////
onevent EVENT_STRAFERIGHT
ifp prunning setvar runflag 2
setvar strafedir 13
addvar rpresstime 1
ifvarvare timer rpresstime addvar rhold 1 else
{
addvar rtap 1
setvar rhold 0
}
setvarvar rpresstime timer
endevent
/////////////////////////////////////////////
onevent EVENT_TURNAROUND
ifvare backview 0
{
ifvare mantling 1
{
setvar RETURN -1
setvar backview 52
} else
ifvarg onladder 0
{
setvar RETURN -1
setvar backview 52
}
}
endevent
/////////////////////////////////////////////
onevent EVENT_CROUCH
ifvarn sleeping 0 { setvar RETURN -1 break }
endevent
/////////////////////////////////////////////
onevent EVENT_JUMP
setvar cannonid -1
ifvarn sleeping 0 { setvar RETURN -1 break }
ifvarn menutoggle 0 { setvar RETURN -1 break }
ifvarg underwater 0 { setvar RETURN -1 break }
setvar jumped 1
ifvarg numallies 0
{
setvarvar tempd RETURN
getplayer[THISACTOR].posz z
addvar z 4096
setactor[RETURN].z z
setvar ptrailtimer 0
setactorvar[RETURN].mtype 1
setvarvar RETURN tempd
}
ifvarg dodge 0
addvar dodge 10
ifvare dpsounds YES
{
randvar temp 2
ifvare temp 0 sound JUMP5 else
ifvare temp 1 sound JUMP2 else
sound JUMP2
}
endevent
/////////////////////////////////////////////
onevent EVENT_PROCESSINPUT
{
getinput[THISACTOR].bits bits
getinput[THISACTOR].extbits extbits
ifvarn menutoggle 0 { setinput[].svel 0 setinput[].fvel 0 }
ifvarn ONCAR 0 break
ifvarand bits 1 // jumping
{
ifvarg underwater 0 ifvare mantling 0 ifvare onladder 0
{
getplayer[THISACTOR].posz z
addvar z 3072
ifvarvarg z peractor2
{
ifvarand bits 2 nullop else
getplayer[THISACTOR].poszv zvel
subvar zvel 384
ifvarl zvel -1024 setvar zvel -1024
setplayer[THISACTOR].poszv zvel
}
ifp ponground
{
getplayer[THISACTOR].posz z
subvar z 128
setplayer[THISACTOR].posz z
setplayer[THISACTOR].jumping_counter 181
setplayer[THISACTOR].jumping_toggle 1
setvar jumped 1
}
}
ifvare mantling 1 ifvarvarg mantwait mantwaittime setvar mantling 2
ifvarg onladder 0
{
setvar onladder -6
setplayer[THISACTOR].jumping_toggle 1
}
}
ifvarand bits 2 // crouching
{
ifvare mantling 1 setvar mantling -10
ifvarg underwater 0
{
getplayer[THISACTOR].poszv zvel
addvar zvel 640
ifvarg zvel 768 setvar zvel 768
setplayer[THISACTOR].poszv zvel
}
}
}
endevent
I tried to make mantling, ladder and dodge work with this sequence of codes. I just don't know what else to do and it seems that my AI assistant can't go much further than I've already managed, since I've also pulled his ear several times. What's in the code is as similar as possible to what I found in the codes, so I really don't have any clue on how to make these effects work.
In other words, I can't do it alone. I need help and clues!
Does anyone happen to have any separate code regarding these effects, so that I can try to include it in the mod?
I've even tried to make the ladder effect in a different way, involving just a sprite aligned with the wall that, when touching it, the player automatically slides up to the end of the texture, but I couldn't make it work that way either. Unfortunately, I no longer have that version of the code specifically related to this.
That's it! I need help! Can't go further. Too complex and criptic for me to do this alone!