EDuke32 Scripting "CON coding help"
#2453 Posted 01 December 2018 - 03:09 PM
#2455 Posted 01 December 2018 - 04:41 PM
Mav3r1ck, on 01 December 2018 - 01:51 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.
#2456 Posted 01 December 2018 - 05:04 PM
Trooper Dan, on 01 December 2018 - 04:41 PM, said:
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
#2457 Posted 01 December 2018 - 05:25 PM
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
#2458 Posted 01 December 2018 - 07:27 PM
#2459 Posted 02 December 2018 - 05:14 AM
Mav3r1ck, on 01 December 2018 - 07:27 PM, said:
ifai 0
{
ai AINEWBEASTGETENEMY
sound NEWBEAST_RECOG
}
Mav3r1ck, on 01 December 2018 - 07:27 PM, said:
ifai 0
{
ai AIBOSS4LAYEGGS
globalsound BOS4_RECOG
}
#2460 Posted 02 December 2018 - 05:37 AM
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
#2461 Posted 02 December 2018 - 01:33 PM
ifai 0
ai AIBOSS4LAYEGGS
is replaced with
ifai 0
{
ai AIBOSS4LAYEGGS
globalsound BOS4_RECOG
}
Everything not being replaced, including the lines that immediately follow, remain as before.
#2462 Posted 02 December 2018 - 07:49 PM
Below is before the additional coding.
state boss4code
ifai 0
ai AIBOSS4LAYEGGS
else
ifaction BOSS4FLINTCH
{
ifactioncount 3
ai AIBOSS4LAYEGGS
}
else
ifai AIBOSS4LAYEGGS
state boss4layeggs
else
ifai AIBOSS4SHOOT
state boss4shootstate
ifai AIBOSS4DYING
state boss4dyingstate
else
{
ifhitweapon
state checkboss4hitstate
else
ifp palive
ifpdistl 1280
{
addphealth -1000
palfrom 63 63
}
}
ends
This is after the additional coding.
state boss4code
ifai 0
{
ai AIBOSS4LAYEGGS
globalsound BOS4_RECOG
}
else
ifaction BOSS4FLINTCH
{
ifactioncount 3
ai AIBOSS4LAYEGGS
}
else
ifai AIBOSS4LAYEGGS
state boss4layeggs
else
ifai AIBOSS4SHOOT
state boss4shootstate
ifai AIBOSS4DYING
state boss4dyingstate
else
{
ifhitweapon
state checkboss4hitstate
else
ifp palive
ifpdistl 1280
{
addphealth -1000
palfrom 63 63
}
}
ends
#2463 Posted 02 December 2018 - 10:42 PM
#2464 Posted 03 December 2018 - 03:10 AM
Trooper Dan, on 07 November 2018 - 03:38 AM, said:
Hi Dan, I've been sidetracked with other things but I've now done up a simple 5 frame leaf animation and have loaded it into mapster32. In terms of functionality I was planning on using the code you gave me for the damaged wall tiles (onevent EVENT_DAMAGEWALL) So that when a sector with the foliage texture is shot it will generate the leaves. I had a read of the EVENT ANIMATESPRITES wiki but my understanding is pretty limited. Is the first step to create a unique actor for my leaf sprite animation?
#2465 Posted 03 December 2018 - 04:40 AM
conoklast, on 03 December 2018 - 03:10 AM, said:
No, I would start by using the mail command to spawn envelopes from the damaged wall using the code I gave you before. Once you confirm that the envelopes spawn and fall in the way that you want, then go about replacing their t-sprites with the sprites you made. If it doesn't work, then you'll just have to code the movement into your own actor by oscillating the xvel of the falling sprite using a sin function. Not super hard either way.
#2466 Posted 03 December 2018 - 01:57 PM
Trooper Dan, on 02 December 2018 - 10:42 PM, said:
I'm not sure if a I did or not. However, I'll delete the Queen's current code and replace it with the original and unaltered coding and use your example to see what happens.
EDIT: Got it working, but I don't remember editing the Queen's code at all. For now, all that's left is the Protector Drone.
state newbeastcode
state checksquished
ifai 0
{
cstator 257
ai AINEWBEASTGETENEMY
}
else
ifaction ANEWBEASTLYINGDEAD
{
fall
state newbeastdyingstate
break
}
else
ifaction ANEWBEASTFROZEN
{
ifcount THAWTIME
{
ai AINEWBEASTGETENEMY
spritepal 0
}
else
ifcount FROZENDRIPTIME
{
ifactioncount 26
{
spawn WATERDRIP
resetactioncount
}
}
ifhitweapon
{
ifwasweapon FREEZEBLAST
{
strength 0
break
}
addkills 1
ifrnd 84
spawn BLOODPOOL
lotsofglass 60
sound GLASS_BREAKING
killit
}
ifp pfacing
ifpdistl FROZENQUICKKICKDIST
pkick
break
}
else
ifai AINEWBEASTJUMPENEMY
state newbeastjumpstate
else
{
fall
ifai AINEWBEASTGETENEMY
state newbeastseekstate
else
ifai AINEWBEASTCHARGEENEMY
state newbeastseekstate
else
ifai AINEWBEASTFLINTCH
{
ifcount 8
ai AINEWBEASTGETENEMY
}
else
ifai AINEWBEASTDODGE
state newbeastdodgestate
else
ifai AINEWBEASTSCRATCHENEMY
state newbeastscratchstate
else
ifai AINEWBEASTFLEENEMY
state newbeastfleestate
else
ifai AINEWBEASTTHINK
state newbeastthinkstate
/*
else
ifai AINEWBEASTSHRUNK
state newbeastshrunkstate
*/
else
ifai AINEWBEASTGROW
state genericgrowcode
else
ifai AINEWBEASTDYING
state newbeastdyingstate
else
ifai AINEWBEASTSHOOT
{
ifp pshrunk
ai AINEWBEASTGETENEMY
else
ifcount 26
ai AINEWBEASTGETENEMY
else
ifcount 25
shoot SHRINKER
else
{
ifcount 5
nullop
else
ifcount 4
sound NEWBEAST_SPIT
}
}
}
ifhitweapon
state checknewbeasthit
ends
So do I do the same thing at the top of this code like for what I did with the Queen?
This post has been edited by Mav3r1ck: 03 December 2018 - 03:09 PM
#2467 Posted 03 December 2018 - 04:49 PM
Mav3r1ck, on 03 December 2018 - 01:57 PM, said:
#2468 Posted 04 December 2018 - 12:14 AM
Trooper Dan, on 03 December 2018 - 04:40 AM, said:
I can confirm that the wall tile spawns money that behaves how I'd like it to. I had a go at mimicking the code from the wiki page but my code won't compile. I'll explain my thinking (or lack thereof
So based on the wiki I need to assign 16 to the mdflags of the MONEY sprite/actor. I had tried renaming TEMP to LEAFVAR (just to make things clearer) but mapster didn't like this; said that it "...was expecting keyword, found "LEAFVAR"
gamevar TEMP 0 0 actor MONEY 1 LEAFFALL 0 0 getactor[THISACTOR].mdflags TEMP orvar TEMP 16 setactor[THISACTOR].mdflags TEMP
Now I read through the ACTOR page on the wiki and after the name and strength values I need to define an action... so I created an action for my falling leaf sprite
define LEAF1 7642 useractor notenemy LEAF1 cstator 2305 ifaction 0 action LEAFFALL enda action LEAFFALL 0 6 1 1 1 // my leaf sprite has 6 frames of animation
I then tried combining this with your previous code you had given me;
damageeventtilerange 7653 7655 //
onevent EVENT_DAMAGEWALL
ife wall[RETURN].picnum FOLIAGE1
{ money 7
gettspr[MONEY].tsprcstat TEMP
ifvarand TEMP 2
xorvar TEMP 2
settspr[LEAF1].tsprcstat TEMP }
endevent I've no doubt made several errors, so if you can point me in the right direction it would be much appreciated.
This post has been edited by conoklast: 04 December 2018 - 12:15 AM
#2469 Posted 04 December 2018 - 02:12 AM
IMPORTANT: Set your 6 frame leaf animation to animate from the art file (or using animtilerange if you aren't using .art files). That way, you can just set the money sprite to the leaf picnum and it will animate.
gamevar HACKTIME 0 0
gamevar spriteid 0 0
define LEAF1 7642
damageeventtilerange 7653 7655
onevent EVENT_DAMAGEWALL
ife wall[RETURN].picnum FOLIAGE1
{
set HACKTIME YES
money 7
set HACKTIME NO
}
endevent
appendevent EVENT_EGS
ifactor MONEY
ife HACKTIME YES
seta[].mdflags 16
endevent
appendevent EVENT_ANIMATESPRITES
gettspr[].tsprowner spriteid
ife sprite[spriteid].picnum MONEY settspr[].tsprpicnum LEAF1
endevent
#2470 Posted 04 December 2018 - 03:46 AM
Link to youtube vid (embedding doesn't seem to work)
The only minor issue is that the leaves convert back to the money sprite as they touch the ground.
This post has been edited by conoklast: 04 December 2018 - 03:51 AM
#2471 Posted 04 December 2018 - 04:28 AM
conoklast, on 04 December 2018 - 03:46 AM, said:
Link to youtube vid (embedding doesn't seem to work)
The only minor issue is that the leaves convert back to the money sprite as they touch the ground.
That link is not working but I will take your word for it. As for hitting the ground, I'm sure they are changing into a different picnum there (the middle tile of the money falling animation, which is tile 1234). What you could do is set a per-actor var on them in EVENT_EGS which will act as a flag for later. In EVENT_GAME you check any sprites of picnum 1234 that have the flag, and then change them to a leaf picnum which shows it on the ground.
#2472 Posted 04 December 2018 - 12:31 PM
Trooper Dan, on 04 December 2018 - 04:28 AM, said:
Link to youtube vid
The link should work now - I figured you might be interested seeing as you're the one providing all the code. I will try to implement the per-actor VAR by myself and will see how I go.
#2473 Posted 04 December 2018 - 01:11 PM
conoklast, on 04 December 2018 - 12:31 PM, said:
The link should work now - I figured you might be interested seeing as you're the one providing all the code. I will try to implement the per-actor VAR by myself and will see how I go.
It doesn't.
#2474 Posted 04 December 2018 - 06:35 PM
#2475 Posted 05 December 2018 - 04:49 PM
1. I was able to properly code in an Overlord Sentry using Hendricks266 tutorial from the Eduke32 wikia. Though I noticed that it's missile firing position was off on the Overlord Sentry and from what I understand this will cause it to shoot itself at certain angles and even kill itself. How do I fix this?
2. I want to make an indestructible corpse/invisible corpse. How can I do this?
#2476 Posted 05 December 2018 - 05:16 PM
Mav3r1ck, on 05 December 2018 - 04:49 PM, said:
1. I was able to properly code in an Overlord Sentry using Hendricks266 tutorial from the Eduke32 wikia. Though I noticed that it's missile firing position was off on the Overlord Sentry and from what I understand this will cause it to shoot itself at certain angles and even kill itself. How do I fix this?
I'm pretty sure it will not shoot itself if you are using a relatively recent EDuke32. Verify that it does before worrying about it. If the position of the rockets bothers you, there are fixes but you will need to be more specific about the positioning.
Mav3r1ck, on 05 December 2018 - 04:49 PM, said:
All you have to do is change cstat on the corpse.
https://wiki.eduke32.com/wiki/Cstat
EDIT: I should add, if the corpse is coded to be destroyed when hit with splash damage ("ifhitweapon RPG ...") then obviously you should remove that code for the corpse in question.
This post has been edited by Trooper Dan: 05 December 2018 - 05:26 PM
#2477 Posted 05 December 2018 - 06:23 PM
Trooper Dan, on 05 December 2018 - 05:16 PM, said:
Hmm, the firing position does bother a little. The rockets spawn above the Overlord Sentry. I also understand that when monsters are scaled the projectiles will match the scaled monster.
Trooper Dan, on 05 December 2018 - 05:16 PM, said:
https://wiki.eduke32.com/wiki/Cstat
EDIT: I should add, if the corpse is coded to be destroyed when hit with splash damage ("ifhitweapon RPG ...") then obviously you should remove that code for the corpse in question.
The code below is what I have for an experiment.
ifwasweapon RPG
{
sound PRED_DYING
sound SQUISHED
state troop_body_jibs
state standard_jibs
cstat 0
iffloordistl 8
sound THUD
ifrnd 64
spawn BLOODPOOL
state rf
strength 0
move TROOPSTOPPED
action ATROOPDEAD
cstator 32768
This will allow me to blow up the Trooper but it will leave an invisible corpse behind and will respawn in the spot where it died. The goal is to attempt to replicate Doom's Nightmare difficulty respawning and by that I mean to have the monsters respawn regardless of what weapon you kill them with. So far it's been successful but the issue I'm facing is that if you shoot an explosive at the invisible corpse it will explode with guts until the monster respawns. I'm trying to get it to where it doesn't do this.
#2478 Posted 06 December 2018 - 02:47 AM
As for the invisible corpse problem, I would define a new move, let's say "move JIBRESPAWN" and then when killed by RPG or RADIUSEXPLOSION, you have the enemies use that move instead of "move TROOPSTOPPED" or whatever that particular actor uses. Then, in the actor's code where the corpse is checking for explosions, add the line "ifmove JIBRESPAWN break" before any of the code that makes them spawn jibs. But also make sure that the "ifrespawn" check happens before the break, otherwise they will be stuck invisible forever. You migth have to move some code around to make it work.
#2479 Posted 06 December 2018 - 04:08 PM
Trooper Dan, on 06 December 2018 - 02:47 AM, said:
Hmm, I can give it a shot and see what happens.
Trooper Dan, on 06 December 2018 - 02:47 AM, said:
This gave me an idea.
state standard_jibs
guts JIBS2 4
guts JIBS3 8
guts JIBS4 12
guts JIBS5 8
guts JIBS6 12
ifrnd 6
{
guts JIBS1 1
spawn BLOODPOOL
} // a badly drawn spine
state jib_sounds
ends
The above is a modified jibs code (love the idea of more jibs when blowing something up) in my external GAME.CON that spawns more guts when blowing monsters up. That being said, what if I can duplicate this code and remove all the parts that spawn jibs and add it to the invisible corpse part as a dummy state for the jibs and then whenever I shoot the invisible corpse, no jibs will spawn. Could that method work instead?
This post has been edited by Mav3r1ck: 06 December 2018 - 04:15 PM
#2480 Posted 06 December 2018 - 05:04 PM
Mav3r1ck, on 06 December 2018 - 04:08 PM, said:
I'm sorry but that broke me. The entire state does nothing but spawn jibs until the very last line which plays sounds.
#2481 Posted 16 December 2018 - 04:36 PM
This post has been edited by Mark: 16 December 2018 - 04:37 PM

Help
Duke4.net
DNF #1
Duke 3D #1









