Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 124 Pages +
  • « First
  • 80
  • 81
  • 82
  • 83
  • 84
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Mark 

#2424

an odd con problem. I'm attempting to add this code to prevent self damage in an enemy. For some reason the first { is in the Eduke32 log as a syntax error.
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

0

User is offline   Danukem 

  • Duke Plus Developer

#2425

Try this instead:

ife THISACTOR sprite[].htowner seta[].htextra -1


That would replace all of the code you have above.
1

User is offline   Mark 

#2426

I'll paste it in and see what happens. Thanks.
0

User is offline   Danukem 

  • Duke Plus Developer

#2427

View PostMark, on 31 October 2018 - 11:32 AM, said:

I'll paste it in and see what happens. Thanks.


It should work, but, as in any case where you modify htextra, do so above where ifhitweapon is used.
0

User is offline   Mark 

#2428

YEP
0

User is offline   Mark 

#2429

I hate having to ask for help on something that should be so easy...

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)

  • Attached File  grunt.txt (8.8K)
    Number of downloads: 546


This post has been edited by Mark: 01 November 2018 - 07:44 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#2430

You should be able to insert the line right after the "fall" command -- remember, it doesn't matter where it goes as long as it is part of the main loop and occurs before damage processing.

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.
0

User is offline   Mark 

#2431

He moves around so fast its hard to say for sure but it looks like he tries to back off after tossing the grenade. I'll check the code to see if he does actually move and tweak some numbers. But seeing as how he will throw grenades based only on player distance, he'll be throwing grenades indoors without a lot of movement to get away. I may have to totally rethink that enemy. Thanks.

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

0

User is offline   MC84 

#2432

I've been playing around with projectiles and would like to know how to create a similar effect to the 'swaying' envelopes (tiles 4410-4412) that are spawned when the mailbag (tile 4413) is shot. Basically I want to create a falling leaf/leaves projectile for when the player shoots at trees/foliage. I realise that the envelope sprite is animated but I noticed that the projectile properties must also contain some other info because they move a lot more compared to when I just place the envelope sprite in the game. Thanks
0

User is offline   Danukem 

  • Duke Plus Developer

#2433

I almost answered this the other day, stopped, and then forgot to come back to it. Anyways, I think a projectile is the wrong approach -- making it a projectile doesn't accomplish anything useful and adds more baggage.

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.
0

User is offline   MC84 

#2434

OK Thanks for your advice; I'll sort out the leaf sprite first and then take it from there. Does it have to be 3 frames like the envelope/money animation I'll be overwriting? Or can I use more?
0

User is offline   Mark 

#2435

There are a few mods out there that used the falling leaf feature from Blood or Hexen or whatever game it was originally from. If I could remember which mods I would steer you towards their code.
1

#2436

In my 1v1 mod, I reset both dukes and move their coordinates to their origin when a new round starts, I also use savemapstate once in the beginning and load it every time I reset the round. At random (seems random so far) moments, the opponent duke bot (dummy duke for when my mate aint online) turns invisible on round reset. Again, at some random occasion, the opponent duke turns visible again on round reset. Its coordinates are as they should be, but it's like its cstat is 32767 - even though I've out commented all cstat commands in duke's code at this point. I'm using action PSTAND as well as cstat 257 after resetplayer. I reset the player and then some ticks later I move, PSTAND and cstat him. It could seem that my opponent duke is not in the game at all in some rounds, hence he doesn't take affect of my code, but at this point I'm just wildly guessing. Anything you guys have experienced? Or maybe I should ask how to reset all things (except a "score" variable) to what they were on map start...

This post has been edited by thisbecasper: 07 November 2018 - 12:29 PM

0

User is offline   MC84 

#2437

I've got a real noob question; basically I'm trying to create a breakable voxel (CHAIR_FDCRT) that has 2 stages of breakage.. I can get the voxel to 'break' the first time and load the half-damaged voxel (CHAIR_FDCRTBR) as a replacement, but when I shoot this half-damaged voxel there is no response. However if I place the half-damaged voxel directly into my map it does in fact break down into the completely damaged stage (CHAIR_FDCRTBR2).

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

0

User is offline   Danukem 

  • Duke Plus Developer

#2438

I think it's no longer processing damage because it has negative health. Remember, when you cactor it doesn't do anything but change the picnum of the actor -- if the actor has negative health it will continue to have negative health unless you set it again.

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

0

User is offline   MC84 

#2439

View PostTrooper Dan, on 09 November 2018 - 11:57 PM, said:

Try using "strength 1" in all cases, not just when the weapon is KNEE.


Thanks man, this worked! I will also try your snippet of code to control the damage levels, thanks for that too.
0

User is offline   Zaxtor 

#2440

Is there any codes to emit the nuke button.
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

0

User is offline   Danukem 

  • Duke Plus Developer

#2441

https://wiki.eduke32.../Timebeforeexit
2

User is offline   Zaxtor 

#2442

Worked. thx.
0

User is offline   Perro Seco 

#2443

What if I want to send the player to a secret level? Like Zaxtor, I've been using startlevel until now, but can I do something to show the end of level screen first?
0

User is offline   Zaxtor 

#2444

secret level thing, dunno
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

0

User is offline   Danukem 

  • Duke Plus Developer

#2445

View PostPerro Seco, on 19 November 2018 - 02:01 PM, said:

What if I want to send the player to a secret level? Like Zaxtor, I've been using startlevel until now, but can I do something to show the end of level screen first?


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.
1

User is offline   Mark 

#2446

Trooper Dan: Not quite sure if its the same thing but originally in the HHR ending, if the player had a button pressed when entering the ending sector it bypassed our custom ending animation ( bonus screen ? ) and went straight to the stats screen if you didn't let up the button press fast enough. 266 tried a couple of things including code that required any button presses to let up before progressing but it never worked right. So I changed the ending a bit to compensate.

This post has been edited by Mark: 19 November 2018 - 06:53 PM

0

User is offline   Zaxtor 

#2447

I know Nuke buttons uses a diff pal color like let say pal 14 and lotag using xx instead of xxxxx to go in a more selective level.


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

0

User is offline   Mav3r1ck 

#2448

I was directed here in regards to con coding. I'm continuing from another topic I had recently posted.

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.
0

User is offline   Danukem 

  • Duke Plus Developer

#2449

 Mav3r1ck, on 28 November 2018 - 06:47 PM, said:

I was directed here in regards to con coding. I'm continuing from another topic I had recently posted.

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 { }
0

User is offline   Mark 

#2450

Its embarrassing when I get stuck on what should have been simple code and effect. But here we go again.
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 :rolleyes:

This post has been edited by Mark: 30 November 2018 - 09:07 AM

0

User is offline   Mav3r1ck 

#2451

I noticed that some enemies in the game have a recog sound they use when Duke is first spotted by them. I want to add them in but I don't know where in the code to put them.
0

User is offline   Mark 

#2452

Probably near the "ifcansee" command for that enemy.
0

User is offline   Perro Seco 

#2453

I think it's better to use "ifai 0 sound XXX" in the beginning of the actor code, so they only sound the first time they spot Duke.
0

Share this topic:


  • 124 Pages +
  • « First
  • 80
  • 81
  • 82
  • 83
  • 84
  • Last »
  • 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