
EDuke32 Scripting "CON coding help"
#1675 Posted 24 September 2015 - 10:24 AM
How to modify weapon stats? Like how fast it shoots, what art it loads and etc. For example, changing Devastator's firing speed to be much slower and also its rockets to make them bigger.
How can I fully copy of an enemy but with different skin? I'd like to have fully copy ALIZ for example. I got two soldiers one is male and other is female.
How do I remove intro video? Is there way to just add con code or do I just need 1 millisecond long video replacement?
#1676 Posted 24 September 2015 - 10:43 AM
Then when you're ready to edit the actual stuff the weapons emit, check Defineprojectile.
For skipping the intro video, check the LOGO_FLAGS. It defaults to 255, so if you want to remove, say the LOGO_DUKENUKEM, you remove 32 from the value.
This post has been edited by Daedolon: 24 September 2015 - 10:49 AM
#1677 Posted 24 September 2015 - 11:54 AM
Daedolon, on 24 September 2015 - 10:43 AM, said:
So how I would type it?
gamevar LOGO_DUKENUKEM 0 0?
Not good with CON coding.
#1678 Posted 25 September 2015 - 12:02 AM
If you want to deactivate LOGO_DUKENUKEM which has a value of 32, you deduct that from 255 and use it like this: gamevar LOGO_FLAGS 223 0.
Following the wiki, all these bits are already set by default:
1 - LOGO_ENABLED
2 - LOGO_PLAYANIM
4 - LOGO_PLAYMUSIC
8 - LOGO_3DRSCREEN
16 - LOGO_TITLESCREEN
32 - LOGO_DUKENUKEM
64 - LOGO_THREEDEE
128 - LOGO_PLUTOPAKSPRITE
Add the values and you have 255. That's the default. If you go above that, e.g. in order to put LOGO_SHAREWARESCREENS (256), it is 256+255, so: gamevar LOGO_FLAGS 511 0. You can combine modifications, then you have to add more values. For example, if you don't want the ep.1 and ep.2 cutscenes to show, you use these:
4096 - LOGO_NOE1BONUSSCENE
8192 - LOGO_NOE2BONUSSCENE
Adding them is 12288, so 12288+255 = 12543. Result: gamevar LOGO_FLAGS 12543 0.
Bottom line is: Add conditions by adding values, remove them by subtracting values. It's a bit tricky with the "NO" entries (LOGO_NOE1BONUSSCENE, LOGO_NODUKETEAMTEXT etc) since in those cases you have to add values to remove something, but you get the hang of it quickly. Please correct me if I am wrong here.
This post has been edited by NightFright: 25 September 2015 - 12:13 AM
#1680 Posted 25 September 2015 - 04:35 AM
gamevar LOGO_FLAGS 2095359 0in GAME.CON and my own custom .CON to disable all cutscenes but nothing. They all still show up.
Then I tried
gamevar LOGO_FLAGS 223 0to disable Duke Nukem text appearing but it still shows up.
So then..
gamevar LOGO_FLAGS 251 0to disable menu music but that didn't work either. What did I miss?
Oh ffs. Nevermind. It's working exactly as it should. Thanks guys. I forked up.
This post has been edited by Jenz/Amaka: 26 September 2015 - 12:41 AM
#1681 Posted 26 September 2015 - 04:15 AM
Firstly I want to create an equivalent of a sector effector to perform various custom trickery. The issue will be if I implement this as a useractor then it's actor code may not run because it is sleeping (statnum = zombie). So, is there a way of making a never-sleeps useractor ?
I notice there are events 'EVENT_GAME' or 'EVENT PREGAME' which fire for each actor per game tic, but it is not clear whether these will still run for zombie actors. If there was an EVENT_TIC (which there isn't) then I guess I could use it to force my custom sprite's statnum back to 1 (awake) and I might be able to infer my hypothetical EVENT_TIC using some logic in EVENT_GAME, but this is all sounding rather wasteful of CPU cycles as well as messy.
Or .. is there another better way to implement this?
Secondly, as part of said trickery, how do I detect when a 'channel' fires (e.g. from switch, touchplate, etc) ? It would be jolly useful if there was a game event that signalled this but I can't see one. For switches I could iterate through all sprites (or a subset based on statnum) looking for appropriately tagged switches and get their state from picnum but that feels like it could add a lot of processor overhead if I did it on every game tic.
Finally it would be nice if my custom sector effector would allow me to utilise the lotag for my own purposes but currently if this is non-zero then my custom sector effector is deleted in game, presumably 'cos the lotag is being interpretted as multiplayer only or something (or is it skill level ? I forget). Whatever is there a way around this behaviour?
[Edit] Ah-ha ! Saving the lotag in a gamevar during eventloadactor and then setting lotag 0 fixes that last issue.
TTFN,
Jon
This post has been edited by The Mechanic: 26 September 2015 - 04:28 AM
#1682 Posted 27 September 2015 - 03:23 AM
This post has been edited by December Man: 27 September 2015 - 03:24 AM
#1683 Posted 27 September 2015 - 06:46 AM
#1684 Posted 27 September 2015 - 09:15 AM
#1685 Posted 30 September 2015 - 07:36 AM
First is that Lizman's Copy size ingame is huge. I know that I gotta put this code, but I don't know where.
{ sizeat 42 40 cstator 257 }
And also them Lizman's copies seem to attack immediately even when the player is not seen.
#1687 Posted 30 September 2015 - 11:05 AM
This post has been edited by Mark.: 30 September 2015 - 11:07 AM
#1688 Posted 30 September 2015 - 01:02 PM
Jenz/Amaka, on 30 September 2015 - 07:36 AM, said:
First is that Lizman's Copy size ingame is huge. I know that I gotta put this code, but I don't know where.
{ sizeat 42 40 cstator 257 }
And also them Lizman's copies seem to attack immediately even when the player is not seen.
That's because some enemies are hard-coded. In other words, part of the code is written directly in the executable.
Add this somewhere in the CON (obviously not using the LIZMAN tile):
appendevent EVENT_LOADACTOR switch sprite[THISACTOR].picnum case LIZMAN case LIZMANSTAYPUT case LIZMANSPITTING case LIZMANJUMP sizeat 40 40 clipdist 80 cstator 257 break endswitch endevent
Find these parts:
actor LIZMANSTAYPUT LIZSTRENGTH ai AILIZGETENEMY cactor LIZMAN enda
actor LIZMANSPITTING LIZSTRENGTH ai AILIZSPIT cactor LIZMAN enda
actor LIZMANJUMP LIZSTRENGTH ai AILIZJUMPENEMY cactor LIZMAN enda
actor LIZMAN LIZSTRENGTH
Replace with:
useractor enemy LIZMANSTAYPUT LIZSTRENGTH ai AILIZGETENEMY cactor LIZMAN enda
useractor enemy LIZMANSPITTING LIZSTRENGTH ai AILIZSPIT cactor LIZMAN enda
useractor enemy LIZMANJUMP LIZSTRENGTH ai AILIZJUMPENEMY cactor LIZMAN enda
useractor enemy LIZMAN LIZSTRENGTH
This post has been edited by Fox: 01 October 2015 - 01:36 AM
#1689 Posted 01 October 2015 - 01:20 AM
Fox, on 30 September 2015 - 01:02 PM, said:
Add this somewhere in the CON (obviously not using the LIZMAN tile):
appendevent EVENT_LOADACTOR switch sprite[THISACTOR].picnum case LIZMAN case LIZMANSTAYPUT case LIZMANSPITTING case LIZMANJUMP sizeat 40 40 clipdist 80 cstator 257 break endswitch
I tried adding that code. I tried at the start of .con, end, different .con, and they all give same errors.
DS_GAME.CON: In event `EVENT_LOADACTOR': DS_GAME.CON:33: error: parameter `ANULLACTION' is undefined. DS_GAME.CON:33: error: expected a keyword but found `0'. Found 0 warning(s), 2 error(s).
#1691 Posted 01 October 2015 - 01:37 AM
action ANULLACTION 0
nvm
This post has been edited by Daedolon: 01 October 2015 - 01:37 AM
#1692 Posted 01 October 2015 - 05:54 AM
Fox, on 01 October 2015 - 01:36 AM, said:
That did it! Many thanks, Fox!

#1693 Posted 02 October 2015 - 11:22 AM
Also, if I may, a repeat of previous question - how do I detect an activator firing from within CON code ? Possible ? Not possible ?
TTFN,
Jon
#1694 Posted 02 October 2015 - 01:22 PM
The Mechanic, on 02 October 2015 - 11:22 AM, said:
I'm not entirely sure what you are asking, but you might be saying that when you spawn an enemy, the max number of kills in the map does not get increased. If that's the case, then you can fix that by reading/writing the following:
http://wiki.eduke32....x_actors_killed
The Mechanic, on 02 October 2015 - 11:22 AM, said:
You can try this command:
http://wiki.eduke32....activatormotion
IIRC it only works in certain contexts. I ended up making my own special activators by looping through sprites and changing, checking per-actor gamevars.
#1695 Posted 02 October 2015 - 11:40 PM
Trooper Dan, on 02 October 2015 - 01:22 PM, said:
http://wiki.eduke32....x_actors_killed
D'oh !

Anyhow, when I detect a player triggering one of my respawns alls I'll know is the player's THISACTOR value. How would I convert this to the relevent index into the player structures ? Or is the script system smart enough such that getplayer[THISACTOR] will re-interpret THISACTOR for me ? Or should I just ignore multiplayer and use getplayer[0] ? (I don't play multiplayer and I'm sure I read somewhere that current Eduke versions aren't multiplayer anyway?).
Trooper Dan, on 02 October 2015 - 01:22 PM, said:
http://wiki.eduke32....activatormotion
IIRC it only works in certain contexts. I ended up making my own special activators by looping through sprites and changing, checking per-actor gamevars.
I couldn't see how to use checkactivatormotion. At the moment I've implemented what you have done, my own activator system and grouping sprites as a chains of groups of sprites (debugging a linked list of linked lists in a primitive script language and no debugging tools nearly did for what little is left of my sanity!). Unfortunately it does mean I need helper sectors (e.g. a door) to translate a standard activator to jonz system, which is a nuiscence.
Can you provide any further info on the contexts in which Checkactivatormotion works ?
Currently my main game loop looks like this:
gamevar ticky 0 0 gamevar startupdebug 1 0 // Called once per "tic" _per_ _actor_. Not clear if this gets called for actors that the // game has decided are temporarily zombied ? Jonz sprites are not useractors so maybe // will never be zombied ?? onevent EVENT_GAME ifvarn startupdebug 0 { ... dump some debug stuff setvar startupdebug 0 } // Fudge: There is no event that runs once per tick so we need to infer one. // Ticks are roughly in milliseconds. This is NOT accurate for multiplayer // and game should never sync to this for multiplayer. TODO: Use what else? getticks temp1 setvarvar temp2 temp1 subvarvar temp2 ticky ifvarg temp2 33 // Roughly 30 times per second. Ish. { setvarvar ticky temp1 // Process jonz main sprite system // This is more efficient this way otherwise I'd be searching chains of // groups of sprites for every actor on every tick. What I need is an EVENT_GAME // that runs once per game tic but there isn't one ? state process_allsectormonitors state update_sectorchangers //state move_sprite_groups TODO // TODO : revise this if how sounds are played is influenced by THISACTOR state update_jsounds } // These effects may spawn objects so will only work if THISACTOR is correctly set. state update_alljeffects state update_alljrespawns endevent
It has happened this way because I'm not confident about when, or what happens, should my sprites get marked by Eduke as zombied because the player hasn't seen them in a while (however they are _not_ useractors). Also unless I've missed something there is no event that fires once per game tick - plus I dont know the interval of a game tick.
TTFN,
Jon
#1696 Posted 03 October 2015 - 12:22 AM
The Mechanic, on 02 October 2015 - 11:40 PM, said:

If you want RESPAWNs to continue working after being activated, use this:
appendevent EVENT_KILLIT ifactor RESPAWN { setvar RETURN -1 setactor[THISACTOR].extra 0 } endevent
The Mechanic, on 02 October 2015 - 11:40 PM, said:
Yes, it will re-interpret THISACTOR. If you use it for getactor, THISACTOR returns the current actor ID, for getplayer it will be the nearest player ID, and for getsector it will be the current actor sector ID.
It's tricky, but in multiplayer you would have to change the value of max_actors_killed for all players...
The Mechanic, on 02 October 2015 - 11:40 PM, said:
[...]
It has happened this way because I'm not confident about when, or what happens, should my sprites get marked by Eduke as zombied because the player hasn't seen them in a while (however they are _not_ useractors). Also unless I've missed something there is no event that fires once per game tick - plus I dont know the interval of a game tick.
TTFN,
Jon
Not sure where you are getting with this. First of all, EVENT_GAME runs every tic for all existing sprites in the map, including sleeping (zombie) actors. So a global gamevar would be overwritten.
If you want to prevent an actor from ever sleeping, I believe this would work:
onevent EVENT_GAME ifactor MYACTOR setactor[THISACTOR].httimetosleep 0 endevent
This post has been edited by Fox: 03 October 2015 - 12:22 AM
#1697 Posted 03 October 2015 - 01:47 AM
Fox, on 03 October 2015 - 12:22 AM, said:
I did enquire about how to achieve what I'm trying to do in previous threads when I was at the planning stage, this so far has been the only way I've been able to move forward.
I have sprites grouped into functional groups as sprites within a group interact with each other, with one sprite within that group acting as a master. When I wrote that piece of code you need to bear in mind that I couldn't get an answer on whether EVENT_GAME would still get called for sleeping sprites so this was the only way I could see to absolutely gaurentee my sprites would get processed. A gaurentee that EVENT_GAME is _always_ called for every sprite will certainly make my life easier.
Fox, on 03 October 2015 - 12:22 AM, said:
appendevent EVENT_KILLIT ifactor RESPAWN { setvar RETURN -1 setactor[THISACTOR].extra 0 } endevent
If a RESPAWN has never respawned during a game then that should be counted as one enemy the player failed to kill. After the first respawn, it does _not_ count as a missed enemy unless it has actually spawned another enemy. I doubt that logic is built into the game.
Hello, what is the actor's 'extra' doing that requires it to be set to 0 ?
Fox, on 03 October 2015 - 12:22 AM, said:
Just to clarify, are you saying that:
getactor[THISACTOR].sectnum temp getsector[temp].somethingorother ....
can actually be done with
getsector[THISACTOR].somethingorother ...
That'd be useful.
Fox, on 03 October 2015 - 12:22 AM, said:
Indeed, I'm hoping that using extspritestat and specifying STAT_PLAYER will iterate through each player, though I'm not sure if the sprite values returned by that function will be valid in accessing the player-specifc sprite vars. Gonna just have to suck it and see.
Fox, on 03 October 2015 - 12:22 AM, said:
This was the vital answer that I hadn't been able to find stated explicitly. When I sketched out the game loop I posted I did not have that as a gaurentee, hence implementing things the way I did.
Fox, on 03 October 2015 - 12:22 AM, said:
onevent EVENT_GAME ifactor MYACTOR setactor[THISACTOR].httimetosleep 0 endevent
Ah, I'd been using this wiki page which didn't mention httimetosleep. After a search, it is listed in this page which shows even more interesting looking stuff. What's going on ? Is the first page a general sprite structure, and the second page adds gamevars that are also applicable to sprites defined as (user)actors? i.e. setactor[THISACTOR].httimetosleep will work for a (user)actor but blow up if I tried to use it on a regular every day decorative sprite ?
TTFN,
Jon
PS: I want 'ifsoundvar' but it doesn't exist. Is there an alternative ? Currently I've a 450 line monster func to attempt this functionality - yeuk! - IIRC, the first time I've used a spreadsheet to generate code !
#1698 Posted 03 October 2015 - 02:14 AM
The Mechanic, on 03 October 2015 - 01:47 AM, said:
I had written a code for that some time ago, as far I remember the results were very precise. I may take a look at it again...
The Mechanic, on 03 October 2015 - 01:47 AM, said:
It's used by the game to make RESPAWNs work. Not my fault.
The Mechanic, on 03 October 2015 - 01:47 AM, said:
getactor[THISACTOR].sectnum temp getsector[temp].somethingorother ....
can actually be done with
getsector[THISACTOR].somethingorother ...
That'd be useful.
Correct.
The Mechanic, on 03 October 2015 - 01:47 AM, said:
In this case, you wouldn't loop through the player actors, but the player IDs.
setvar temp 0 whilevarvarn temp MULTIMODE { getplayer[temp].max_actors_killed temp2 addvar temp2 1 setplayer[temp].max_actors_killed temp2 addvar temp 1 }
The Mechanic, on 03 October 2015 - 01:47 AM, said:
Being even more explicit, note that I said sprites, not actors, because EVENT_GAME also run through decorative sprites or projectiles.
The Mechanic, on 03 October 2015 - 01:47 AM, said:
These pages are redundant. In a website running on a wiki software you define categories for pages, which serve merely for an organizational purpose. However EDukeWiki has its own page for structures, which are preferable.
These structures exist for all sorts of sprites.
The Mechanic, on 03 October 2015 - 01:47 AM, said:
Indeed, that command doesn't appear to exist. Don't forget ifsound is unsynchronized, so be careful!
This post has been edited by Fox: 03 October 2015 - 02:14 AM
#1699 Posted 03 October 2015 - 02:50 AM
#1700 Posted 03 October 2015 - 04:57 AM
Fox, on 03 October 2015 - 02:14 AM, said:
setvar temp 0 whilevarvarn temp MULTIMODE { getplayer[temp].max_actors_killed temp2 addvar temp2 1 setplayer[temp].max_actors_killed temp2 addvar temp 1 }
Ah-ha, so the mysterious MULTIMODE is in fact the number of players. (Does a bit more delving) should that be numplayers as that doesn't include bot players? (for the original purposes of kill count I doubt it makes any difference, but I'm thinking more generally).
Fox, on 03 October 2015 - 02:14 AM, said:
Do you mean unsynchronised between multiple players ? Or something worse ?
The reason I'm using my "ifsoundvar" is only to enable playing one sound effect after another finishes (I've given up doing this with door sectors as duke's door-generated sounds are bloody unpredictable at best), or loop a sound (save building elevator help sectors - that really was a neat trick). I'm not using the end of a sound to do anything more than that so should I get away with it ?
If my object spawns a sound - 71, say - and whilst that is playing some other game event also starts a sound 71 then yes my object will be waiting for the second one to finish, but that is a minor limitation of my system. In practice the sounds spawned by my object are likely to not crop up at the same time elsewhere.
Jblade, on 03 October 2015 - 02:50 AM, said:
By accident yes. (Indeed, 75% of errors I make are 'cos I forget the additioanl 'var' on the end of funcs).
There is 'sound' for playing a fixed sound, 'soundvar' for sounds based on a variable, 'ifsound' to check for a fixed sound and .... (drum roll) ... no fricken 'ifsoundvar'

TTFN,
Jon
This post has been edited by The Mechanic: 03 October 2015 - 05:03 AM
#1701 Posted 03 October 2015 - 05:26 AM
This post has been edited by Mark.: 03 October 2015 - 05:57 AM
#1702 Posted 03 October 2015 - 07:29 AM
Mark., on 03 October 2015 - 05:26 AM, said:
Because I'm creating a re-usable library - think extended/improved version of sector effectors and such. The sound system is also a lot more than only stitching sounds together.
I agree if I were only working on a specific map then, yes, simply whip out CoolEdit Pro or Audacity and stitch the necessary sounds together, job done.
TTFN,
Jon
#1703 Posted 03 October 2015 - 07:44 AM

#1704 Posted 03 October 2015 - 02:17 PM
The Mechanic, on 03 October 2015 - 04:57 AM, said:
Yeah. It's okay to use ifsound to check if a sound should be played. But, for example, sounds are never played if you have sounds off in the menu, so anything that affects the game would break the sync in multiplayer.