
EDuke32 Scripting "CON coding help"
#2424 Posted 31 October 2018 - 07:59 AM
getactor[THISACTOR].htextra NODAMAGE
ifvarg NODAMAGE 0
{
getactor[THISACTOR].htowner NODAMAGE
ifvarvare NODAMAGE THISACTOR
setactor[THISACTOR].htextra 0
}
This post has been edited by Mark: 31 October 2018 - 08:00 AM
#2425 Posted 31 October 2018 - 10:22 AM
ife THISACTOR sprite[].htowner seta[].htextra -1
That would replace all of the code you have above.
#2427 Posted 31 October 2018 - 11:51 AM
Mark, on 31 October 2018 - 11:32 AM, said:
It should work, but, as in any case where you modify htextra, do so above where ifhitweapon is used.
#2429 Posted 01 November 2018 - 07:42 AM
Hey TD ( or someone else ). If you don't have time for this, thats OK. The code for this enemy has the AI, actions, states, etc... jumbled in an order I'm not used to. Its making it tough for me to figure out where to add your line of code. Its supposed to be sandwiched in between the useractor declaration and the ifhitweapon statement. Useractor is the last line of that actor's code and because of the order of the states and other things I haven't been able to figure out how to proceed. I can't just move that useractor line up farther because states for it haven't been declared yet and I get errors. Hopefully a simple solution but I'm not seeing it.
Could you take a quick look? Thanks.
Attached File(s)
-
grunt.txt (8.8K)
Number of downloads: 546
This post has been edited by Mark: 01 November 2018 - 07:44 AM
#2430 Posted 01 November 2018 - 09:09 AM
Looking at the code, though, I don't see how this approach can help. The actor attacks by either shooting hitscan (in which case it can't hit itself), or by spawning a grenade actor, in which case the resulting self-damage is going to be a hitradius with no discernible owner, or will be owned by the grenade sprite, not the grunt who spawned the grenade. So even if you negate self-damage, it won't help against the grenade. It might be easier and more satisfying at this point to focus on making the grunt move out of the way of grenades, rather than making them not take damage from them.
#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