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
  • 79
  • 80
  • 81
  • 82
  • 83
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   Trooper Dan 

  • Duke Plus Developer

#2401

damageeventtilerange 5879 5880
damageeventtilerange 6829 6843
damageeventtilerange 6876 6885
damageeventtilerange 6887 6890
damageeventtilerange 8497 8500

onevent EVENT_DAMAGEWALL

ife wall[RETURN].picnum BLUEBALLVEND 
{ sound VENT_BUST sound GLASS_BREAKING lotsofglass 20 setw[RETURN].picnum BLUEBALLBROKE }
ife wall[RETURN].picnum SNACKVEND 
{ sound VENT_BUST sound GLASS_BREAKING lotsofglass 20 setw[RETURN].picnum SNACKBROKE }

ife wall[RETURN].picnum 6829 setw[RETURN].picnum W_TECHWALL1
ife wall[RETURN].picnum 6832 setw[RETURN].picnum W_TECHWALL2
ife wall[RETURN].picnum 6835 setw[RETURN].picnum W_TECHWALL15
ife wall[RETURN].picnum 6838 setw[RETURN].picnum W_TECHWALL4
ife wall[RETURN].picnum 6841 setw[RETURN].picnum W_TECHWALL16

ifge wall[RETURN].picnum 6876 ifle wall[RETURN].picnum 6890
{
	sound VENT_BUST sound GLASS_BREAKING lotsofglass 15 setw[RETURN].picnum 7445
}
ifge wall[RETURN].picnum 8497 ifle wall[RETURN].picnum 8500
{
	sound VENT_BUST sound GLASS_BREAKING lotsofglass 15 setw[RETURN].picnum 7445
}  

endevent


Ok, this is a little messy, but I've pasted in the relevent code from Alien Armageddon so you can see how to do it. First, outside of any actors or events, you use the damageeventtilerange command to specify tile numbers that will be processed in EVENT_DAMAGEWALL.

In the event itself, RETURN is the wall number being hit by a weapon. The event code tells the game what to do when RETURN is hit. Notice in every case I am changing the picnum of the wall to the damaged version. In between, there is often some code spawning debris and such.

In some cases, I just changed the picnum to one of the hardcoded ones -- doing that will cause the wall to behave just like you had shot one of the hardcoded destructible ones, which is appropriate if the art on your custom tile fits.
3

User is offline   conoklast 

#2402

Cool! Thank you - I'll have a play with it and see how I go!

*update* I managed to get it to work. Now I also wanted to add an extra if statement, so that the actor would only be destroyed by explosions, and not by bullets..

I tried a few different variations, and some would compile, however they wouldn't respond to the explosion..

define OFFICEWALL1 7684
define OFFICEWALL1BR 7687

damageeventtilerange 7684 7686

onevent EVENT_DAMAGEWALL
{
 ifwasweapon RADIUSEXPLOSION
 ife wall[RETURN].picnum OFFICEWALL1 
{ sound VENT_BUST sound GLASS_BREAKING lotsofglass 20 setw[RETURN].picnum OFFICEWALL1BR }
}
endevent


This post has been edited by conoklast: 16 October 2018 - 01:38 AM

0

User is online   Sanek 

#2403

I love when you ask a question here, don't get an answer, then somebody else asks a question and get it right away. <_<
0

User is offline   conoklast 

#2404

View PostSanek, on 16 October 2018 - 02:04 AM, said:

I love when you ask a question here, don't get an answer, then somebody else asks a question and get it right away. <_<


Beginner's luck? Don't worry I'm sure the CON coding pros will get sick of my noob questions :rolleyes:
0

User is online   Trooper Dan 

  • Duke Plus Developer

#2405

View PostSanek, on 14 October 2018 - 03:45 AM, said:

I need a one-line, one-time message that will appear on the screen when player enter the room. What is the most effortless way to make it? Can it be tied to a sound?
I'm speaking of the small messages that appear in the upper half of the screen.


The most effortless way to do this is to make an invisible sprite that detects whether the player is in the same sector with it (ife sprite[].sectnum player[].cursectnum), and then displays the quote, plays a global sound, and dies when the detection is true (quote # globalsound # killit)
1

#2406

Good evening! I have a question, for a line of code based on "onevent" and gamevar.

I have a problem of recognition for a sound, linked to a monster. The sound is sometimes inactive for certain actions and is absolutely not played during a nearby explosion (with an RPG).
I would like to make a powerful code so that this sound is played all the time.

Is this line correct?

Gamevar
onevent EVENT_SOUND
switch sprite[THISACTOR].picnum
Ifvare Return 34
Ifactor LIZTROOP
endevent

The sound is "SQUISHED"
With a code like this, I think to solve the problem, so that this sound can be played for all actions.
0

User is online   Trooper Dan 

  • Duke Plus Developer

#2407

That's not even code, that's freeform poetry.

To start with, I would look up how to use switch statements in the wiki.
0

#2408

I looked at the switch code, and I have no precision, how could I use a sound related to my problem. I have not found either how to play the Squished sound at the same time for Duke and the monster, when they are killed at the RPG.
0

#2409

View PostTrooper Dan, on 16 October 2018 - 10:01 PM, said:

That's not even code, that's freeform poetry.

To start with, I would look up how to use switch statements in the wiki.


Mmm... I think so ! It's more coherent I think.


appendevent EVENT_SOUND

ife RETURN SQUISHED
{
ife sprite[THISACTOR].picnum LIZTROOPPSX
set RETURN SQUISHED2
}
endevent

or

appendevent EVENT_SOUND

ife RETURN SQUISHED
{
ife sprite[].picnum LIZTROOPPSX
set RETURN SQUISHED2
}
endevent
0

User is offline   Forge 

#2410

"EDuke32 Scripting " would better serve as its own dedicated subforum, instead of just a thread where information gets buried under 80 pages of posts.
Individual questions and answers could then have their own unique threads, and scripts can be located easily by the thread's title description.

This post has been edited by Forge: 18 October 2018 - 02:02 PM

1

User is online   Trooper Dan 

  • Duke Plus Developer

#2411

Sounds like a good idea. I do not have the power to make subforums by the way.
0

#2412

I agree too. This will avoid subject overload. In any case, this forum is sufficiently convincing to continue to improve it.
0

User is offline   conoklast 

#2413

View PostForge, on 18 October 2018 - 02:00 PM, said:

"EDuke32 Scripting " would better serve as its own dedicated subforum, instead of just a thread where information gets buried under 80 pages of posts.
Individual questions and answers could then have their own unique threads, and scripts can be located easily by the thread's title description.


Agreed! As a noob I'm sure many of my questions have been asked numerous times. I actually started going through the thread from page 1.. I think I got to page 5 and then went to bed.. to be continued.

Anyway I actually have a question for the .CON pros; basically I want to create 2-stage breakable glass like in DukePlus. Now I had a bit of a look at Dan's code and it's way over my head. However I noticed in the AMC TC they also have certain sprites that have 2 stages, like the following wooden dummy actor;

useractor notenemy 3899 // wooden dummy intact
cstator 256 
ifhitweapon
{ ifwasweapon KNEE strength 1 else { sound WOODBREAK shoot WOODSCRAP shoot WOODSCRAP strength 1 cactor 3900 } }
enda

useractor notenemy 3900 // wooden dummy half-broken
cstator 256 
ifhitweapon
{ 
ifwasweapon KNEE strength 1 else
{ sound WOODBREAK shoot WOODSCRAP shoot WOODSCRAP shoot WOODSCRAP shoot WOODSCRAP shoot WOODSCRAP shoot WOODSCRAP killit } } 
enda


So my question is either to Trooper Dan or anyone familiar with his breakable glass code; what's the advantage of doing it your way? I'm all for the simplest method but if there are certain advantages then I'd consider trying to get Dan's code working in my mod.

Thank you
0

User is online   Trooper Dan 

  • Duke Plus Developer

#2414

I don't even remember what was in the DukePlus code, but I would guess that it has a single actor and it switches to the damaged animation when it reaches a certain damage threshold. With a pane of glass, you definitely want the ability to shatter it with a single hit if the damage is high enough. You can do that with either approach.

If I were doing it now, I would want bullet damage decals to spawn on the glass sprite at the impact points, and the whole pane to shatter and delete the decals when it accumulates enough of them.
0

User is offline   conoklast 

#2415

View PostTrooper Dan, on 19 October 2018 - 04:48 PM, said:

If I were doing it now, I would want bullet damage decals to spawn on the glass sprite at the impact points, and the whole pane to shatter and delete the decals when it accumulates enough of them.


Well that would be the ultimate - but currently my .CON knowledge extends to breakable sprites and not much else! So perhaps down the track, but I think for now I'll have a look at your code and see if I can make sense of it. Thanks
0

#2416

DELETED

This post has been edited by thisbecasper: 22 October 2018 - 09:32 AM

0

User is offline   Mark 

  • Honored Donor

#2417

I'm going through the cons in SuburbsTC and noticed that enemies are coded with 8 "shoot shotgun" commands in a row instead of a single instance. Any guesses why?
0

User is offline   Jblade 

#2418

View PostMark, on 25 October 2018 - 07:22 AM, said:

I'm going through the cons in SuburbsTC and noticed that enemies are coded with 8 "shoot shotgun" commands in a row instead of a single instance. Any guesses why?

That's how it's done in the vanilla game; shoot only fires a single pellet so to get the buckshot effect you use the shoot command X times.
1

User is offline   Mark 

  • Honored Donor

#2419

That makes sense. Thanks.
0

#2420

Any idea on how to avoid my own projectiles going straight through the monsters when they are up close?
0

User is online   Trooper Dan 

  • Duke Plus Developer

#2421

View Postthisbecasper, on 25 October 2018 - 11:51 PM, said:

Any idea on how to avoid my own projectiles going straight through the monsters when they are up close?


Projectiles don't normally do that. Without more information, it's hard to say. Perhaps your projectiles have something special about them, such as being abnormally large, or having an abnormally large offset.
0

#2422

It appears to be an issue with the NEWBEAST monster...

And how do I alter the vertical angle on an RPG-type projectile (or just make a random trajectory for RPG-like projectiles) ?

This post has been edited by thisbecasper: 29 October 2018 - 07:48 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer

#2423

View Postthisbecasper, on 29 October 2018 - 04:59 AM, said:

And how do I alter the vertical angle on an RPG-type projectile (or just make a random trajectory for RPG-like projectiles) ?


Short answer: you modify the zvel member of the projectile sprite.

Long answer: it depends on whether you know what it is being fired at. If you want to simulate auto-aim, then you need the sprite ID of the target, then there is a formula for setting zvel which depends upon distance to target and the forward speed of the projectile.
1

User is offline   Mark 

  • Honored Donor

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

  • 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 

  • Honored Donor

#2426

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

User is online   Trooper Dan 

  • 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 

  • Honored Donor

#2428

YEP
0

User is offline   Mark 

  • Honored Donor

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



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

0

User is online   Trooper Dan 

  • 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

Share this topic:


  • 85 Pages +
  • « First
  • 79
  • 80
  • 81
  • 82
  • 83
  • 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