
EDuke32 Scripting "CON coding help"
#2393 Posted 09 October 2018 - 11:48 AM
This post has been edited by Mark: 09 October 2018 - 11:49 AM
#2394 Posted 09 October 2018 - 11:55 AM
Mark, on 09 October 2018 - 11:48 AM, said:
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
#2395 Posted 09 October 2018 - 12:06 PM
Mark, on 09 October 2018 - 11:48 AM, said:
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
#2396 Posted 09 October 2018 - 12:08 PM
#2397 Posted 09 October 2018 - 12:10 PM
This post has been edited by Fox: 09 October 2018 - 12:11 PM
#2398 Posted 09 October 2018 - 12:27 PM

#2399 Posted 14 October 2018 - 03:45 AM
I'm speaking of the small messages that appear in the upper half of the screen.
#2400 Posted 16 October 2018 - 12:22 AM

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 }
#2401 Posted 16 October 2018 - 12:37 AM
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.
#2402 Posted 16 October 2018 - 12:46 AM
*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
#2403 Posted 16 October 2018 - 02:04 AM

#2404 Posted 16 October 2018 - 02:25 AM
Sanek, on 16 October 2018 - 02:04 AM, said:

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

#2405 Posted 16 October 2018 - 03:29 AM
Sanek, on 14 October 2018 - 03:45 AM, said:
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)
#2406 Posted 16 October 2018 - 03:41 PM
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.
#2407 Posted 16 October 2018 - 10:01 PM
To start with, I would look up how to use switch statements in the wiki.
#2408 Posted 16 October 2018 - 11:18 PM
#2409 Posted 17 October 2018 - 06:08 AM
Trooper Dan, on 16 October 2018 - 10:01 PM, said:
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
#2410 Posted 18 October 2018 - 02:00 PM
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
#2411 Posted 18 October 2018 - 02:12 PM
#2412 Posted 18 October 2018 - 02:53 PM
#2413 Posted 19 October 2018 - 04:08 PM
Forge, on 18 October 2018 - 02:00 PM, said:
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
#2414 Posted 19 October 2018 - 04:48 PM
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.
#2415 Posted 19 October 2018 - 05:06 PM
Trooper Dan, on 19 October 2018 - 04:48 PM, said:
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
#2416 Posted 22 October 2018 - 09:27 AM
This post has been edited by thisbecasper: 22 October 2018 - 09:32 AM
#2417 Posted 25 October 2018 - 07:22 AM
#2418 Posted 25 October 2018 - 08:14 AM
Mark, on 25 October 2018 - 07:22 AM, said:
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.
#2420 Posted 25 October 2018 - 11:51 PM
#2421 Posted 25 October 2018 - 11:55 PM
thisbecasper, on 25 October 2018 - 11:51 PM, said:
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.
#2422 Posted 29 October 2018 - 04:59 AM
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