
EDuke32 Scripting "CON coding help"
#2521 Posted 08 February 2019 - 01:04 PM
#2522 Posted 08 February 2019 - 01:42 PM
This post has been edited by Mark: 08 February 2019 - 01:50 PM
#2523 Posted 08 February 2019 - 01:45 PM
#2524 Posted 08 February 2019 - 01:57 PM

This post has been edited by Mark: 08 February 2019 - 01:58 PM
#2525 Posted 09 February 2019 - 10:24 AM
#2526 Posted 10 February 2019 - 05:59 AM
Mark, on 09 February 2019 - 10:24 AM, said:
Eat lead ? OUAF OUAF !!!

#2527 Posted 17 April 2019 - 11:42 PM
Like changing the limit a bit (depending how you set it)
Default is
299 is looking all the way up and -99 way down.
But making example a new limit in the horiz thing
This post has been edited by Zaxtor: 17 April 2019 - 11:42 PM
#2528 Posted 04 June 2019 - 10:46 AM
It wont work: Each time i select weapon 3 it starts automatically shooting, making impossible to switch weapon or do anything... it just shoots until there is no ammunition left. The everything related to M4 is actually chaingun cannon on the code that i pasted down there. The pistol and its manual reload function works properly, however, chaingun doesn't.
Here is the code for M4
gamevars:
// M4 RELOAD gamevar M4AMMO 0 1 gamevar KICKBACK 0 1 gamevar M4WEAPON 0 1 gamevar M4MAGAZINE 0 1 gamevar PERPLAYER2 0 1 gamevar WEAPON3_CLIP 0 GAMEVAR_PERPLAYER
Here is for the GAME.CON:
actor APLAYER MAXPLAYERHEALTH PSTAND 0 0 getplayer[THISACTOR].ammo_amount PWEAPON M4AMMO // the player's pistol ammo ifvare PWEAPON 3 // if the player has the pistol selected... { ifvarl M4MAGAZINE 1 // and his magazine count is at zero... { getplayer[THISACTOR].weapon_pos PERPLAYER2 ifvarn PERPLAYER2 0 break // if he has a weapon that's lowering off screen, break else ifvarl M4AMMO 1 break else // otherwise, if he has ammo for the pistol, start the reloading anim { setplayer[THISACTOR].reloading 1 setplayer[THISACTOR].kickback_pic 4 } } ifvare KICKBACK 5 // if the reloading animation is on its second frame... { ifvarg M4AMMO 29 // if the player has at least twelve pistol rounds left, setvar M4MAGAZINE 30 // then set his magazine counter to a full magazine else setvarvar M4MAGAZINE M4AMMO // otherwise set the magazine counter equal to his remaining ammo } } onevent EVENT_LOOKLEFT setvar RETURN -1 // disable the event ifvare PWEAPON 3 // if the player has the pistol armed { ifvare M4MAGAZINE 30 // and his magazine is full, break break else ifvarvare M4MAGAZINE M4AMMO // if his magazine is equal to his pistol ammo, break break else // otherwise, start the reloading sequence { setplayer[THISACTOR].reloading 1 setplayer[THISACTOR].kickback_pic 4 } } endevent onevent EVENT_PRESSEDFIRE // when the player presses the fire button... ifvare PWEAPON 3 // and he has the pistol armed... ifvarl M4MAGAZINE 1 setvar RETURN -1 // if his magazine is at zero, disable the firing key endevent onevent EVENT_DISPLAYREST ifvare player[THISACTOR].curr_weapon 3 { digitalnumberz 2930 280 175 M4MAGAZINE 0 0 0 0 0 xdim ydim 50000 // display the magazine count at a slightly smaller size (50000) next to the ammo } endevent onevent EVENT_DOFIRE ifvare PWEAPON 3 // if the player has the pistol selected when he fires a projectile... ifvarg M4MAGAZINE 0 subvar M4MAGAZINE 1 // subtract 1 from the magazine count, unless it's already at zero endevent
Should i also paste the pistol manual reload -code?
#2529 Posted 04 June 2019 - 12:57 PM
Quote
{
getplayer[THISACTOR].weapon_pos PERPLAYER2
ifvarn PERPLAYER2 0
break // if he has a weapon that's lowering off screen, break
else ifvarl M4AMMO 1
break
else // otherwise, if he has ammo for the pistol, start the reloading anim
{
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 4
}
}
Looking at the block I highlighted above: It doesn't do anything to change the conditions leading up to it, so won't it just keep setting kickback_pic to 4 every tic? You probably need to make your own variable to count out your reload sequence, or at least check whether reloading is already non zero before telling it to start a reload.
#2530 Posted 13 June 2019 - 11:55 AM
#2531 Posted 13 June 2019 - 12:21 PM
The downside is that visibility doesn't always mean accessibility -- for example, if one actor sees another through an unbreakable window. So I use hitscan with an appropriate clipmask instead (although that is much harder to set up).
#2532 Posted 16 June 2019 - 05:48 AM
I'm using all Tekwar civilians to bring some life to the urban levels of my TC. One of them includes a shooting animation, so I used it to make her defend against any player attacks, and if you change the sprite palette to 3, she will also attack other civilians randomly. Ideal behaviour for chaotic city levels.


#2533 Posted 30 June 2019 - 07:02 AM
Trooper Dan, on 19 November 2018 - 06:22 PM, said:
Late as always, but I managed to create my own secret level button. This is what I got right now inside its code:
ifpdistl 1024 ifhitspace ifp palive ifp pfacing ifcansee ifvare SECLV 0 { lockplayer 12 setplayer[THISACTOR].timebeforeexit 8 ifvare VOLUME 0 setvar SECLV 5 else ifvare VOLUME 1 setvar SECLV 6 else setvar SECLV 7 }
And inside EVENT_DISPLAYBONUSSCREEN I placed this line:
ifvarn SECLV 0 { setuserdef[THISACTOR].level_number SECLV setvar SECLV 0 }
SECLV is a gamevar that holds the secret level's number. I tried with startlevel after the bonus screen as you suggested, but it didn't work; the level name was correctly shown in the loading screen, but then the loaded level was another different.
#2534 Posted 12 July 2019 - 03:35 PM
This post has been edited by Mark: 12 July 2019 - 03:35 PM
#2535 Posted 12 July 2019 - 03:53 PM
#2536 Posted 12 July 2019 - 06:13 PM
#2537 Posted 12 July 2019 - 08:02 PM
#2538 Posted 13 July 2019 - 04:42 AM
#2539 Posted 28 August 2019 - 11:51 AM
I want to know if there is a code for Eduke32, for manual pistol reload?
If so what are the Eduke32 equivalents of these:
actor APLAYER onevent EVENT_DOFIRE onevent EVENT_TURNAROUND onevent EVENT_RESETPLAYER onevent EVENT_PRESSEDFIRE onevent EVENT_DISPLAYREST
I got confused trying to make the code from "How to manually reload" tutorial work with Eduke32. It works in Duke 3D CON's
#2540 Posted 28 August 2019 - 12:05 PM
Gordon Freeman, on 28 August 2019 - 11:51 AM, said:
The tutorial you refer to: https://wiki.eduke32...manually_reload
IS for EDuke32 already. You've got it backwards -- you can use it in EDuke32 CONs but not in regular Duke 3D CONs.
#2542 Posted 30 August 2019 - 03:15 PM
Can someone post a script example of how to add manual reload to the shotgun, as an example.
Its easier for me to learn by example.
I'm learning, but it is a very slow process...
#2543 Posted 30 August 2019 - 03:52 PM
EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.
This post has been edited by Trooper Dan: 30 August 2019 - 04:01 PM
#2544 Posted 31 August 2019 - 07:39 AM
Trooper Dan, on 30 August 2019 - 03:52 PM, said:
EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.
I want the shotgun to reload after firing 8 rounds. I want the shotgun to stop working after it empties all 8 rounds, until i press the reload key. You don't have to write a new code, I will find it in the AMC TC or DukePlus, and make it work, somehow. Thank you for telling me, and also for help and patience with me.
#2546 Posted 23 November 2019 - 03:16 PM
#2547 Posted 08 January 2020 - 02:26 AM
#2548 Posted 19 January 2020 - 11:51 PM
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.
#2549 Posted 20 January 2020 - 03:28 AM
Mr. Alias Nameless, on 19 January 2020 - 11:51 PM, said:
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.
https://wiki.eduke32...iki/Actioncount
ifactioncount and resetactioncount can be used to do what you want.
#2550 Posted 20 January 2020 - 10:04 AM
For example a golden armor of 200hp, will keep the health always at 100%, until the armor runs out.
Last thing, I would also like to make sure that Duke cannot pick up another armor, until the special armor is used up below 100%.
This post has been edited by Firefly Trooper: 20 January 2020 - 10:13 AM