// ***************************** // * Flashlight code by Darkus * // ***************************** // 1st method (workaround) // To make it work, you must place in your map a SECTOREFFECTOR with // a lotag of 50 and a pal of 10. Otherwise it will not work. include GAME.CON definegamefuncname 36 Flashlight gamevar temp 0 0 gamevar temp2 0 0 gamevar getpal 0 0 gamevar xpos 0 0 gamevar ypos 0 0 gamevar zpos 0 0 gamevar flangle 0 0 gamevar flhoriz 0 0 gamevar flx 0 0 gamevar fly 0 0 gamevar isflashlight -1 0 gamevar flashlighton 0 0 // First, find a SECTOREFFECTOR with lotag of 50 and // pal of 10 that will be assigned as flashlight onevent EVENT_LOADACTOR getactor[THISACTOR].picnum temp switch temp case SECTOREFFECTOR getactor[THISACTOR].lotag temp2 ifvare temp2 50 { getactor[THISACTOR].pal getpal ifvare getpal 10 { setvarvar isflashlight THISACTOR setactor[isflashlight].pal 0 setactor[isflashlight].hitag 0 // Light range (start desactivated) setactor[isflashlight].xvel 255 // Red color setactor[isflashlight].yvel 255 // Green color setactor[isflashlight].zvel 255 // Blue color setactor[isflashlight].shade 48 // Light width setactor[isflashlight].owner -1 // This is supposed to cast the choosen tilenum instead of regular light. setactor[isflashlight].statnum 14 // The light will follow the SE. Otherwise it will not work. } } break endswitch endevent // Stick the SE on player onevent EVENT_GAME ifvarg isflashlight -1 { getplayer[THISACTOR].posx xpos getplayer[THISACTOR].posy ypos getplayer[THISACTOR].posz zpos getplayer[THISACTOR].horiz flhoriz getplayer[THISACTOR].ang flangle addvar zpos 2048 // Gives the 'right handed' effect setvarvar temp xpos addvar temp 96 addvar flangle 384 // right handed // addvar flangle 1664 // left handed rotatepoint xpos ypos temp ypos flangle flx fly subvar flangle 384 // right handed // subvar flangle 1664 // left handed setactor[isflashlight].x flx setactor[isflashlight].y fly setactor[isflashlight].z zpos updatesectorz flx fly zpos temp2 ifvarg temp2 -1 setactor[isflashlight].sectnum temp2 setactor[isflashlight].extra flhoriz setactor[isflashlight].ang flangle } endevent // Toggle by 'Flashlight' key onevent EVENT_TURNAROUND setvar RETURN -1 ifvarg isflashlight -1 { ifvare flashlighton 0 { setactor[isflashlight].hitag 7000 // Light range 0-65535 setvar flashlighton 1 } else ifvare flashlighton 1 { setactor[isflashlight].hitag 0 // light off setvar flashlighton 0 } } endevent /* // MAP CACHING // savemapstate // loadmapstate // clearmapstate var // lotag 69 SE two-way HUB transporter // lotag 70 SE destination only HUB // transporters go to another with the same hitag // pal = the level number it takes you to (starts at 0) // shade 10 SEs are send only (they are not destinations) // extra 1 SEs do not use coordinate offsets include GAME.CON definevolumename 4 HUB TEST definelevelname 4 0 hub1.map 03:04 01:32 SECTION 1 definelevelname 4 1 hub2.map 04:00 02:00 SECTION 2 definelevelname 4 2 hub3.map 03:30 01:45 SECTION 3 definelevelname 4 3 hub4.map 06:32 03:16 SECTION 4 gamevar lotag 0 2 gamevar hitag 0 2 gamevar act1 0 2 gamevar pdestination -1 131073 gamevar WAIT 0 2 gamevar mysector 0 2 gamevar temp 0 0 gamevar tempb 0 0 gamevar picnum 0 0 gamevar playerwait 0 131073 gamevar pang 0 131073 gamevar xoff 0 131073 gamevar yoff 0 131073 gamevar zoff 0 131073 gamevar savekeys 0 131073 eventloadactor SECTOREFFECTOR getactor[THISACTOR].lotag lotag getactor[THISACTOR].hitag hitag getactor[THISACTOR].sectnum mysector getactor[THISACTOR].extra act1 enda state SEHUBSTATE ifvare WAIT YES // wait for the player to leave the sector before re-activating break // don't change maps if this map just loaded // this avoids problem caused by scroll lock being placed in a map changing sector getplayer[THISACTOR].player_par temp ifvarl temp 4 break // don't change maps if the player is at the edge of the sector // this avoids problem of the player going back and forth between maps with slight movement getplayer[THISACTOR].cursectnum tempb getplayer[THISACTOR].posx xoff getplayer[THISACTOR].posy yoff addvar xoff 128 addvar yoff 128 updatesector xoff yoff temp ifvarvarn tempb temp break subvar xoff 256 updatesector xoff yoff temp ifvarvarn tempb temp break subvar yoff 256 updatesector xoff yoff temp ifvarvarn tempb temp break addvar xoff 256 updatesector xoff yoff temp ifvarvarn tempb temp break getactor[THISACTOR].shade temp ifvare temp 10 { setvar xoff 0 setvar yoff 0 setvar zoff 0 } else { getactor[THISACTOR].x temp getplayer[THISACTOR].posx xoff subvarvar xoff temp getactor[THISACTOR].y temp getplayer[THISACTOR].posy yoff subvarvar yoff temp getactor[THISACTOR].z temp getplayer[THISACTOR].posz zoff addvar zoff 8192 subvarvar zoff temp ifvare act1 1 { setvar xoff 0 setvar yoff 0 setvar zoff 0 } } setvarvar pdestination hitag getactor[THISACTOR].pal temp setvar playerwait 2 getplayer[THISACTOR].ang pang getplayer[THISACTOR].got_access savekeys savemapstate startlevel VOLUME temp ends onevent EVENT_GAME ifvarn pdestination -1 ifactor APLAYER { setplayer[THISACTOR].ang pang setplayer[THISACTOR].look_ang 0 subvar playerwait 1 ifvarl playerwait 1 { loadmapstate setvar temp 0 whilevarn temp 16384 { getactor[temp].statnum tempb ifvare tempb 4 { changespritestat temp 1 setactor[temp].picnum SMALLSMOKE setactor[temp].cstat 32768 } getactor[temp].picnum picnum ifvare picnum SMALLSMOKE setactor[temp].cstat 32768 addvar temp 1 } setvar temp 0 whilevarn temp 16384 { getactor[temp].picnum picnum ifvare picnum SECTOREFFECTOR { getactor[temp].statnum tempb getactor[temp].lotag lotag ifvarg lotag 68 ifvarl lotag 71 ifvarn tempb 1024 { getactor[temp].hitag hitag getactor[temp].shade tempb ifvarvare hitag pdestination ifvarn tempb 10 { setactorvar[temp].WAIT YES getplayer[THISACTOR].i picnum getactor[temp].x tempb addvarvar tempb xoff setplayer[THISACTOR].posx tempb setactor[picnum].x tempb getactor[temp].y tempb addvarvar tempb yoff setplayer[THISACTOR].posy tempb setactor[picnum].y tempb getactor[temp].z tempb addvarvar tempb zoff setactor[picnum].z tempb subvar tempb 8192 setplayer[THISACTOR].posz tempb getactor[temp].sectnum tempb setplayer[THISACTOR].cursectnum tempb changespritesect picnum tempb setplayer[THISACTOR].knuckle_incs 0 setplayer[THISACTOR].kickback_pic 0 setplayer[THISACTOR].got_access savekeys setvar temp 16383 } } } addvar temp 1 } setvar pdestination -1 } } ifactor SECTOREFFECTOR ifvare lotag 69 { getplayer[THISACTOR].cursectnum temp ifvarvare temp mysector state SEHUBSTATE else setvar WAIT NO } endevent */