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

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

  • 85 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 online   Mark 

  • Honored Donor

#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   conoklast 

#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   Trooper Dan 

  • 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   conoklast 

#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 online   Mark 

  • Honored Donor

#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   conoklast 

#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   Trooper Dan 

  • 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   conoklast 

#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   Trooper Dan 

  • 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   Trooper Dan 

  • 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 online   Mark 

  • Honored Donor

#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   Trooper Dan 

  • Duke Plus Developer

#2449

View PostMav3r1ck, 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 online   Mark 

  • Honored Donor

#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 <_<

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 online   Mark 

  • Honored Donor

#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

User is offline   Mav3r1ck 

#2454

Tried both suggestions but no luck.
0

User is offline   Trooper Dan 

  • Duke Plus Developer

#2455

View PostMav3r1ck, on 01 December 2018 - 01:51 PM, said:

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.


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

User is offline   Mav3r1ck 

#2456

View PostTrooper Dan, on 01 December 2018 - 04:41 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.


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

0

User is offline   Perro Seco 

#2457

This works for me:
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

0

User is offline   Mav3r1ck 

#2458

Just used your example for the Overlord and Cycloid. Now I can hear the sounds much louder now. Still trying to figure it out for the Protector Drone and Alien Queen.
0

User is offline   Trooper Dan 

  • Duke Plus Developer

#2459

View PostMav3r1ck, on 01 December 2018 - 07:27 PM, said:

Just used your example for the Overlord and Cycloid. Now I can hear the sounds much louder now. Still trying to figure it out for the Protector Drone


ifai 0
{
    ai AINEWBEASTGETENEMY
    sound NEWBEAST_RECOG
}


View PostMav3r1ck, on 01 December 2018 - 07:27 PM, said:

and Alien Queen.


ifai 0
{
    ai AIBOSS4LAYEGGS
    globalsound BOS4_RECOG
}

0

User is offline   Mav3r1ck 

#2460

Nice! thanks for your help Trooper Dan. :)

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

0

Share this topic:


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


All copyrights and trademarks are property of their respective owners. Instead of reading this text, you could be playing Ion Fury! ;) © 2019 Voidpoint, LLC

Enter your sign in name and password


Sign in options