01-06-2007, 10:03 PM | #81 | |
Re: EDuke32 Scripting (CON coding)
Quote:
Code:
state countnearactor setvar countvar 0 setvar temp 0 whilevarn temp 16384 { getactor[temp].statnum tempb ifvarn tempb 1024 { getactor[temp].picnum tempb ifvarvare tempb picnum { ldist tempb THISACTOR temp ifvarvarl tempb xydist addvar countvar 1 } addvar temp 1 } ends // In actor code... setvar picnum PIGCOP setvar xydist 16384 state countnearactor
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
01-06-2007, 10:28 PM | #82 |
Re: EDuke32 Scripting (CON coding)
Remember that part about the structs not being cleared when you load or reload a map?
So with that code alone you're going to run into some trouble.
__________________
I don't wanna be like other people are Don't wanna own a key, don't wanna wash my car Don't wanna have to work like other people do I want it to be free, I want it to be true Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus |
|
01-06-2007, 10:38 PM | #83 |
Re: EDuke32 Scripting (CON coding)
Why would he run into trouble? He checks whether or not the sprites actually exist in the map.
|
|
01-07-2007, 12:28 AM | #84 |
Re: EDuke32 Scripting (CON coding)
Ah, good on.
__________________
I don't wanna be like other people are Don't wanna own a key, don't wanna wash my car Don't wanna have to work like other people do I want it to be free, I want it to be true Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus |
|
01-07-2007, 01:29 AM | #85 |
Re: EDuke32 Scripting (CON coding)
I did leave out a } , though
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-11-2007, 05:02 PM | #86 |
Re: EDuke32 Scripting (CON coding)
I'm having trouble tracking down a bug. I sometimes have garbage death messages, where it plays strange quotes.
When a bot's htextra is greater than 0, it gets its htowner into a var called whoshotme. If the bot is killed, I check whoshotme to determine what death message to display. To debug, I've been displaying the picnum of whoshotme, as well as the htpicnum of the bot. I just had a bot which, according to the display, was killed by a 2595 (SHOTSPARK1), and the picnum of whoshotme was 3056. But, tile 3056 is not used anywhere in my game. I'm trying to figure out why my bot thinks it was shot by a sprite that shouldn't exist. One obvious possibility is that I accidentally messed with whoshotme or the picnum member of whoshotme, but I haven't been able to find anywhere in my code where that could happen. Any other ideas? P.S. The death message is displayed in the same tick when the bot is shot, and a SHOTSPARK1 hits instantly, so I don't know how the whoshotme actor could have died in that time, or if that explain it even if it had died.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more.
Last edited by DeeperThought; 01-11-2007 at 05:08 PM.
|
|
01-12-2007, 05:20 AM | #87 |
Re: EDuke32 Scripting (CON coding)
I hate to ask... but why wouldn't you just check ifhitweapon ifdead getactor[THISACTOR].htowner TEMP?
__________________
I don't wanna be like other people are Don't wanna own a key, don't wanna wash my car Don't wanna have to work like other people do I want it to be free, I want it to be true Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus |
|
01-12-2007, 09:41 AM | #88 | |
Re: EDuke32 Scripting (CON coding)
Quote:
That just tells me which sprite spawned the projectile, not necessarily the player who was ultimately responsible for causing the damage. For example, when an auto turret gets a kill, the kill needs to be credited to the player who spawned the turret, not to the turret. Also, with some of my fancier weapons, there can be a chain of projectiles and actors that get spawned before damage is done. Theoretically, the original owner is passed along to each member of the chain... One complication is that the original owner sprite may have been removed from the map (i.e. the bot has been blown to bits) by the time the weapon does any damage. My solution for that is to set the owner not to the bot sprite, but to a persistent sprite which acts as a proxy for the bot (and is also responsible for respawning it and keeping track of its score). The system seems to work 95% of the time, but getting it to work that last 5% has proven to be very difficult for me.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
01-13-2007, 09:03 PM | #89 |
Re: EDuke32 Scripting (CON coding)
I've had some problems getting complicated ownership chains working with the kill counters, too, but I've never had a case in which an actor thinks it was shot by another actor that doesn't exist. The weirdest case I ran into was an enemy thinking it was killed by an actor that never shoots anything, but the problem turned out to be that I wasn't checking to see if the value of htowner was in-bounds before continuing with my code, and that probably isn't your problem.
My first question would be, is this bug consistently reproducible in specific circumstances, or is it random? Second, maybe try getting some other info about htowner other than the picnum, such as its coordinates, or its owner. |
|
01-13-2007, 09:47 PM | #90 |
Re: EDuke32 Scripting (CON coding)
Hmmm...you have over 2000 posts but almost nothing in the last five years. Am I right in assuming that you did a lot of modding with the original Eduke, but have more-or-less dropped out of the picture since then? Or perhaps you are working on something quietly?
By "out of bounds" do you mean a value that is not between 0 and 16384? I suppose I could check for that, but if I found the value to be out of bounds it would make the death no less mysterious. To answer your questions: One, it seems to be random, but that could just be because I haven't narrowed it down. Two, I did get an owner's owner in one case, but it wasn't helpful, because I didn't get the picnum of the owner Frankly, I'm not motivated to do the detective work necessary to track it down right now.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-13-2007, 10:20 PM | #91 |
Re: EDuke32 Scripting (CON coding)
Meh, random is just a specific circumstance which isn't yet known.
|
|
01-14-2007, 07:11 PM | #92 |
Re: EDuke32 Scripting (CON coding)
I was messing with the tripbomb today and the explosion2 spawned by the tripbomb was returning an owner's picnum that isn't used anywhere in the game, because the tripbomb spawns the explosion and does a killit just a few lines of code later in the engine; the owner value was right, but it pointed to junk. Perhaps this fairly obvious observation has something to do with your problem. I dunno.
I was on the original Eduke team, but I kinda drifted away once the project seemed to lose focus and Matt released fewer and fewer updates. I didn't even know about a Win32 version until a month ago. ...or which is too annoying to bother figuring out. |
|
01-14-2007, 07:36 PM | #93 | |
Re: EDuke32 Scripting (CON coding)
Yes, that is a source of errors. But as I said before...
Quote:
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
01-21-2007, 05:23 PM | #94 |
Re: EDuke32 Scripting (CON coding)
I need some help again.
The problem has to do with hitradius. Through various testing via my game's death obituaries and the invulnerability powerup I have, I've noticed the hitradius command doesn't save the 'owner' of the hitradius into memory, and therefore in the case of my obituaries, it gives me the "Killed by unknown object" message instead of "Killed by [owner of hitradius]". The reason is this a major problem is because the invulnerability field for killing things in my game[in both the player and the monsters case] uses hitradius, and because it can't detect the 'owner', if two monsters using invuln collide with another, the player dies instantly due to the fact it is not getting the owner of the attack and defaulting to the player it seems. I tried using a custom projectile to spawn a projectile that explodes the moment it spawns with an identical explosion to the usual invulnerability field's hitradius, but it has not had success due to the fact that if I set the NOENEMYHITS flag, the explosion will not only hot hurt monsters, but it will not hurt/kill the player either. Is there any other way to spawn an explosion-like radius while allowing it to save its' "owner" into memory, in order to fix this? This bug is very annoying, and I really need to get rid of it if possible.
__________________
http://www.zxdware.net/NR/ - Naferia's Reign: Invasion of the Dark Mistress. Version: 5.15.07152009 NR:IotDM's next release [5.16]: ? |
|
01-21-2007, 05:45 PM | #95 |
Re: EDuke32 Scripting (CON coding)
I don't know whether you are still following what I've been doing with my mods, but I had a very similar problem and solved it in a very similar way, albeit with a few differences.
You are on the right track by having the actor shoot a projectile that immediately spawns a hitradius, rather than doing the hitradius directly. I don't understand why you are setting the NOENEMYHITS flag, though. The only use I have found for that one is when I want a projectile that isn't really a weapon at all (for example, flying jibs). I don't know if this is relevant, but if you want the instantly exploding projectile to set htpicnum of the victim to the picnum of the projectile, rather than RADIUSEXPLOSION, you need to add 65536 to the WORKSLIKE of the projectile. If you don't want to go the custom projectile route, then you can still do the hitradius directly. In that case you findnearactorz for victims within the same distance as the hitradius, then set htowner of the victim to THISACTOR. That's not good enough for my purposes, though, because it won't work well if there are multiple victims. EDIT: If all you are concerned about is the player, then you can just: hitradius 2048 blah blah blah ifpdistl 2048 { getplayer[THISACTOR].i temp setactor[temp].htowner THISACTOR }
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more.
Last edited by DeeperThought; 01-21-2007 at 05:56 PM.
|
|
01-22-2007, 02:07 AM | #96 |
Re: EDuke32 Scripting (CON coding)
Several months ago Hendricks266 asked about how to make that old md2 rocket model pitch correctly when fired as a projectile, so that it doesn't lie flat in the air when moving at an upward or downward trajectory. Now that the latest snapshot supports correct rendering of md2 models with altered pitch, we can do this.
I have some code here that's very close to correct. Code:
EVENT_EGS getactor[THISACTOR].picnum temp switch temp case RPG getactor[THISACTOR].xvel xvel getactor[THISACTOR].zvel zvel mulvar zvel 14 divvarvar zvel xvel setactor[THISACTOR].pitch zvel break ...
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-22-2007, 10:04 AM | #97 |
|
Re: EDuke32 Scripting (CON coding)
a question - what is the event which controls exit to menu (escape) in game ?
|
01-22-2007, 11:07 AM | #98 |
Re: EDuke32 Scripting (CON coding)
So, now that you know how to do this (as demonstrated by that very impressive screenshot that you just posted), are you going to share it with the rest of us?
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-22-2007, 11:10 AM | #99 |
|
Re: EDuke32 Scripting (CON coding)
I don't know I just used quickkick instead of this
|
01-22-2007, 11:24 AM | #100 |
Re: EDuke32 Scripting (CON coding)
In your screenshot, it says ESC - EXIT.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-22-2007, 11:29 AM | #101 |
|
Re: EDuke32 Scripting (CON coding)
just changed that to Q
|
01-22-2007, 03:00 PM | #102 |
|
Re: EDuke32 Scripting (CON coding)
Hey! How to manipulate with weapon to make it more accurate? I forgot
Och, found that, sorry. |
01-22-2007, 04:25 PM | #103 |
|
Re: EDuke32 Scripting (CON coding)
Hey, any way to get to userdef that controls autoaim ? Or any other way to control autoaim? Is it something to do with EVENT_GETAUTOAIMANGLE? If yes, how to use it?
|
01-22-2007, 04:35 PM | #104 |
Re: EDuke32 Scripting (CON coding)
Yes, you can override the userdef and player members that control autoaim.
|
|
01-22-2007, 05:14 PM | #105 |
|
Re: EDuke32 Scripting (CON coding)
But I can't see any command on eduke32 wiki (maybe I'm blind). If there is one, how to set that to make equal with the "hitscan" in options?
|
01-22-2007, 06:20 PM | #106 |
Re: EDuke32 Scripting (CON coding)
I don't understand what you are trying to do. It might help if you said what you want to happen in the game.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-22-2007, 06:53 PM | #107 |
Re: EDuke32 Scripting (CON coding)
From the original Eduke changelog:
Code:
EVENT_GETAUTOAIMANGLE Called when the auto aim angle is desired for the weapon. Set 'AUTOAIMANGLE' to zero to disable auto-aim for the weapon. Default value for AUTOAIMANGLE is 48. onevent EVENT_GETAUTOAIMANGLE { // default is 48 ifvare WORKSLIKE PISTOL_WEAPON { setvar AUTOAIMANGLE 64 // a 'wider' auto-aim angle. } } endevent |
|
01-22-2007, 07:03 PM | #108 |
Re: EDuke32 Scripting (CON coding)
He's trying to force the game to always behave as if the auto-aim option in the menu was set to only auto-aim hitscan projectiles. Just, er, set the menu option to hitscan, check the cfg file for the value of the auto-aim option, and then constantly set the player's auto_aim member to that value.
|
|
01-22-2007, 07:07 PM | #109 |
|
Re: EDuke32 Scripting (CON coding)
No, I'm not SO stupid I'm trying to make some weapons always auto aim off and for one always on. Thanks anyway
|
01-22-2007, 07:18 PM | #110 |
Re: EDuke32 Scripting (CON coding)
I just added this to the EDuke32 Wiki.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-23-2007, 01:33 PM | #111 |
Re: EDuke32 Scripting (CON coding)
I'm trying to make a pipebomb that explodes in a different way from the standard one. I would like this pipebomb to be detonated by the button press, like a normal pipebomb. I've discovered that firing events are triggered when the player throws pipebombs, but they are not triggered when the player presses the button to detonate them. I have tried EVENT_FIRE, EVENT_FIREWEAPON, EVENT_PRESSEDFIRE, and EVENT_DOFIRE, and not one of them is triggered by the button press. Is there any way of detecting it?
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-23-2007, 03:18 PM | #112 |
Re: EDuke32 Scripting (CON coding)
Code:
onevent EVENT_FIRE\EVENT_FIREWEAPON\EVENT_PRESSEDFIRE\EVENT_DOFIRE ifvare WEAPON 10 { <insert code here> } endevent 0. Mighty Foot 1. Pistol 2. Shotgun 3. Chaingun Cannon - Ripper 4. RPG 5. Pipebomb 6. Shrinker 7. Devastator 8. Laser Tripbomb 9. Freezethrower - Freezer 10. Pipebomb Detonator 11. Expander So, by verifying WEAPON to be 10, you can replicate the pipebomb detonation effect. |
|
01-23-2007, 03:21 PM | #113 |
Re: EDuke32 Scripting (CON coding)
All you had to say was that the detonator is weapon 10. Somehow, that important fact eluded me for all this time. Thank you.
Don't you mean currentweapon, not WEAPON?
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-23-2007, 03:35 PM | #114 |
Re: EDuke32 Scripting (CON coding)
I got this from “gamevars.txt”, which was produced using the “-nD” command line switch.
Code:
// Current Game Definitions <insert all the WEAPON*_ gamevars here> gamevar GRENADE_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER // (system) gamevar GRENADE_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER // (system) gamevar STICKYBOMB_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER // (system) gamevar STICKYBOMB_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER // (system) gamevar TRIPBOMB_CONTROL 1 GAMEVAR_FLAG_PERPLAYER // (system) gamevar PIPEBOMB_CONTROL 1 GAMEVAR_FLAG_PERPLAYER // (system) gamevar RESPAWN_MONSTERS 0 0 // (system) (pointer) gamevar RESPAWN_ITEMS 0 0 // (system) (pointer) gamevar RESPAWN_INVENTORY 0 0 // (system) (pointer) gamevar MONSTERS_OFF 0 0 // (system) (pointer) gamevar MARKER 0 0 // (system) (pointer) gamevar FFIRE 0 0 // (system) (pointer) gamevar LEVEL 0 0 // (system) (pointer) (read only) gamevar VOLUME 0 0 // (system) (pointer) (read only) gamevar COOP 0 0 // (system) (pointer) gamevar MULTIMODE 1 0 // (system) (pointer) gamevar WEAPON 0 GAMEVAR_FLAG_PERPLAYER // (system) (read only) gamevar WORKSLIKE 0 GAMEVAR_FLAG_PERPLAYER // (system) (read only) gamevar RETURN 0 0 // (system) gamevar ZRANGE 4 GAMEVAR_FLAG_PERPLAYER // (system) gamevar ANGRANGE 18 GAMEVAR_FLAG_PERPLAYER // (system) gamevar AUTOAIMANGLE 0 GAMEVAR_FLAG_PERPLAYER // (system) gamevar LOTAG 0 0 // (system) gamevar HITAG 0 0 // (system) gamevar TEXTURE 0 0 // (system) gamevar THISACTOR 0 0 // (system) (read only) gamevar myconnectindex 0 0 // (system) (pointer) (read only) gamevar screenpeek 0 0 // (system) (pointer) (read only) gamevar currentweapon 0 0 // (system) (pointer) gamevar gs 0 0 // (system) (pointer) gamevar looking_arc 0 0 // (system) (pointer) gamevar gun_pos 0 0 // (system) (pointer) gamevar weapon_xoffset 0 0 // (system) (pointer) gamevar weaponcount 0 0 // (system) (pointer) gamevar looking_angSR1 0 0 // (system) (pointer) gamevar xdim 0 0 // (system) (pointer) (read only) gamevar ydim 0 0 // (system) (pointer) (read only) gamevar windowx1 0 0 // (system) (pointer) (read only) gamevar windowx2 0 0 // (system) (pointer) (read only) gamevar windowy1 0 0 // (system) (pointer) (read only) gamevar windowy2 0 0 // (system) (pointer) (read only) gamevar totalclock 0 0 // (system) (pointer) (read only) gamevar lastvisinc 0 0 // (system) (pointer) gamevar numsectors 0 0 // (system) (pointer) (read only) gamevar numplayers 0 0 // (system) (pointer) (read only) gamevar viewingrange 0 0 // (system) (pointer) (read only) gamevar yxaspect 0 0 // (system) (pointer) (read only) gamevar gravitationalconstant 176 0 // (system) (pointer) gamevar gametype_flags 19484 0 // (system) (pointer) gamevar framerate 0 0 // (system) (pointer) (read only) gamevar CLIPMASK0 65537 0 // (system) (read only) gamevar CLIPMASK1 16777280 0 // (system) (read only) // end of game definitions |
|
01-23-2007, 04:59 PM | #115 |
Re: EDuke32 Scripting (CON coding)
"currentweapon" is only for display events, and never for anything that changes the game world, as noted on the wiki.
|
|
01-26-2007, 11:39 PM | #116 |
Re: EDuke32 Scripting (CON coding)
For your next exercise, make it so that the player shoots bullets (complete with a gun firing sound) when pressing the use key (spacebar). Of course, that's extremely simple, so once you've done that, make it so that holding down the use key will fire them at a reasonable rate (like, one every 5 ticks or so, instead of constantly).
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-26-2007, 11:44 PM | #117 |
Re: EDuke32 Scripting (CON coding)
ok sounds good (but why did you pull it to this thread instead of my original one)
Edit: ok how do you add a delay to an object
Last edited by Dopefish7590; 01-27-2007 at 12:08 AM.
|
|
01-26-2007, 11:51 PM | #118 |
Re: EDuke32 Scripting (CON coding)
Because I have a fastitious streak that manifests itself every now and then. I started this thread to be about con coding, so I thought it made sense to do the coding bootcamp here.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
01-26-2007, 11:54 PM | #119 | |
Re: EDuke32 Scripting (CON coding)
Quote:
Oh My...
__________________
I Know Everything There Is To Know About Anything. Duke Nukem Red Alert SVN Ask Me Anything! |
||
01-27-2007, 12:15 AM | #120 |
Re: EDuke32 Scripting (CON coding)
ok how do you add a delay to an object
btw deeperthought I will make it shoot lasers because its more unique ok? |
|
Bookmarks |
Tags |
con code, con help, eduke32, eduke32 scripting |
|
|