Duke4.net Forums: shells that don't disappear - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

shells that don't disappear

User is offline   11bush 

#1

I'm just trying to figure out how to spawn a shell sprite on the ground when the spent casing lands. any help would be appreciated,
0

User is offline   RPD Guy 

#2

View Post11bush, on 30 September 2019 - 07:53 PM, said:

I'm just trying to figure out how to spawn a shell sprite on the ground when the spent casing lands. any help would be appreciated,


Well, you can just check when the default game's shells spawn (at EVENT_EGS), killit and then spawn your own shell.

onevent EVENT_EGS {
    switch sprite[THISACTOR].picnum 
        case SHOTGUNSHELL
            <spawn here>
        break
        case SHELL
            <spawn here>
        break
    endswitch
endevent


To spawn your own shell, I believe you can SHOOT a projectile.
1

User is offline   Danukem 

  • Duke Plus Developer

#3

Here, just paste this into GAME.CON at the bottom of the file.
var VAR1 0 0

appendevent EVENT_GAME

switch sprite[].picnum
	case SHELL
	case SHOTGUNSHELL
		getflorzofslope sprite[].sectnum sprite[].x sprite[].y VAR1
		sub VAR1 sprite[].z
		ifl VAR1 512
		ifg sprite[].statnum 2
		{
			changespritestat THISACTOR 1
			cstat 32
			rand VAR1 256
			sub VAR1 128
			add VAR1 sprite[].ang
			seta[].ang VAR1
			fall
		}
	break
endswitch

endevent


You can add a sound in the block of code that changes the statnum and such. It uses the default movement, and shells will be deleted before hitting the ground if they bump into something first. Making them flat (cstat 32) is something I started doing a while back and it's a great for a small sprite on the ground because it allows for different angles.
2

User is offline   11bush 

#4

Thanks alot for the help, but for some reason I can't get it to work. maybe I just don't know what the hell I'm doing.
0

User is offline   11bush 

#5

Nm it works perfectly. I was trying to add it to the platoon mod as I am working on replacing all the weapons for that. I tried it in the original Duke and it works great. Thanks again!
0

User is offline   RPD Guy 

#6

View PostRPD Guy, on 01 October 2019 - 03:16 AM, said:

Well, you can just check when the default game's shells spawn (at EVENT_EGS), killit and then spawn your own shell.

onevent EVENT_EGS {
    switch sprite[THISACTOR].picnum 
        case SHOTGUNSHELL
            <spawn here>
        break
        case SHELL
            <spawn here>
        break
    endswitch
endevent


To spawn your own shell, I believe you can SHOOT a projectile.


It's been a long time, but back there I wasn't so experient at CON coding. (Actually I'm still learning :lol:)

This is my reparation with the community for teaching bad things.

You shouldn't kill any actor during EVENT_EGS. Use EVENT_GAME instead (as Danuken said right after me).
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options