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

Jump to content

  • 124 Pages +
  • « First
  • 93
  • 94
  • 95
  • 96
  • 97
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   dandouglas 

#2813

Cheers Mark, that's a great shout - I can't find the number which references the bonus screen but I'll keep digging on the wiki. Removing "ifvare temp x" turns off the explosion SFX on the bonus screen, so it's definitely possible somehow!

In the meantime I've knocked up a Dukeless intermission which I'm pretty happy with, hiding the stats but retaining the "press any key to continue" prompt.
0

#2814

Might be a long shot, but you have shown to be helpful time and time again.

In our dukematches, I get these logs in netduke32.log:

Line 884, setactor: tried to set ang on invalid target sprite (-1) from spr 503 pic 1405 gv RETURN
Line 896, setactor: tried to set zvel on invalid target sprite (-1) from spr 503 pic 1405 gv RETURN


These lines are repeated maybe 1000 times in a 10 minute game. It seems they come and go. I can't use the line numbers, they don't match anything in my GAME.CON it seems.

What I've tried so far is to have a guard every time I get/set ang or zvel (but it doesn't work):

setvarvar tempsixteen THISACTOR
ifvarn tempsixteen -1 getplayer[THISACTOR].ang tempone


and

setvarvar tempten RETURN
ifvarn tempten -1 getactor[RETURN].zvel tempone


Does the error logs tell me something I can use to find/solve the issue?
0

User is offline   jimbob 

#2815

any way to turn off the map title thats being loaded from the loading screen? just loading is fine for me, i dislike the map title in the screen because it can give away hints, unless i call all my maps something cryptic or just numeric.
0

User is offline   Danukem 

  • Duke Plus Developer

#2816

https://wiki.eduke32...Show_level_text
0

User is offline   jimbob 

#2817

thanks, i missed that one :)
0

#2818

wiki.eduke32.com returns 500, Internal server error atm
0

User is offline   oasiz 

  • Dr. Effector

#2819

Probably a service crashed or something, let's see when TX gets to it.
0

User is offline   oasiz 

  • Dr. Effector

#2820

fixed, apparently an update changed how the installation path is handled in config and that broke things.
0

User is offline   Mark 

#2821

Darn, I was hoping it was down because a huge update was being uploaded with hundreds of easier to understand examples for all the con commands. :D
1

#2822

Does a program exists that can output meta information about a map given the .map file? Things such as num wall, sectors, num of different items etc...?

Edit: Seems I asked too quickly. I found this: https://github.com/lewster32/webbuild, which has what I would need

This post has been edited by thisbecasper: 14 April 2022 - 02:53 PM

0

User is offline   dandouglas 

#2823

Is it possible to link a security camera viewscreen to a switch, i.e. have something activate when the player presses use to view through the camera? I have a number of "TV channels" in my mod and I'd like to have effects and sounds starting when the player views them.

At the moment i'm placing a touchpad right in front of the viewscreen but obviously that creates some sync issues, as I'm relying on the player to hit use immediately upon walking up or the effect is missed.

Cheers!
0

User is offline   Danukem 

  • Duke Plus Developer

#2824

View Postdandouglas, on 18 April 2022 - 05:43 AM, said:

Is it possible to link a security camera viewscreen to a switch, i.e. have something activate when the player presses use to view through the camera? I have a number of "TV channels" in my mod and I'd like to have effects and sounds starting when the player views them.

At the moment i'm placing a touchpad right in front of the viewscreen but obviously that creates some sync issues, as I'm relying on the player to hit use immediately upon walking up or the effect is missed.

Cheers!


Yes, but the first way that comes to mind is a bit convoluted. You would start by tagging the camera sprite with the channel that will activate, but tag it on EXTRA since that isn't used for anything.

If you don't have one already, declare a per actor var for storing channels, and then load that var with the tag.

In your var declarations, add: gamevar mychannel -1 2

Then to save this as a var on the sprite:

eventloadactor CAMERA1 geta[].extra mychannel enda 


Then in the player code, you have to detect whether you are viewing from a camera, and if so check to see if the camera is supposed to activate stuff. Activate stuff if applicable, and then reset the var so it doesn't keep activating continuously.

// this part goes in the APLAYER actor

ifn player[].newowner -1
{
  ifn actorvar[player[].newowner].mychannel -1
  {
    getav[player[].newowner].mychannel mychannel
    operatemasterswitches mychannel
    operaterespawns mychannel
    operateactivators mychannel 0
    setav[player[].newowner].mychannel -1
    set mychannel -1
  }
}

0

User is offline   dandouglas 

#2825

Hi Dan, really sorry but I can't seem to get this working. The setup I currently have is: a Touchplate right in front of the Viewscreen activates a Shooter to kick a sprite in the room I've placed the Camera in, and triggers a sound effect which is only audible when viewing through the camera.

I've removed the Touchplate, given the Camera sprite an Extra value equivalent to the Lotag of the Activator and added your code, but no sound plays now. I've tried using this new setup with another effect (floor rise) and it doesn't trigger the effect either. Any idea what I could be doing wrong? Thank you!
0

User is offline   Danukem 

  • Duke Plus Developer

#2826

Make sure that the eventloadactor part was added; without that the camera will do nothing. I can't really debug it because I don't have the project files.

ifn player[].newowner -1
{
  al THISACTOR
  ifn actorvar[player[].newowner].mychannel -1
  {
    getav[player[].newowner].mychannel mychannel
    al mychannel
    operatemasterswitches mychannel
    operaterespawns mychannel
    operateactivators mychannel 0
    setav[player[].newowner].mychannel -1
    set mychannel -1
  }
}


The "al THISACTOR" will add the player's sprite ID to the log. That should completely spam the log when using a camera so if that doesn't happen then you know the code isn't firing at all and the block of code is most likely in the wrong place.

The "al mychannel" only get logged one time if the camera did get set successfully with a channel. You will need to search the log for an instance of "mychannel" after closing the game since it will be hard to see in the other spam. If that does not appear in the log then you know the camera failed to load the channel number into the var. If it does appear then that means that the operate commands using the channel were insufficient to trigger the shooter for some reason.
0

User is offline   dandouglas 

#2827

Hi Dan, thanks for getting back to me. Still not having any luck with this I'm afraid. Nothing relevant is showing up in eduke32.log (I'm using the Debug version of EDuke32). I tried changing CAMERA1 to VIEWSCREEN in the code and adding the EXTRA tag to the VIEWSCREEN sprite to see if that would work, but no joy either.

This is how I've added the code to my GAME.CON - I appreciate that you may not have any more time to look into this.

gamevar mychannel -1 2

eventloadactor CAMERA1 geta[].extra mychannel enda 

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

ifn player[].newowner -1
{
  al THISACTOR
  ifn actorvar[player[].newowner].mychannel -1
  {
    getav[player[].newowner].mychannel mychannel
    al mychannel
    operatemasterswitches mychannel
    operaterespawns mychannel
    operateactivators mychannel 0
    setav[player[].newowner].mychannel -1
    set mychannel -1
  }
}

0

User is offline   Danukem 

  • Duke Plus Developer

#2828

So that code isn't making the value of THISACTOR be spammed to the log when the player is using a camera?

https://wiki.eduke32.com/wiki/Newowner

I don't really see how that's possible unless the GAME.CON you are editing isn't even being used in the game.
0

User is offline   dandouglas 

#2829

Here's the log I'm seeing - I'm sure the game is using that GAME.CON, I deliberately inserted a typo into it just to double-check and the game failed to compile, and when I removed it from the directory loads of stuff in my mod broke.

Spoiler

0

User is offline   Danukem 

  • Duke Plus Developer

#2830

Alright, I did a little test on my own end. It turns out that the newowner member somehow is always -1 when read from the APLAYER actor, even though it is set elsewhere. This is bizarre to me and I wasn't aware of this until now. Possibly the player sprite that has newowner set is a dummy sprite that is spawned to be viewable via cameras and is not the same as the player actor. In any case, the good news is this is fixable if you move the code out of the APLAYER actor and into EVENT_GAME


gamevar mychannel -1 2

eventloadactor CAMERA1 geta[].extra mychannel enda 

onevent EVENT_GAME

ifactor APLAYER
ifn player[].newowner -1
{
  ifn actorvar[player[].newowner].mychannel -1
  {
    getav[player[].newowner].mychannel mychannel
    al mychannel
    operatemasterswitches mychannel
    operaterespawns mychannel
    operateactivators mychannel 0
    setav[player[].newowner].mychannel -1
    set mychannel -1
  }
}
endevent

1

User is offline   dandouglas 

#2831

Hi Dan, thanks so much - this works perfectly. Really excited to see what I can do with it in the mod and I hugely appreciate you taking the time to put this together.
1

User is offline   Danukem 

  • Duke Plus Developer

#2832

View Postdandouglas, on 21 April 2022 - 01:13 PM, said:

Hi Dan, thanks so much - this works perfectly. Really excited to see what I can do with it in the mod and I hugely appreciate you taking the time to put this together.


Glad to help. I never would have guessed that whether the struct member is set depends on whether you access it from the actor or in the event. Scripting Duke has a lot of weirds quirks, though, so I shouldn't be that surprised.
1

User is offline   zazo 

#2833

Hi everybody,
After a long period of posing, i have fun with mapster again.
I have some questions regarding code modification to solve some bugs and improve some visual effects:
- how to prevent enemies from killing each other with their shots ? Silly but usefull to avoid this...
- it is possible to create different sort of bullet holes when a player's shot hits differents kinds of wall textures (concrete, metal, wood, etc)?
- a way to determine the id of the wall closest to an actor (like the command "findnearactor" but for walls ?)
Thanks in advance if you have any ideas how to do this, or find pieces of code for this...
1

User is offline   Danukem 

  • Duke Plus Developer

#2834

View Postzazo, on 27 April 2022 - 06:35 AM, said:

Hi everybody,
After a long period of posing, i have fun with mapster again.
I have some questions regarding code modification to solve some bugs and improve some visual effects:
- how to prevent enemies from killing each other with their shots ? Silly but usefull to avoid this...
- it is possible to create different sort of bullet holes when a player's shot hits differents kinds of wall textures (concrete, metal, wood, etc)?
- a way to determine the id of the wall closest to an actor (like the command "findnearactor" but for walls ?)
Thanks in advance if you have any ideas how to do this, or find pieces of code for this...


The first of those three is pretty easy to do. The second and third a quite a bit more involved. There just aren't any simple commands for them that do the job.

The friendly fire thing: Every enemy uses the ifhitweapon command. Right before that command in the enemy's code, you can insert a line of code that checks where the damage is coming from and nullifies it if it is coming from another actor that is not the player:

ifn sprite[].htextra -1 ifn sprite[].htowner -1 ifn sprite[].htowner player[].i seta[].htextra -1
ifhitweapon
{
// ... etc


So you would find each place it says ifhitweapon and insert that line of code above it. In English, what that line of code says is "If you are taking damage and if that damage is coming from a specific sprite and if that sprite is not the player, then negate that damage." This might also prevent them from taking damage from environmental explosions, but hopefully it doesn't do that. I'm hoping that environmental explosions set htowner to -1, in which case they will still take damage from those.

Note that this will not work properly in multiplayer because it only allows damage from the *closest* player. Also, in a more sophisticated mod that has other stuff going on like enemy factions and so on, it should not be used.
1

User is offline   zazo 

#2835

Works very well for the first point. Thanks you...
1

User is offline   RPD Guy 

#2836

View PostDanukem, on 24 November 2021 - 06:30 PM, said:

Since this is the scripting thread, you may want a scripting solution. It's a bit cumbersome, but you could define a new sprite and then put it into the sector where you want the sprites to ignore pal:

define NOPALSPRITE ####
gamevar tempsprite 0 0
gamevar tempvar 0 0

eventloadactor NOPALSPRITE

cstat 32769
headspritesect tempsprite sprite[].sectnum
whilevarn tempsprite -1
{
  geta[tempsprite].htflags tempvar
  orvar tempvar 64
  seta[tempsprite].htflags tempvar
  nextspritesect tempsprite tempsprite
}

enda


I think that will work but I'm not entirely sure because the htflags might get overwritten after map load. If that's the case then the code would need to run later.


I guess that what I'm looking for is something with paldata "nofloorpal":

paldata[(pal number)].nofloorpal 1


For example: If sector x have pal 10, then it should'n affect it's containing sprites.

But it seems that paldata is read only, so I can't simply do that:

set paldata[10].nofloorpal 1


As paldata is read only, I guess that the "nofloorpal" flag are probably stored under these guys: LOOKUP.DAT / PALETTE.DAT / TABLES.DAT or it's hardcoded somewhere in eduke32.
1

User is offline   RPD Guy 

#2837

In my opinion any pal greater than 8 or 9 shouldn't affect any sprites, because they won't change the sector's lighting, other than that, they give the game some randomness in level detail.

Judge me.
1

User is offline   brullov 

  • Senior Artist at TGK

#2838

Hi, could somebody give me a tip or a link to the eduke32 wiki about using blend mode for art displayed on HUD?
1

User is offline   brullov 

  • Senior Artist at TGK

#2839

Alright, that actually was pretty simple. I just had to be more attentive and keep searching for info on the wiki. You can use screentext which has an alpha parameter with -129 or -255 values.

P.S. Thanks to Danarama on Discord for the hint.
2

#2840

Is there a proper way to assign a RECOG sound to a useractor? Having searched the wiki for actor flags or events to tack it onto I have it set onto the actor's block to fire and then disable itself. This works the first time the actor is woken up but not if it has gone to sleep and awaken a second time.
1

User is offline   Danukem 

  • Duke Plus Developer

#2841

View Postlllllllllllllll, on 22 June 2022 - 07:47 PM, said:

Is there a proper way to assign a RECOG sound to a useractor? Having searched the wiki for actor flags or events to tack it onto I have it set onto the actor's block to fire and then disable itself. This works the first time the actor is woken up but not if it has gone to sleep and awaken a second time.


The recog sounds are a hardcoded feature of the game tied to specific enemies. The only hook into them from the scripting language that I am aware of is EVENT_RECOGSOUND which was added relatively recently and only applies to those old hardcoded cases.

To do what you want on a new useractor you would need to add some special event code that replicates that functionality. What you are trying to do is detect the sprite's .statnum changing from 2 (asleep) to 1 (awake) when its .extra (health) is greater than 0 (because you don't want dead bodies making the sound). And depending on how you had added the sound to the actor code, you might have to remove it from there, since you might get the sound played twice.
1

User is offline   Danukem 

  • Duke Plus Developer

#2842

This may be needlessly resource intensive but it was the first method I thought of and it will work.


gamevar sleeping NO 2 // note that NO and YES are normally defined as 0 and 1 in DEFS.CON

onevent EVENT_GAME

     switch sprite[].picnum

     case MYENEMY
          ife sprite[].statnum 2 set sleeping YES
     break

     // presumably you will want other cases...

     endswitch

endevent

// then elsewhere...

useractor enemy MYENEMY MYENEMYHP

// lotsa code blah blah blah

ife sleeping YES
ifg sprite[].extra 0 
{
     sound MYRECOGSOUND
     set sleeping NO
}

enda



Note that if an enemy is discovered it may be going from statnum 0 to 1 (not 2 to 1) so it may never have been sleeping; therefore, you would still want to have it making the sound in your ifai 0 block (or ifmove 0, or however you initialize the enemy)
1

Share this topic:


  • 124 Pages +
  • « First
  • 93
  • 94
  • 95
  • 96
  • 97
  • 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