EDuke32 Scripting "CON coding help"
#2447 Posted 19 November 2018 - 06:48 PM
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
#2448 Posted 28 November 2018 - 06:47 PM
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.
#2449 Posted 29 November 2018 - 09:08 AM
Mav3r1ck, on 28 November 2018 - 06:47 PM, said:
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 { }
#2450 Posted 30 November 2018 - 08:45 AM
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
#2451 Posted 01 December 2018 - 01:51 PM
#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

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


