PDA

View Full Version : EDuke programming questions


Mblackwell
11-25-2002, 02:18 PM
Honestly the best thing to do would be to construct the cola machine out of sprites. Then just program the main sprite to do all that funky junk.

Otherwise, if you just wanna mod Duke Nukem 3D to do that, yer gonna have to make an actor that sits in front of the machine and trac down every one.... oh well.

Usurper
11-25-2002, 09:46 PM
Heck, you don't even have to make it out of sprites, just pase a single one-sided sprite onto the front of it. images/icons/smile.gif Probably less sprite clipping glitches that way.

You can make hurtfloor textures by detecting the texture of the floor of the sector that the player is standing in. You can either do this through the player structure or use the earlier command to get the floor texture (it's in the docs). The trouble with that is that if you have a ledge high above the sector, and you move the player partway off the edge, even though he's still teetering at the top the game thinks he's in the hurtfloor sector. Even if you detect if the player is on the ground, it still does it. What you might do is to find the height of the hurtfloor and, if the number isn't too huge, assign it as the floor's hitag. Then, get the texture of the floor into a variable as well as the hitag of the sector the player is in. Compare the player's z location to the hitag of the sector to determine if he should splat or not.

Or just use a sprite marker on the hurtfloor. Get its height into a variable, and get the player's height into a variable. If those variables get within a certain number of units and the floor texture is right, kill the player.

Guest
11-26-2002, 12:14 AM
Long time no see, but anyways... I'm using EDuke again after being inactive for so long, and I had a question about programming in it.

I recently got the idea to make Cola and Snack machines in the game to actually give Duke health and such. There's one thing that bugs me about it:

I want to know if you can use EDuke to make a wall texture[not a sprite] activate code that will do this for Duke[you push on the Cola/Snack Machine texture and Duke gets something], instead of making a sprite version that has to be put on the front of the machine[meaning you can't "break" the machine, and it also makes tracking down all the Cola textures in the games and stuff a pain]?

Also, I forgot if it's possible, but can you make new damage floors, like maybe lava that if someone lands on it, it'll kill the player instantly[without using a sprite for it, I mean] in the EDuke coding?

jimbob
11-26-2002, 12:32 AM
i once had the same idea , but a little more complex.

my idea was to let the player actually buy a drink wich would pop out of the machine, roll a sec and stop. i never got it working but i have some of the cope ready


define COLAMACHINE1 1215
define CAN 5121
define CANSIDE 5129
define CANSTRENGTH 16

action CANFRAMES 0 1 8 1 32
action CANSIDEFRAMES 0 1 7 1 32

state colastate
ifpdistl 1024
ifhitspace {
ifcount 32
{ action CANSIDEFRAMES resetcount }
}
ends

move cans 32 geth
state canstate
action CANFRAMES
ifwasweapon SHOTSPARK1 {
debris SCRAP1 6
{ ifwasweapon RADIUSEXPLOSION
debris SCRAP1 6 killit }
ifspawnedby COLAMACHINE1
move cans }
ifcount 32 move 0
ends

state canside
action CANSIDEFRAMES
ifwasweapon SHOTSPARK1 {
{ debris SCRAP1 6 killit } else
{ ifwasweapon RADIUSEXPLOSION
debris SCRAP1 6 killit }
}
ends

useractor notenemy COLAMACHINE1
state colastate enda

useractor notenemy CAN CANSTRENGTH CANFRAMES ifaction 0
sizeat 16 16
state canstate enda

useractor notenemy CANSIDE CANSTRENGTH CANSIDEFRAMES ifaction 0
sizeat 16 16
state canside enda

twiddle with this and please let me know when you got it to work images/icons/smile.gif
btw the can is a 8 frame actor from lameduke

Guest
11-26-2002, 12:38 AM
Argh... I accidentlally hit "New Topic" when I went to make a reply, but anyways... :\

That's not a bad idea, but that's not what I meant with mine.

I mean I'm aiming to make a wall texture do this[with EDuke], and not a sprite attached to a wall. I've already made the code on a sprite, but I'd like to attach it to a wall texture instead of a sprite version so you could walk up to a cola machine or snack machine in any map without editing the map just to put the Cola/Snack sprite on it(also for vending machines that are like revolving doors) and just pressing on it to get the cola/snack. :\

jimbob
11-26-2002, 12:42 AM
this should work as a walltexture just test it.
if not , its still a good way to start images/icons/smile.gif

Guest
11-26-2002, 12:48 AM
Have tried it though before... Doesn't work images/icons/frown.gif


On a slightly different note, I have been able to make a money system using EDuke Variables[unfortunately there is no known way to view you cash total or use variables in quotes that I know of(if anyone does know a way, I'd like to know this too)], and I've made it where the machine actually rejects you if you don't have enough money to get the soda, and Duke says some crap about it.

Here's one of the code thingies:

// Cola Machine Actor
define COLA_MACHINE 1215
useractor notenemy COLA_MACHINE 0 0
ifp palive {
ifp pfacing {
ifpdistl 768 {
ifhitspace {
ifvare DELAY 1 {
ifcount 64 { setvar DELAY 0 resetcount } } // Gives the Cola Machine a Delay of about 2 seconds so you can't get 89,000 some colas with one press images/icons/tongue.gif
ifvare DELAY 0
{ ifvarg DOLLARS_COLLECTED 24
{ ifphealthl MAXPLAYERHEALTH
{ sound COINUSE quote 166 sound DUKE_USEMEDKIT addphealth 15 addvar DOLLARS_COLLECTED -25 } else { quote 168 } }
else { quote 167 sound DUKE_KILLED2 }
} } setvar DELAY 1 } } }
enda

jimbob
11-26-2002, 12:54 AM
that has some really interesting potential

but my code has a big flaw in it, instead of spawning a can it turns the colamachine in the "can" images/icons/frown.gif so it needs lots-o-work

Mblackwell
11-27-2002, 10:03 PM
Ah, but if you make it out of sprites you can make it so you can blow the machine up (a la suburbs). Anyways, if you were clever you could also have it so the player hits certain buttons on the machine to get certain types of pop, as well as having each machine limited in the amount of each kind of soda....

*shifty eyes*

jimbob
11-28-2002, 02:21 PM
wel yes more sprites wil work but not on an 1 sided sprite or unless you mean actions then yes it wil work

Mblackwell
11-28-2002, 03:16 PM
I'm talking about multiple sprites. Frankly it would be completely inefficient to use a single sprite, though it could be done, as you would then have to track where the player is looking in relation to the sprite, then having to pay attention to the size of the sprite, etc.

And also, I mean literally BLOW UP!

jimbob
11-28-2002, 03:25 PM
it can blow up with lots of scrap and stuff something like

ifhitweapon
ifwasweapon RADIUSEXPLOSION
{ spawn EXPLOSION2 debris SCRAP3 30 killit }

that should work but its just from the head so there might be errors

as for the multple sprites , wel if your using a 1sided sprite then it might not work if you use a sprite for the machine and a few for the buttons due to clipping but if u use and action for every button so you can highlite the button you want by pressing space or something like that it might work anyway there are some awesome coders around here and i wonder why only one replied here (not me im just a "for fun" coder)

The_Shadow
11-28-2002, 05:41 PM
To make it show a destroy texture:
(Note, this isn't entirely accurate, I haven't used Eduke in soooo long.)

</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">ifhitweapon
setvar COLAMACHINE_HITFLAG 1

ifvare COLAMACHINE_HITFLAG 0
action COLAMACHINE_NORMAL
ifvare COLAMACHINE_HITFLAG 1
action COLAMACHINE_BROKE[/code]</blockquote><font size="2" face="Verdana, Arial">Where COLAMACHINE_HITFLAG is boolean defined gamevar
COLAMACHINE_NORMAL is a defined action that shows a colamachine sprite
COLAMACHINE_BROKE is a defined action that shows a broken colamachine sprite.

Easy as that.

Mblackwell
11-28-2002, 06:37 PM
You don't seem to understand, I don't mean just break the front of the thing, nor blowing up the front of it, I mean making the whole friggin machine EXPLODE! Suburbs even had little leftover cans bouncing around when you did it.


ANn frankly, it would take more than just a single sprite for the front at the "select your can by pushing the button" effect to be pulled off. It would make the front constructed like this:
</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">

_____
|_____|
| |=|
| |=|
|___|_|
[/code]</blockquote><font size="2" face="Verdana, Arial">Needing at least 4 sprites for the front, and more for every button (past a single one, that 4 includes one, the picture uses 5 in fact), since even having a color 255 spot for those sprites on the machine may result still in errors where the player presses the button but they are actually pressing the machine sprite. But, if you were willing to give in increase in sprites, you could build on that effect even more, and use the single sprite with the transparent spot. In this scenario you would construct each individual button as 5 sided, resulting in the button actually animating inward when the player pushes it.... and yes it is absolutely and completely possible and makes perfect sense to do, if you are willing to spend the time. Such a small detail as that would make your TC above and beyond any it clones and those that would clone it, thereby seperating it from the pack, and maybe just making it something I and everyone else would want to play.

jimbob
11-29-2002, 12:19 AM
to get the machine to blow up you can do an action BROKE when the broke number is the broken machine tile and the code it like ifaction BROKE { } . just experiment a bit with the code it is possible

and to get a specific button for different drink is not possible with a sprite i think.

cyborg
11-29-2002, 12:56 AM
Originally posted by jimbob:
and to get a specific button for different drink is not possible with a sprite i think. <font size="2" face="Verdana, Arial">Not with a sprite - there's no reason why you can't use a different sprite for each button.