
EDuke32 Scripting "CON coding help"
#2431 Posted 01 November 2018 - 10:32 AM
EDIT: I found and adjusted down the blast radius of the grenade and doubled the amount for enemy backpedaling after throwing the grenade. It worked better outdoors, not perfect, but indoors its still less than a 40 percent chance they can flee the blast. Much better than almost no escape indoors or out but not acceptable.
I'll see if using the ifoutside command will be a decent compromise to make them throw grenades only under a skybox.
This post has been edited by Mark: 01 November 2018 - 11:38 AM
#2432 Posted 03 November 2018 - 11:16 PM
#2433 Posted 07 November 2018 - 03:38 AM
I believe the easiest solution is to simply spawn the envelopes using the mail command (or spawn paper money with cash -- it will make no difference), and then hack the displayed sprites to look like your leaf sprites. This assumes your leaf art is already in game somewhere. There are several steps needed to make this work, which I can help with if need be. But the basic idea is you use EVENT_ANIMATESPRITES to change what is displayed by the envelope sprite so it shows your leaf tile instead, even though it is still really an envelope.
#2434 Posted 07 November 2018 - 03:50 AM
#2435 Posted 07 November 2018 - 05:47 AM
#2436 Posted 07 November 2018 - 09:53 AM
This post has been edited by thisbecasper: 07 November 2018 - 12:29 PM
#2437 Posted 09 November 2018 - 11:16 PM
useractor notenemy CHAIR_FDCRT cstat 2305 sizeat 19 17 ifhitweapon { ifwasweapon KNEE strength 1 else { sound VENT_BUST debris SCRAP1 3 cactor CHAIR_FDCRTBR } } enda useractor notenemy CHAIR_FDCRTBR cstat 2305 sizeat 19 17 ifhitweapon { sound VENT_BUST debris SCRAP1 3 cactor CHAIR_FDCRTBR2 } enda
#2438 Posted 09 November 2018 - 11:57 PM
Try using "strength 1" in all cases, not just when the weapon is KNEE.
EDIT To follow up on that, here is part of the source code for the IncurDamage function:
if (pActor->extra < 0 || pSprite->extra < 0 || pActor->picnum < 0) { pActor->extra = -1; return -1; }
pActor->extra is the damage to be processed, and pSprite->extra is the health of the actor. So what that code says is, if the actor has negative damage, or negative health, or a negative picnum, then negate the damage and abort the function.
This post has been edited by Trooper Dan: 10 November 2018 - 12:14 AM
#2439 Posted 10 November 2018 - 12:47 AM
Trooper Dan, on 09 November 2018 - 11:57 PM, said:
Thanks man, this worked! I will also try your snippet of code to control the damage levels, thanks for that too.
#2440 Posted 18 November 2018 - 10:38 PM
not for the animation but the ending level behavior
that you get the (end level clearing such as amount of kills, time, secrets) you know the stuff you get if you do the Sec lotag 65535 or nuke button (sale lo lag) or other for secret maps etc
I know we have the "startlevel xx xx" but downside of startlevel is you don't get the level ending mentioned above.
This post has been edited by Zaxtor: 18 November 2018 - 10:39 PM
#2443 Posted 19 November 2018 - 02:01 PM
#2444 Posted 19 November 2018 - 04:32 PM
the code is for let say you finish E1L1 and brings you to E1L2.
There is a delay you can put.
let say "setplayer[THISACTOR].timebeforeexit 30" for 1 sec before level ends.
You could even use that for a "bonus level" haven't tried that yet... Maybe in future mod may try that.
That you put "setplayer[THISACTOR].timebeforeexit 3000" so you have 100 seconds before bonus level auto ends.
Like you get as many items, coins etc as possible
This post has been edited by Zaxtor: 19 November 2018 - 04:32 PM
#2445 Posted 19 November 2018 - 06:22 PM
Perro Seco, on 19 November 2018 - 02:01 PM, said:
You could always use startlevel after the bonus screen, right as the game is about to load the next regular level.
As an alternative to timebeforeexit, I think you can also just change the lotag of the sector that the player is standing in, making it a sector exit. Speaking of that, has anyone encountered a bug where sector exits skip the bonus screen? I've had that happening but didn't say anything until now.
#2446 Posted 19 November 2018 - 06:36 PM
This post has been edited by Mark: 19 November 2018 - 06:53 PM
#2447 Posted 19 November 2018 - 06:48 PM
There could be exploits and tricks to make you goto secret levels by using a non-nuke button method without sacrificing end level clearing.
Kinda a var trick that in the next level (level 2) instead of starting to the normal beginning it places the player in another sector of level 2 (by a var you set at the level 1} with thing that brings you to secret level.
like in a different sector of level2 you put that startlevel thing
Without sacrificing the end level time, kills, secrets etc when you beat level 1 from secret way instead of normal way.
My mod Trequonia has a similar thing.
if you take the alternate route of Level 1, you start at different position of level 2 instead of normal starting point.
This post has been edited by Zaxtor: 19 November 2018 - 06:48 PM
#2448 Posted 28 November 2018 - 06:47 PM
onevent EVENT_GAME ifspawnedby APLAYER ifactor RPG spawn SMALLSMOKE sizeat 7 7 endevent
If I'm correct, this code is telling the game that Duke will fire the RPG with a thin smoke trail. The goal was to have it to where the Devastator rockets fired with a thin smoke trail. However, this will cause the larger rockets fired by the RPG to also have thin smoke trails. I'm trying to get it to where the Devastator will fire rockets with thinner smoke trails while the RPG fires rockets with the default smoke trails it comes with.
#2449 Posted 29 November 2018 - 09:08 AM
Mav3r1ck, on 28 November 2018 - 06:47 PM, said:
onevent EVENT_GAME ifspawnedby APLAYER ifactor RPG spawn SMALLSMOKE sizeat 7 7 endevent
If I'm correct, this code is telling the game that Duke will fire the RPG with a thin smoke trail. The goal was to have it to where the Devastator rockets fired with a thin smoke trail. However, this will cause the larger rockets fired by the RPG to also have thin smoke trails. I'm trying to get it to where the Devastator will fire rockets with thinner smoke trails while the RPG fires rockets with the default smoke trails it comes with.
Some changes:
appendevent EVENT_GAME ifactor RPG ifspawnedby APLAYER ife sprite[].xrepeat 7 { espawn SMALLSMOKE seta[RETURN].xrepeat 7 seta[RETURN].yrepeat 7 } endevent
Use "appendevent" because that will ensure it adds code to the event even if there are "onevent" or "appendevent" for it elsewhere. Note I am checking the size of the rocket. Rockets fired by the devistator are 7x7, and no other rockets in the game are that size. You don't even need the "ifspawnedby APLAYER" because the size should pick them out even without that. Super important: In CON, indenting does nothing, it's just for readability. So in your code, your "sizeat 7 7" was setting size on the RPG that is running the code, not on your spawned smoke. To set it on the thing you are spawning, you can use "espawn" which sets RETURN as the handle on the new sprite. Then you explicitly set size on the x/y repeat of the target sprite. Also note my use of { }
#2450 Posted 30 November 2018 - 08:45 AM
I created a working swing door with activator set to lotag 222. In my code there are a series of quotes displayed and sounds played for a short scripted conversation. Nothing special. Print quote, play sound, change spritepal and then repeat a number of times. It all works fine. Then in the final quote/sound ( shown below ) I also added "activate 222" so that the door would open after the quote and sound plays. But what happens is after the sound and quote play, the code loops on the activate and will proceed no further. Without "activate 222" the code continues along fine.
I'm evidently misunderstanding the activate command.
else ifspritepal 13
{
ifcount 90
{
sound SCORPBOSS5
quote 137
activate 222
resetcount
spritepal 14
}
}
EDIT: I found the problem. The wiki states that "activate" is the same but older version of " operateactivators". I changed to "operateactivators 222 0" instead and things are fine. If "activate" no longer works or needs something else for it to function the wiki should show that. GAH

This post has been edited by Mark: 30 November 2018 - 09:07 AM
#2451 Posted 01 December 2018 - 01:51 PM
#2453 Posted 01 December 2018 - 03:09 PM
#2455 Posted 01 December 2018 - 04:41 PM
Mav3r1ck, on 01 December 2018 - 01:51 PM, said:
This problem was addressed recently when Firefly_trooper asked about it in one of his threads (not sure which). What's happening is some recog sounds are hardcoded to play when certain of the original enemies become activated (such as PIGCOP). I don't know why they made it that way, but they did. So, the sounds are not being triggered by anything in the CON code.
As for adding new ones, the suggestions above should work fine. Just play the sound when the enemy becomes active.
#2456 Posted 01 December 2018 - 05:04 PM
Trooper Dan, on 01 December 2018 - 04:41 PM, said:
As for adding new ones, the suggestions above should work fine. Just play the sound when the enemy becomes active.
Yeah, I know the orginal stuff was hardcoded when I didn't seen any other recog sounds for the orginal enemies. I know what to do when adding the Recog sounds in the game.con but the problem is I don't know where exactly in the code to actually place it.
{ ifspritepal 0 sound BOS2_RECOG ai AIBOSS2RUNENEMY else {
I did this so that the Cycloid will make a recog sound when facing Duke at the Stadium. with my limited knowledge of the game.con I decided to look through the NEWBEAST code for example to find a part of the code that resembled the Cycloid's to put it's recog sound in but to no avail. I know the recog sound needs to go in the part where it becomes active but I'm at a loss here. The enemies I'm looking to put this sound for is the Alien Queen and Protector Drone.
This post has been edited by Mav3r1ck: 01 December 2018 - 05:05 PM
#2457 Posted 01 December 2018 - 05:25 PM
ifai 0 { globalsound XXX ifspritepal 0 ai AIBOSS2RUNENEMY else { strength 1 sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY } }
I used globalsound to make it be heard everywhere. With sound you need to be very close to the Cycloid to hear it.
This post has been edited by Perro Seco: 01 December 2018 - 05:27 PM
#2458 Posted 01 December 2018 - 07:27 PM
#2459 Posted 02 December 2018 - 05:14 AM
Mav3r1ck, on 01 December 2018 - 07:27 PM, said:
ifai 0 { ai AINEWBEASTGETENEMY sound NEWBEAST_RECOG }
Mav3r1ck, on 01 December 2018 - 07:27 PM, said:
ifai 0 { ai AIBOSS4LAYEGGS globalsound BOS4_RECOG }
#2460 Posted 02 December 2018 - 05:37 AM

EDIT: And I put that at the beginning of state newbeastcode and state boss4code correct?
This post has been edited by Mav3r1ck: 02 December 2018 - 06:35 AM