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

Jump to content

  • 124 Pages +
  • « First
  • 55
  • 56
  • 57
  • 58
  • 59
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

#1667

 Mblackwell, on 15 September 2015 - 03:21 PM, said:

... If it's 0 then you are out of air.


Thanks for your patience, however at the beginning of the first level of an episode or a user level the gasp for air (not drowning) sound can be heard. Subsequent levels for some reason do not have this problem.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1668

 Mblackwell, on 15 September 2015 - 03:21 PM, said:

gamevar AIR_LEFT 0 1
gamevar AIR_LEFT_LAST 0 1
onevent EVENT_GAME
    ifactor APLAYER
    {
        getplayer[THISACTOR].airleft AIR_LEFT
       
        ifvarvarn AIR_LEFT AIR_LEFT_LAST ifvare AIR_LEFT_LAST 0
            soundonce MY_GASP_SOUND
        else ifvare AIR_LEFT 0
            soundonce MY_DROWNING_SOUND
        
        setvarvar AIR_LEFT_LAST AIR_LEFT
    }
endevent


Fixes:
AIR_LEFT doesn't need to be per-player. Its value isn't kept between tics.
The sound kept playing after the player dies from drowning.
The bug mentioned above.

gamevar temp 0 0
gamevar AIR_LEFT_LAST -1 1

onevent EVENT_GAME
    ifactor APLAYER
    {
        getplayer[THISACTOR].airleft temp

        ifvare AIR_LEFT_LAST -1
            setvarvar AIR_LEFT_LAST temp

        ifvarvarn temp AIR_LEFT_LAST ifvare AIR_LEFT_LAST 0
            soundonce BAR_MUSIC
        else ifvare temp 0
            ifp palive
                soundonce DUKE_KILLED1

        setvarvar AIR_LEFT_LAST temp
    }
endevent

0

#1669

It works! Thanks much!
0

#1670

Is it possible to detect what render mode is being used from within a CON file ? Specifically, I have a above + under water TROR sectors (which are also part of a more complex TROR map) and to stop HOM effects in software render mode I need to change the water texture to solid instead of transparent; i'm hoping that this can be accomplished via a CON file.

TTFN,
Jon
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1671

Yes.

http://wiki.eduke32.com/wiki/Rendmode
1

#1672

 Fox, on 21 September 2015 - 11:55 AM, said:



Cheers Fox :) I checked all the usual haunts on Eduke wiki but they didn't list it. [Feeble excuses]I checked the pre-defined gamevars just didn't think to look in Constantly updated gamevars as simply assumed it wasn't something that'd get updated and I'd used "rendermode" as me google search[/Feeble excuses].

D'Oh!

TTFN,
Jon
0

User is offline   Daedolon 

  • Ancient Blood God

#1673

Tbh, rendmode sounds like something that would belong in Die by the Sword.
0

User is offline   NightFright 

  • The Truth is in here

#1674

I am looking for a method to display some info text at the beginning of each map.

What it's supposed to do:
- Info about the map (in my case: map name, author, creation year)
- Shown after loading of every map (i.e. when you start a new level)
- Duration: 5 secs
- Style: Ideally with the same font of status/pickup/etc messages, centered

Question is: Can it be done (I guess it can), and if so, how? ^^

This post has been edited by NightFright: 22 September 2015 - 07:56 AM

0

User is offline   Jenz/Amaka 

#1675

I got three questions I'd love to know how.
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?
0

User is offline   Daedolon 

  • Ancient Blood God

#1676

For the weapon functionality, check the weaponx variables over at Category:Pre-defined_gamevars

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

1

User is offline   Jenz/Amaka 

#1677

 Daedolon, on 24 September 2015 - 10:43 AM, said:

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.


So how I would type it?
gamevar LOGO_DUKENUKEM 0 0
?
Not good with CON coding.
0

User is offline   NightFright 

  • The Truth is in here

#1678

I am using this in the addon compilation as well. I disable all cutscenes with gamevar LOGO_FLAGS 2095359 0.
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

1

User is offline   Daedolon 

  • Ancient Blood God

#1679

For some quick profit, just set the variable to 5 0.
1

User is offline   Jenz/Amaka 

#1680

Um, I must be missing something. I tried adding...

gamevar LOGO_FLAGS 2095359 0
in 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 0
to disable Duke Nukem text appearing but it still shows up.
So then..
gamevar LOGO_FLAGS 251 0
to 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

0

#1681

Three kinda related questions.

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

0

#1682

It's me again. Is there as a way to disable the pistol casing and shotgun shell sprites ejecting without editing tiles art files? Just with pure con editing? I added casings that drop on the floor as projectiles etc. but now you have these projectiles and the old casings.

This post has been edited by December Man: 27 September 2015 - 03:24 AM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #1683

http://wiki.eduke32....efined_gamevars
http://wiki.eduke32....i/WEAPONx_SPAWN
0

#1684

View PostHendricks266, on 27 September 2015 - 06:46 AM, said:



Well... damn. Thanks.
0

User is offline   Jenz/Amaka 

#1685

Managed to create full copy of Lizman but I got few problems.
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.
0

User is offline   Daedolon 

  • Ancient Blood God

#1686

Anywhere after (user)actor. Preferably at the top.
0

User is offline   Mark 

#1687

Check for lines containing "ifcansee" or "ifcanseetarget" and see if there is something there that needs tweaking. If there are no lines with those commands then you will need to add some. I don't know if you have done this or not, but I recommend looking through other people's custom con files from mods and TCs to get an idea how some things work. That helped me a lot.

This post has been edited by Mark.: 30 September 2015 - 11:07 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1688

View PostJenz/Amaka, on 30 September 2015 - 07:36 AM, said:

Managed to create full copy of Lizman but I got few problems.
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

1

User is offline   Jenz/Amaka 

#1689

Aaaalmost there.

View PostFox, on 30 September 2015 - 01:02 PM, said:

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



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).

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1690

Sorry, I missed the endevent. :/
1

User is offline   Daedolon 

  • Ancient Blood God

#1691

You've removed this from GAME.CON

action ANULLACTION 0


nvm

This post has been edited by Daedolon: 01 October 2015 - 01:37 AM

0

User is offline   Jenz/Amaka 

#1692

View PostFox, on 01 October 2015 - 01:36 AM, said:

Sorry, I missed the endevent. :/

That did it! Many thanks, Fox! :)
0

#1693

I'm intending to respawn enimies from within a CON script (and the standard RESPAWN sprite 'aint gonna cut it). Whilst I can spawn stuff easilly, how do I update the total enemy count ? If the player hasn't killed a monster I have, or intended to have, spawned then it needs to be added to the number of missed kills.

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
0

User is offline   Danukem 

  • Duke Plus Developer

#1694

View PostThe Mechanic, on 02 October 2015 - 11:22 AM, said:

I'm intending to respawn enimies from within a CON script (and the standard RESPAWN sprite 'aint gonna cut it). Whilst I can spawn stuff easilly, how do I update the total enemy count ? If the player hasn't killed a monster I have, or intended to have, spawned then it needs to be added to the number of missed kills.


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

View PostThe Mechanic, on 02 October 2015 - 11:22 AM, said:

Also, if I may, a repeat of previous question - how do I detect an activator firing from within CON code ? Possible ? Not possible ?


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.
1

#1695

View PostTrooper Dan, on 02 October 2015 - 01:22 PM, 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


D'oh ! :) Yes, that is what I need, I thought I'd searched the wiki thoroughly, it just didn't click that it'd be a per-player thing which, of course, now seems obvious. Cheers ! Yes, I want (in theory at least) to be able to have infinite respawns, I think it may be of encouraging players not to revisit an area too often which they can take as a hint they are going the wrong way. After all, if Duke has cleared an area, why wouldn't the aliens send in re-inforcements?

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?).

View PostTrooper Dan, on 02 October 2015 - 01:22 PM, 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.


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
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1696

Dude, what a mess. o_O

View PostThe Mechanic, on 02 October 2015 - 11:40 PM, said:

D'oh ! :) Yes, that is what I need, I thought I'd searched the wiki thoroughly, it just didn't click that it'd be a per-player thing which, of course, now seems obvious. Cheers ! Yes, I want (in theory at least) to be able to have infinite respawns, I think it may be of encouraging players not to revisit an area too often which they can take as a hint they are going the wrong way. After all, if Duke has cleared an area, why wouldn't the aliens send in re-inforcements?

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


View PostThe Mechanic, on 02 October 2015 - 11:40 PM, said:

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?).

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...

View PostThe Mechanic, on 02 October 2015 - 11:40 PM, said:

Currently my main game loop looks like this:
[...]

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

1

Share this topic:


  • 124 Pages +
  • « First
  • 55
  • 56
  • 57
  • 58
  • 59
  • 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