
EDuke32 Scripting "CON coding help"
#2059 Posted 13 October 2017 - 10:02 AM
Works similar to RPG because when it shoots it autoaim the target (player).
Will bounce a few times and vanish.
Projectile will be destroyed if it hits the player.
For case of RPG you can replace the trail by the "smallsmoke trail"
This post has been edited by Zaxtor: 13 October 2017 - 10:02 AM
#2060 Posted 13 October 2017 - 10:13 AM
Zaxtor, on 13 October 2017 - 10:02 AM, said:
Works similar to RPG because when it shoots it autoaim the target (player).
Will bounce a few times and vanish.
Projectile will be destroyed if it hits the player.
For case of RPG you can replace the trail by the "smallsmoke trail"
Thank you, but i'd like to learn how to do it myself, and understand why this doesn't work

#2061 Posted 14 October 2017 - 08:20 AM
I made the special camera actor, applied the code from the wiki and it works! But there's a problem: when using the camera I still can see the weapon sprite in screen:

Also, the player is in that red X shooting the weapon (that's why it has the red palette), but I can't see the player's sprite. What could be the problem? Do I need to code something more?
#2062 Posted 14 October 2017 - 09:19 AM
Perro Seco, on 14 October 2017 - 08:20 AM, said:
I made the special camera actor, applied the code from the wiki and it works! But there's a problem: when using the camera I still can see the weapon sprite in screen:
Also, the player is in that red X shooting the weapon (that's why it has the red palette), but I can't see the player's sprite. What could be the problem? Do I need to code something more?
The code from the example literally just moves the viewing position and does nothing else. You still have to turn off the hud display, make the player sprite visible (it is normally invisible to the player), etc.
#2063 Posted 14 October 2017 - 02:01 PM
#2064 Posted 14 October 2017 - 03:22 PM
Perro Seco, on 14 October 2017 - 02:01 PM, said:
You could try forcing over_shoulder_on to 1. Normally this would also change the camera position, but since you are already forcing a camera position as well, it might do the job. Don't forget to restore it to the previous value when camera viewing ends. EDIT: To be clear, this isn't necessary the best solution, but I don't remember what is going on with the player sprite that makes it invisible. It might be a tsprite thing.
This post has been edited by Trooper Dan: 14 October 2017 - 03:26 PM
#2065 Posted 14 October 2017 - 11:35 PM
//First try
defineprojectile 1660 PROJ_WORKSLIKE 32774
defineprojectile 1660 PROJ_SPAWNS EXPLOSION2
defineprojectile 1660 PROJ_VEL 1000
defineprojectile 1660 PROJ_EXTRA 300
defineprojectile 1660 PROJ_ISOUND PIPEBOMB_EXPLODE
defineprojectile 1660 PROJ_HITRADIUS 2560
defineprojectile 1660 PROJ_BOUNCES 5
defineprojectile 1660 PROJ_OFFSET 14354
defineprojectile 1660 PROJ_CLIPDIST 24
defineprojectile 1660 PROJ_TRAIL SMALLSMOKE
//Second try
//setprojectile[2605].bounces 32774
//setprojectile[2605].workslike
ofc it wont work because im missing something, but i dont see where. In the DEFS.CON ive changed "define RPG 2605" to "define RPG 1660" for the first try.
bump :')
#2066 Posted 15 October 2017 - 10:18 AM
thisbecasper, on 14 October 2017 - 11:35 PM, said:
In the DEFS.CON ive changed "define RPG 2605" to "define RPG 1660" for the first try.
Yeah don't do that. Leave the hardcoded RPG alone and make yours into a separate tile number. Make sure you have art on the tile you are using, too.
#2067 Posted 15 October 2017 - 10:36 AM
Trooper Dan, on 15 October 2017 - 10:18 AM, said:
How does the weapon (which weapon??) know what projectile to shoot? If I wanted to make the rpg shoot rockets that bounce, how do i do it? I tried it without the change in the DEFS with no luck
#2068 Posted 15 October 2017 - 03:13 PM
thisbecasper, on 15 October 2017 - 10:36 AM, said:
You can re-declare the gamevar that controls which projectile the weapon fires:
gamevar WEAPON4_SHOOTS 1660 1
http://wiki.eduke32....efined_gamevars
#2069 Posted 15 October 2017 - 05:12 PM
Trooper Dan, on 15 October 2017 - 03:13 PM, said:
gamevar WEAPON4_SHOOTS 1660 1
http://wiki.eduke32....efined_gamevars
Thanks! That made me achieve ton of stuff already!
I can't get my burst project to work tho. What I want for now is just a weapon that, with a single tap on the shooting button, shoots a burst of lets say 4 shots in succession and then stops briefly inbetween bursts. I hope to get some clarification on the kickback_pic and totaltime and so. I've read the wikis but i'm missing something... Also: It seems that with this "gamevar WEAPON3_FLAGS xx" that im only adding stuff to the weapon. How do I delete the "WEAPON_RESET" on WEAPON3?
Thanks again for the help!
Last thing: Where are the weapons function defined in the first place? Not in the conf file? I've searched for RPG, WEAPON4, and flags and such, no succes..
This post has been edited by thisbecasper: 15 October 2017 - 05:27 PM
#2070 Posted 15 October 2017 - 07:04 PM
thisbecasper, on 15 October 2017 - 05:12 PM, said:
You'll want to set WEAPON3_SHOTSPERBURST to 4, and probably add AMMOPERSHOT to WEAPON3_FLAGS.
thisbecasper, on 15 October 2017 - 05:12 PM, said:
Declaring the gamevar in your con files will erase the ones already there and only set the flags you name.
thisbecasper, on 15 October 2017 - 05:12 PM, said:
They're hardcoded into the exe.
#2071 Posted 16 October 2017 - 04:11 AM
Hendricks266, on 15 October 2017 - 07:04 PM, said:
Declaring the gamevar in your con files will erase the ones already there and only set the flags you name.
They're hardcoded into the exe.
Thank you once again for the clarification!
#2072 Posted 16 October 2017 - 12:18 PM


And how do I add a new weapon? Like for example the expander that exchanges the shrinker when you switch to shrinker once again. I would like a secondary shotgun..
This post has been edited by thisbecasper: 16 October 2017 - 12:45 PM
#2073 Posted 16 October 2017 - 01:47 PM
#2074 Posted 16 October 2017 - 02:55 PM
onevent EVENT_TURNAROUND setvar WEAPON2_SHOOTS RPG setplayer[THISACTOR].kickback_pic 1 setvar RETURN -1 endevent onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN endevent
#2075 Posted 16 October 2017 - 06:53 PM
Hendricks266, on 16 October 2017 - 02:55 PM, said:
onevent EVENT_TURNAROUND setvar WEAPON2_SHOOTS RPG setplayer[THISACTOR].kickback_pic 1 setvar RETURN -1 endevent onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN endevent
This actually works, although it shoots 7 rockets on top of eachother. This is just a matter of redefining a couple of more things in the first bit of the code I guess. It does only fire in rpg-mode a single time when holding down the fire button, BUT, if you tap the turnaround you can spam the rockets heheh. Thank you for the reply, I learn quite a bit reading code like this :-) Maybe I can continue working on the code myself too..
#2076 Posted 16 October 2017 - 07:01 PM
onevent EVENT_TURNAROUND setvar WEAPON2_SHOOTS RPG ifvare player[].kickback_pic 0 setplayer[].kickback_pic 1 setvar RETURN -1 endevent onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN endevent
#2077 Posted 16 October 2017 - 07:29 PM
Hendricks266, on 16 October 2017 - 07:01 PM, said:
onevent EVENT_TURNAROUND setvar WEAPON2_SHOOTS RPG ifvare player[].kickback_pic 0 setplayer[].kickback_pic 1 setvar RETURN -1 endevent onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN endevent
"GAME.CON: In event `EVENT_TURNAROUND':
GAME.CON:215: error: symbol `player' is not a game array.
GAME.CON:215: error: parameter `.kickback_pic' is undefined.
GAME.CON:215: error: expected a keyword but found `0'.
GAME.CON:216: error: symbol `kickback_pic' is not a game variable.
GAME.CON:216: error: syntax error."
#2079 Posted 16 October 2017 - 07:32 PM
Hendricks266, on 16 October 2017 - 07:30 PM, said:
EDuke32-OldMP (Maintenance Build) Release 9 20120912
- And that's what's causing it. It works on my "normal" Eduke :-) A bit annoying tho, because the stuff I'm trying to make is for multiplayer purposes only :/
This post has been edited by thisbecasper: 16 October 2017 - 07:35 PM
#2080 Posted 16 October 2017 - 07:45 PM
define INPUT_TURN_AROUND 268435456 gamevar temp 0 0 gamevar bits 0 1 onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 endevent onevent EVENT_TURNAROUND setvar RETURN -1 endevent onevent EVENT_PROCESSINPUT getinput[THISACTOR].bits bits endevent onevent EVENT_GAME ifactor APLAYER { ifvarand bits INPUT_TURN_AROUND { ifvare currentweapon SHOTGUN_WEAPON { ifvare weaponcount 0 { getplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON temp ifvarg temp 0 { setvar WEAPON2_SHOOTS RPG setvar WEAPON2_SHOTSPERBURST 1 setplayer[THISACTOR].kickback_pic 1 } } } } } endevent
#2081 Posted 16 October 2017 - 07:54 PM
Hendricks266, on 16 October 2017 - 07:45 PM, said:
define INPUT_TURN_AROUND 268435456 gamevar temp 0 0 gamevar bits 0 1 onevent EVENT_PRESSEDFIRE setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 endevent onevent EVENT_TURNAROUND setvar RETURN -1 endevent onevent EVENT_PROCESSINPUT getinput[THISACTOR].bits bits endevent onevent EVENT_GAME ifactor APLAYER { ifvarand bits INPUT_TURN_AROUND { ifvare currentweapon SHOTGUN_WEAPON { ifvare weaponcount 0 { getplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON temp ifvarg temp 0 { setvar WEAPON2_SHOOTS RPG setvar WEAPON2_SHOTSPERBURST 1 setplayer[THISACTOR].kickback_pic 1 } } } } } endevent
Damn... Thank you so much! Works like a charm.. It even acts exactly as it should now. I just need to know why I need to do this step:
"onevent EVENT_TURNAROUND
setvar RETURN -1
endevent"
- And I guess gamevar bits is used to remember last keypress, if im right?
#2082 Posted 16 October 2017 - 08:05 PM
The bits gamevar is updated with the current state of the keys at all times.
#2083 Posted 16 October 2017 - 08:21 PM
Hendricks266, on 16 October 2017 - 08:05 PM, said:
The bits gamevar is updated with the current state of the keys at all times.
Yep! Just found out myself. I actually made a toggle instead.
define INPUT_TURN_AROUND 268435456 gamevar choice 0 1 onevent EVENT_TURNAROUND setvar RETURN -1 endevent onevent EVENT_TURNAROUND ifvare currentweapon SHOTGUN_WEAPON { ifvare choice 0 { setvar choice 1 } else { setvar choice 0 } } endevent onevent EVENT_PRESSEDFIRE ifvare choice 0 { setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 } else { setvar WEAPON2_SHOOTS RPG setvar WEAPON2_SHOTSPERBURST 1 } endevent
Although it doesn't work when I add the RETURN -1 bit. I guess it wont let the next onevent EVENT_TURNAROUND get executed. I think I would have to use the "bits" var like you did! But thanks for the help!
This post has been edited by thisbecasper: 16 October 2017 - 08:22 PM
#2084 Posted 16 October 2017 - 11:39 PM
thisbecasper, on 16 October 2017 - 08:21 PM, said:
It should work. You don't need two different declarations of the same event; I wonder if that's related.
thisbecasper, on 16 October 2017 - 08:21 PM, said:
The value of RETURN is not saved; it is constantly getting set to different values by various events and such.
#2085 Posted 17 October 2017 - 05:10 AM
Trooper Dan, on 16 October 2017 - 11:39 PM, said:
Thanks! That was what caused it.
#2086 Posted 17 October 2017 - 07:05 AM
define INPUT_TURN_AROUND 268435456 gamevar SHOTGUNAMMO 0 1 gamevar choice 0 1 onevent EVENT_TURNAROUND { setvar RETURN -1 ifvare choice 0 { setvar choice 1 sound SELECT_WEAPON quote 34 } else { setvar choice 0 sound SHOTGUN_COCK quote 35 } } endevent onevent EVENT_PRESSEDFIRE { ifvare choice 0 { setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 setvar WEAPON2_FIRESOUND SHOTGUN_FIRE setvar WEAPON2_FLAGS 1024 } else { ifvarl SHOTGUNAMMO 10 { setvar choice 0 quote 40 sound SHOTGUN_COCK } setvar WEAPON2_SHOOTS 1092 setvar WEAPON2_SHOTSPERBURST 10 setvar WEAPON2_FIRESOUND PISTOL_RICOCHET setvar WEAPON2_FLAGS 17472 } } endevent
Also the sound won't update accordingly between "weapon-switch".
#2087 Posted 17 October 2017 - 08:09 AM
What is that SHOTGUNAMMO variable? I suspect you don't need it.
#2088 Posted 17 October 2017 - 12:05 PM
Hendricks266, on 17 October 2017 - 08:09 AM, said:
What is that SHOTGUNAMMO variable? I suspect you don't need it.
Thank you for the help. I've got it to work now like this:
gamevar SHOTGUNAMMO 0 1 gamevar choice 0 1 gamevar PWEAPON 0 1 onevent EVENT_TURNAROUND { setvar RETURN -1 ifvare PWEAPON 2 { ifvare choice 0 { ifvarl SHOTGUNAMMO 10 { quote 36 break } setvar choice 1 sound SELECT_WEAPON setvar WEAPON2_SHOOTS 1092 setvar WEAPON2_SHOTSPERBURST 10 setvar WEAPON2_FIRESOUND PISTOL_RICOCHET setvar WEAPON2_FLAGS 17472 quote 34 } else { setvar choice 0 sound SHOTGUN_COCK setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 setvar WEAPON2_FIRESOUND SHOTGUN_FIRE setvar WEAPON2_FLAGS 1024 quote 35 } } } endevent onevent EVENT_DOFIRE { ifvare PWEAPON 2 { ifvare choice 1 { ifvarl SHOTGUNAMMO 10 { setvar choice 0 sound SHOTGUN_COCK setvar WEAPON2_SHOOTS SHOTGUN setvar WEAPON2_SHOTSPERBURST 7 setvar WEAPON2_FIRESOUND SHOTGUN_FIRE setvar WEAPON2_FLAGS 1024 quote 40 } } } } endevent
I think I need the var SHOTGUNAMMO inorder to keep track of current ammo of the shotgun?. Can I do it without the var and without causing an out-of-sync error? I've btw also managed to get rid of the out-of-sync thing - I still don't see the big difference between using a var like I do to keep track of the players current weapon and a call to currentweapon, which was what caused it..
This post has been edited by thisbecasper: 17 October 2017 - 12:11 PM