Oh damn, it's been awhile since someone last posted in here... I hope I can get a reply for this one.
I have a tough problem with differentiating trails spawned by same kind of projectile. Here's what I'm trying to do :
* I'm trying to have my shotgun have ripper projectiles, the way I made it is similar to a railgun. It's "trails" do the damage, but to prevent from all trails doing damage I make it so that there's a variable to check if the target has taken damage from that set of rail trails. It is set to 0 in a short time so the target can get hit again.
* My problem => My shotgun has pellets and each pellet works in this logic. They spawn invisible trails to do the damage, with some limited range. Even if I'm too far (but still in trail's travel range) and even if one single pellet hits, it deals full damage of all pellets. I want to differentiate the trails of one pellet from those of other pellets, so I can make other pellets deal damage; also disabling the damage factor of all trails behind one of the pellets.
I'm sorry if I couldn't explain it better, but here's my code just in case :
state finishraildamage
getactor[THISACTOR].owner owner //hitsprite
ifvarn owner -1
{
ifvarvarn owner hitsprite // making sure enemy doesn't hit itself
{
getactor[hitsprite].htextra DMG
addvarvar DMG randomvar4
ifvare picnum UFORSAKEN { divvar DMG 4 mulvar DMG 3 } ifvare picnum ZOMBIER { setvar DMG -1 setvar htflag 1405 }
ifvare picnum APLAYER { getplayer[THISACTOR].i ID ifvarvare ID owner { setvar DMG -1 setvar htflag 1405 } }
setactor[hitsprite].htextra DMG
ifactor FUSTRAIL ifvarg DMG -1 { getactor[hitsprite].extra DMG ifvarg DMG 0 sound LASGUNHIT }
setactor[hitsprite].htpicnum htflag
setvar returnvar1 1
}
}
ends
state railhurtcode
ifvarn returnvar1 1
{
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].sectnum TEMP
getactor[THISACTOR].ang TEMPT
sin my TEMPT
cos mx TEMPT
getactor[THISACTOR].z z
getplayervar[THISACTOR].power_up POWERUPMODE
hitscan x y z TEMP mx my 0 hitsect hitwall hitsprite hitx hity hitz CLIPMASK1
ifvarn hitsprite -1
{
getactor[hitsprite].picnum picnum
switch picnum
case LIZTROOP
case CDEMON
case DEVIL
case REVENANT
case DEMON
case CHAINGUNNER
case CHAINGUNNER2
case ZOMBIEPLS
case DOUBLEGUNNER
case TANK
case BOSS1
case BOSS2
case PAINE
case LSOUL
case ENLISTEE
case BLOODSEEKER
case ZCAPTAIN
case SHADE
case IONIMP
case UFORSAKEN
case EXTERMINATOR
case ROBOTGUARD
case CACODEMON
case SHOTGUNZOMBIE
case SENTINEL
case FSPIDER
case APLAYER
case HEAVYTROOPER
case SHADOWSHIELD
case ZOMBIER
case BEAST
case SOULCUBE
case BIGIMP
case BRUISERDEMON
getactorvar[hitsprite].hitbysrail temp3
ifvare temp3 1 nullop else
{
ifactor RIPPERTRAIL
{
setvar randomvar4 0
randvarvar randomvar4 returnvar2 // RANDOM DAMAGE
mulvarvar randomvar4 returnvar3 // MULTIPLIER
ifvare randomvar4 0 setvarvar randomvar4 returnvar4 // MIN DAMAGE
ifvarand POWERUPMODE 16 mulvar randomvar4 2
setvar htflag SHOTGUNRIPPER
state finishraildamage
getactor[hitsprite].x mx
getactor[hitsprite].y my
getactor[hitsprite].z mz
subvar mz 4096
espawn JIBS6
setactor[RETURN].x mx
setactor[RETURN].y my
setactor[RETURN].z mz
setactorvar[hitsprite].hitbysrail 1 // There needs to be a variable for all types of rails, because then all trails would deal damage and it would be immense.
}
}
break
endswitch
}
}
ends
state resetrailstate // Reset the rail stuff as fast as possible
getactorvar[THISACTOR].hitbysrail railtemp
ifvare railtemp 1
{
addvar railcount2 1
ifvarg railcount2 0
{
setvar railcount2 0
setactorvar[THISACTOR].hitbysrail 0
}
}
ends
defineprojectile SHOTGUNRIPPER PROJ_WORKSLIKE 1
defineprojectile SHOTGUNRIPPER PROJ_SOUND -1
defineprojectile SHOTGUNRIPPER PROJ_EXTRA 12
defineprojectile SHOTGUNRIPPER PROJ_TRAIL RIPPERTRAIL
defineprojectile SHOTGUNRIPPER PROJ_TXREPEAT 45
defineprojectile SHOTGUNRIPPER PROJ_TYREPEAT 45
defineprojectile SHOTGUNRIPPER PROJ_TNUM 900
// defineprojectile SHOTGUNRIPPER PROJ_DECAL -1
defineprojectile SHOTGUNRIPPER PROJ_OFFSET 14354
useractor notenemy RIPPERTRAIL TOUGH
cstat 32768
ifvarn countvar 1
{
setvar returnvar2 28
setvar returnvar3 8
setvar returnvar4 16
state railhurtcode
setvar countvar 1
}
else
killit
enda