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

Jump to content

  • 115 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

#1

I think it's time for this thread to come back. Post any little CON questions here.

This post has been edited by Hendricks266: 24 May 2012 - 09:08 PM
Reason for edit: fixed name of source port

0

#2

I hope nobody minds if I post the first question. I'm redoing the liztroop AI, and I would like them to be active from the start. I attempted to banish the hard-coded behavior by setting the tilenum to 5000 with dynamic remap and defining a useractor notenemy at the original place, but they still wait for the player to show up and make their noise when he does.
0

User is offline   XThX2 

#3

Try defining them as actors, and change their actor name to something else. It should work.
0

User is offline   Danukem 

  • Duke Plus Developer

#4

onevent EVENT_GAME

ifactor LIZTROOP changespritestat THISACTOR 1

endevent


The method above is not CPU efficient but it works.

Note that you can make an actor's code execute at startup by defining it as a useractor notenemy, but if the player is not around they will quickly fall asleep (statnum 2). Also, even with dynamicremap, I wonder if you are running into some hardcoded issue with LIZTROOP.
0

#5

I was messing around with onscreen displaying, it works fine but I can't find a way to perform correct interpolation between game ticks. Can I have access to the interpolation counter, say, from EVENT_DISPLAYREST?

This post has been edited by CraigFatman: 16 May 2009 - 04:09 PM

0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#6

I was also having troubles with my cars randomly stoping in my mod and going to sleep, I found this to be a life safer on that. " sleeptime -1 "
Using this as well isn't very CPU efficient, though you will still need DT code to wake them first I believe.
1

User is offline   ReaperTK 

#7

Hey All,

I'm trying to learn the CON language, It's going rather slow. I do have some C, Java, VB, Python, PHP experience but I'm just not picking up on this for some reason. Anyway, I'm trying to start slow by doing a couple of things that, at least in my mind, seem short and simple. There are 2 things that I really want to do right now but I don't have the slightest Idea where to begin.

First, I want to have a message appear at the top of the screen whenever the player approaches an object that they can interact with ( to the effect of "Press <activate> to operate switch/door/whatever") and I want the message to be customized to each type of item.

From what I've learned so far I know it involves using "ifpdistl" and "ifp pfacing" to determine if the player is close enough and actually looking at the object. And also I know I need to define gamequotes (and can also redifine them at runtime) and utilize the gametext command. The fact that gametext has to be called from within a game event is what seems to be throwing me off. Is there any way to have an event that listens for an actor to pass a quote to it and display it to the screen or is that not how this stuff works?

Second, I'm trying to program an airlock for an underwater/space level where the user walks into it, flips a switch, the first door closes then a pressurizing/depressurizing sound plays and then finally the other door opens. I know it can be done without CON manipulation by using a tram system for timing, but I don't know how to do this and would rather have it done through CON code to save sectors/walls/sprites/time.

If anyone can help me out with these two things and give me any tips on CON coding, I'd appreciate it.
0

User is offline   Danukem 

  • Duke Plus Developer

#8

I'm assuming you know about the quote command and don't want to use it. That being the case, what you can do is decare a couple of per player variables, one for storing the number of the quote to be displayed and another for storing how long to display it. Have duration variable count down by decrementing it by one each tic in the player actor if it is nonzero. Make the actor set the duration variable and the quote number variable when the player is near and facing. Then check that variable in the display event and use gametext to display the quote of the number in the number variable whenever the countdown variable is nonzero.

The second one is is a little harder to explain. Make an activator that opens the second door. Don't put anything in the map that actually triggers the activator. In mapster, set EXTRA on the switch sprite (the one that closes the first door) to the lotag of the activator. Use eventloadactor on the picnum of the switch and grab EXTRA, storing it in a per actor variable if EXTRA is > 0. With that all set up, you will monitor the switch in EVENT_GAME. When a switch that has the per actor variable set changes picnum (meaning it has been used), start a countdown timer (a per actor one on the switch) and when it gets to 1 use operateactivators on the activation number you grabbed from EXTRA when the map loaded. I left out a few details but that's how I would do it.

This post has been edited by DeeperThought: 18 May 2009 - 02:19 PM

1

User is offline   ReaperTK 

#9

Thanks a bunch DT, I was thinking along exactly the same line for the airlock (setting extra to correspond to the activator) I just wasn't sure exactly how to implement it code wise. One thing I forgot to mention is that I intend for the player to be able to go back and forth through the airlock and I intend to have several of these airlocks spread out through the map(s). You've definitely given me a good starting point. I play around and see what I can come up with.

Also, I did know about the quote command but gametext appears to be much more versatile and I like having options.
0

User is offline   Reaper_Man 

  • Once and Future King

#10

I'm going to make some quick tutorials on the new array functions that made me shit my pants with excitement.
0

#11

In the XBLA version of Duke Nukem 3D, they increased the amount of health that you get from drinking water (from broken toilets, hydrants, etc) to 5 per use instead of the original 1 per use.

I'm guessing that this is defined somewhere in the original GAME.CON, but I was curious if you can override it with a custom .CON file? Or am I going to have to crack duke3d.grp, find the original setting, and modify it?

Maybe I'm just a bad player, but I frequently use water as a basic survival technique on the harder difficulty levels (like "Damn, I'm Good"). 1 health per drink just takes too long.
0

User is offline   lycanox 

#12

View PostA Number One, on May 19 2009, 08:49 AM, said:

In the XBLA version of Duke Nukem 3D, they increased the amount of health that you get from drinking water (from broken toilets, hydrants, etc) to 5 per use instead of the original 1 per use.

I'm guessing that this is defined somewhere in the original GAME.CON, but I was curious if you can override it with a custom .CON file? Or am I going to have to crack duke3d.grp, find the original setting, and modify it?

Maybe I'm just a bad player, but I frequently use water as a basic survival technique on the harder difficulty levels (like "Damn, I'm Good"). 1 health per drink just takes too long.


My first guess would be including a code like this somewhere after def.con and user.con

gamevar PICNUM 0 2

onevent EVENT_GAME

getactor[THISACTOR].picnum PICNUM

ifvare PICNUM WATERFOUNTAIN
{
ifp palive
ifpdistl RETRIEVEDISTANCE
ifp pfacing
ifactioncount 32
ifphealthl MAXPLAYERHEALTH
ifhitspace
ifcansee
{
addphealth 5
globalsound DUKE_DRINKING
resetactioncount
}
}
endevent
0

User is offline   Danukem 

  • Duke Plus Developer

#13

No, just change the TOILETWATER actor so it gives 5 health instead of 1. You literally only have to change a 1 to a 5, that's it.
0

#14

View PostDeeperThought, on May 19 2009, 07:28 AM, said:

No, just change the TOILETWATER actor so it gives 5 health instead of 1. You literally only have to change a 1 to a 5, that's it.

Thanks. I was thinking it was probably something simple like that, but I guess I do need to crack open the duke3d.grp to get to the CON file. Which is no big deal, just takes a little more time.
0

User is offline   lycanox 

#15

View PostDeeperThought, on May 19 2009, 04:28 PM, said:

No, just change the TOILETWATER actor so it gives 5 health instead of 1. You literally only have to change a 1 to a 5, that's it.

I was describing the code as it would be if placed in a separate con file.
0

User is offline   ReaperTK 

#16

View PostDeeperThought, on May 18 2009, 06:17 PM, said:

With that all set up, you will monitor the switch in EVENT_GAME. When a switch that has the per actor variable set changes picnum (meaning it has been used)


Quick question; How do check to see if the switch changes picnum? Keep in mind that I do have multiple switches controlling the same airlock (One inside, and one outside each door). I am utilizing the map caching feature and designing the maps in such a way that there is no guarantee as to which side of the airlock the player may encounter first or what state it may be in (I also plan to allow enemies to be able to go through the airlocks as well but I'll tackle the project later).
0

#17

Is there a way to change the field of view of showview command? It's very important for me. Setaspect doesn't work here because showview resets the aspect to its default value every time when called.
0

User is offline   ReaperTK 

#18

View PostReaperTK, on May 19 2009, 07:18 PM, said:

Quick question; How do check to see if the switch changes picnum? Keep in mind that I do have multiple switches controlling the same airlock (One inside, and one outside each door). I am utilizing the map caching feature and designing the maps in such a way that there is no guarantee as to which side of the airlock the player may encounter first or what state it may be in (I also plan to allow enemies to be able to go through the airlocks as well but I'll tackle the project later).



OK I've got it checking for the picnum change (probably a better way to do it though than what I did). I had it store the current picnum to a per actor variable in the eventloadactor code then grabbed the picnum again in the EVENT_GAME code (after checking the EXTRA value) I then compared the two to determine if a change had occurred.

Now I just need to know the proper use of the operateactivators command to activate the doors (I threw in some debugging code to arbitrarily change the switches picnum as you'll see below just to make sure the proper conditions are actually being met.

onevent EVENT_GAME {
	ifvare EXTRA 20 { // Airlock Switch
		getactor[THISACTOR].picnum AIRLKNPIC
		ifvarvarn AIRLKNPIC AIRLKCPIC { // Switch has been activated
			operateactivators AIRLK 0
						// setactor[THISACTOR].picnum 135
			setvarvar AIRLKCPIC AIRLKNPIC 
		} // end ifvarn
	} // end ifvare
} // end EVENT_GAME
endevent


I'm so close I can taste it.

EDIT: Nevermind, I've got it working perfectly now. I had an issue in the map that was preventing the doors from opening.

This post has been edited by ReaperTK: 19 May 2009 - 04:57 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#19

View PostReaperTK, on May 19 2009, 05:39 PM, said:

OK I've got it checking for the picnum change (probably a better way to do it though than what I did). I had it store the current picnum to a per actor variable in the eventloadactor code then grabbed the picnum again in the EVENT_GAME code (after checking the EXTRA value) I then compared the two to determine if a change had occurred.


Haha, I do it the same way in my switch effects. I can't think of any other way of doing it at the moment.
0

User is offline   XenoMatriX 

#20

Hi, I would like to add the blood effects from the discontinued SD duke (if I have permission) into the current HRP. This is probualy the biggest peice of eye candy I miss from the mod, I know duke plus contains a small amount of the art from it, but I was wondering if there is any way I could implement the code from SD duke.
I'm no good at con editing so I'd need someone to tell me exactly what to do.

So if there is anyone out there who has the time and is willing to help me, I'll be forever in your debt.

EDIT: Sorry, just downloaded latest dukeplus and it includes the sd "blood clouds", which more that satisfy my needs... (for now!)

This post has been edited by XenoMatriX: 23 May 2009 - 03:49 AM

0

User is offline   Jblade 

#21

What's the best way to achieve the Blood Tommy Gun spray attack? I was thinking of spawning a bunch of actors in an arc infront of the player that fire a bullet at each angle, but I don't think that'd give the player the points for the kill in multiplayer. Any ideas?
0

User is offline   Danukem 

  • Duke Plus Developer

#22

View PostJames, on Jun 6 2009, 01:14 AM, said:

What's the best way to achieve the Blood Tommy Gun spray attack? I was thinking of spawning a bunch of actors in an arc infront of the player that fire a bullet at each angle, but I don't think that'd give the player the points for the kill in multiplayer. Any ideas?


That reminds me, I did this for one of the Blood mods a while ago. I was supposed to port the code for Dimebog, but I've been otherwise occupied. I am attaching the code that I used:

Attached File  EDUKE.zip (1.48K)
Number of downloads: 1378

Simplifying a bit, what I did was to add or subtract a number from the player's angle depending on the part of the firing sequence you are at. The angle is reset after firing so you can't tell that the player is turning. So: check altfire counter variable, and depending on what that is you change angle, fire bullet, reset angle (in the player's code). Then there is display code that syncs up with the firing.
0

User is offline   Jblade 

#23

groovy, that should help a great deal - thanks :)
0

User is offline   XThX2 

#24

onevent EVENT_GAME
.
.
.
ifactor MACE2
{
	getactorvar[THISACTOR].ACTORCOUNT countvar
	addvar countvar 1
	setactorvar[THISACTOR].ACTORCOUNT countvar
	
	ifvare countvar 5
	{
		ifaction MACEFRAMES action MACEFRAMES2 else
		ifaction MACEFRAMES2 action MACEFRAMES3 else
		ifaction MACEFRAMES3 action MACEFRAMES4 else
		ifaction MACEFRAMES4 action MACEFRAMES5 else
		ifaction MACEFRAMES5 action MACEFRAMES6 else
		ifaction MACEFRAMES6 action MACEFRAMES7 else
		ifaction MACEFRAMES7 action MACEFRAMES
		setvar countvar 0
		setactorvar[THISACTOR].ACTORCOUNT countvar
	}
}
.
.
.
endevent

define MACE2 7408
define MACESTAND 7414
action MACEFRAMES 0 1 1
action MACEFRAMES2 1 1 1
action MACEFRAMES3 2 1 1
action MACEFRAMES4 3 1 1
action MACEFRAMES5 4 1 1
action MACEFRAMES6 5 1 1
action MACEFRAMES7 6 1 1

defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2
defineprojectile MACE2 PROJ_SPAWNS MACESTAND
defineprojectile MACE2 PROJ_VEL 125 
defineprojectile MACE2 PROJ_EXTRA 0
defineprojectile MACE2 PROJ_DROP -75
defineprojectile MACE2 PROJ_ISOUND -1 
defineprojectile MACE2 PROJ_HITRADIUS 1
defineprojectile MACE2 PROJ_BOUNCES 4
defineprojectile MACE2 PROJ_BSOUND -1
defineprojectile MACE2 PROJ_XREPEAT 50
defineprojectile MACE2 PROJ_YREPEAT 50
defineprojectile MACE2 PROJ_CSTAT 1
defineprojectile MACE2 PROJ_CLIPDIST 70

useractor notenemy MACE2 0 MACEFRAMES enda

useractor notenemy MACESTAND 0
sizeat 50 50
enda


That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.

This post has been edited by XThX2: 11 June 2009 - 04:06 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#25

View PostXThX2, on Jun 11 2009, 05:05 AM, said:

onevent EVENT_GAME
.
.
.
ifactor MACE2
{
	getactorvar[THISACTOR].ACTORCOUNT countvar
	addvar countvar 1
	setactorvar[THISACTOR].ACTORCOUNT countvar
	
	ifvare countvar 5
	{
		ifaction MACEFRAMES action MACEFRAMES2 else
		ifaction MACEFRAMES2 action MACEFRAMES3 else
		ifaction MACEFRAMES3 action MACEFRAMES4 else
		ifaction MACEFRAMES4 action MACEFRAMES5 else
		ifaction MACEFRAMES5 action MACEFRAMES6 else
		ifaction MACEFRAMES6 action MACEFRAMES7 else
		ifaction MACEFRAMES7 action MACEFRAMES
		setvar countvar 0
		setactorvar[THISACTOR].ACTORCOUNT countvar
	}
}
.
.
.
endevent

define MACE2 7408
define MACESTAND 7414
action MACEFRAMES 0 1 1
action MACEFRAMES2 1 1 1
action MACEFRAMES3 2 1 1
action MACEFRAMES4 3 1 1
action MACEFRAMES5 4 1 1
action MACEFRAMES6 5 1 1
action MACEFRAMES7 6 1 1

defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2
defineprojectile MACE2 PROJ_SPAWNS MACESTAND
defineprojectile MACE2 PROJ_VEL 125 
defineprojectile MACE2 PROJ_EXTRA 0
defineprojectile MACE2 PROJ_DROP -75
defineprojectile MACE2 PROJ_ISOUND -1 
defineprojectile MACE2 PROJ_HITRADIUS 1
defineprojectile MACE2 PROJ_BOUNCES 4
defineprojectile MACE2 PROJ_BSOUND -1
defineprojectile MACE2 PROJ_XREPEAT 50
defineprojectile MACE2 PROJ_YREPEAT 50
defineprojectile MACE2 PROJ_CSTAT 1
defineprojectile MACE2 PROJ_CLIPDIST 70

useractor notenemy MACE2 0 MACEFRAMES enda

useractor notenemy MACESTAND 0
sizeat 50 50
enda


That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.



There is a bug in the current version of EDuke32 which causes actors spawned by bouncing projectiles to end up in random places (often so far away from the projectiles it appears they aren't spawning at all). The bug has been fixed, but the fixed version won't be released until polymer is. If you want the fix you need to use a recent polymer build.

As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.
0

User is offline   Jimmy 

  • Let's go Brandon!

#26

Well, that explains a lot, actually.
0

User is offline   XThX2 

#27

View PostDeeperThought, on Jun 11 2009, 06:36 AM, said:

There is a bug in the current version of EDuke32 which causes actors spawned by bouncing projectiles to end up in random places (often so far away from the projectiles it appears they aren't spawning at all). The bug has been fixed, but the fixed version won't be released until polymer is. If you want the fix you need to use a recent polymer build.

As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.


Hmm I guess I can wait the polymer's release... (I hope it is released shortly)
0

User is offline   XThX2 

#28

Has anyone experienced the player hitting the ceiling before? When the map starts I mean... Well I don't remember changing anything about player and his height but somehow he jumps infinitely till he hits the ceiling... and stops there hanging on the air. Anyone know a reason for this?
0

User is offline   Mblackwell 

  • Evil Overlord

#29

Hilariously I had this bug once a long time ago.

Unfortunately I can't remember what causes it. What was the last thing you implemented before you saw the bug?
0

User is offline   Danukem 

  • Duke Plus Developer

#30

Setting jumping_counter to one of the values that causes upward acceleration would do that.
0

Share this topic:


  • 115 Pages +
  • 1
  • 2
  • 3
  • 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