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

Jump to content

  • 124 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 offline   Perro Seco 

#2394

View PostMark, on 09 October 2018 - 11:48 AM, said:

I want to have an enemy that when you get close will either ( do something ) if the player is not holding any weapon or will ( do something else ) if they are holding any weapon. How do I have that enemy detect if the player is holding a weapon?
This may help: https://wiki.eduke32.../Holster_weapon

But I'm not sure if you're talking about hidding a weapon with the holster weapon key or hidding it by selecting the kick. In the second case it will work if you check the player's weapon with this: https://wiki.eduke32...iki/Curr_weapon
1

User is offline   Sanek 

#2395

View PostMark, on 09 October 2018 - 11:48 AM, said:

I want to have an enemy that when you get close will either ( do something ) if the player is not holding any weapon or will ( do something else ) if they are holding any weapon. How do I have that enemy detect if the player is holding a weapon?


Isn't there a feature like that in TekWar? I don't remember exactly, but cops and citizens have a certain reaction either to a shooting or a weapon holding.

This post has been edited by Sanek: 09 October 2018 - 12:06 PM

0

User is offline   Mark 

#2396

I can probably make use of the CURRENT_WEAPON feature. Thanks.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2397

delete

This post has been edited by Fox: 09 October 2018 - 12:11 PM

0

User is offline   Mark 

#2398

Working with structs is one of my many weak points in con coding. I'll attempt to trial and error my way through it first before asking for help. :rolleyes:
0

User is offline   Sanek 

#2399

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

User is offline   MC84 

#2400

I've started dipping my feet into .CON coding, so there's a chance I'll be posting here regularly and making a nuisance of myself :rolleyes:

Anyway - I thought I'd start with breakable actors.. specifically I want to make my own breakable walls (like the W_TECHWALL actors)

However I can only get the code to function as a sprite; when the tile is applied to a wall it doesn't respond. I'm just using the basic code from the edukewiki;

define OFFICEWALL 7684 //office wall
define OFFICEWALLBR 7685 //office wall damaged

useractor notenemy OFFICEWALL
 cstat 257
ifwasweapon RADIUSEXPLOSION
{
 sound VENT_BUST
 debris SCRAP1 4
 cactor OFFICEWALLBR
 }

0

User is offline   Danukem 

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

#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 offline   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. :rolleyes:
0

User is offline   MC84 

#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. :P


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

User is offline   Danukem 

  • 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

User is offline   F!re-Fly 

#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 offline   Danukem 

  • 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

User is offline   F!re-Fly 

#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

User is offline   F!re-Fly 

#2409

 Trooper 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 

  • Speaker of the Outhouse

#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 offline   Danukem 

  • Duke Plus Developer

#2411

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

User is offline   F!re-Fly 

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

#2413

 Forge, 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 offline   Danukem 

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

#2415

 Trooper 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 

#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

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

#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 offline   Danukem 

  • Duke Plus Developer

#2421

 thisbecasper, 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 offline   Danukem 

  • Duke Plus Developer

#2423

 thisbecasper, 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

Share this topic:


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