EDuke32 Scripting "CON coding help"
#3318 Posted 06 May 2023 - 07:25 PM
What are you using to look at the hardcode?
#3319 Posted 10 May 2023 - 03:18 AM
#3320 Posted 10 May 2023 - 04:41 AM
#3321 Posted 10 May 2023 - 07:58 AM
#3322 Posted 06 June 2023 - 07:36 PM
defstate testDISPLAY
ifcount 2
{
randvar tempA 19
switch tempA
case 0 { setvar tempB 9705 resetcount } break
case 1 { setvar tempB 9706 resetcount } break
case 2 { setvar tempB 9707 resetcount } break
case 3 { setvar tempB 9708 resetcount } break
case 4 { setvar tempB 9709 resetcount } break
case 5 { setvar tempB 9710 resetcount } break
case 6 { setvar tempB 9711 resetcount } break
case 7 { setvar tempB 9712 resetcount } break
case 8 { setvar tempB 9713 resetcount } break
case 9 { setvar tempB 9714 resetcount } break
case 10 { setvar tempB 9715 resetcount } break
case 11 { setvar tempB 9716 resetcount } break
case 12 { setvar tempB 9717 resetcount } break
case 13 { setvar tempB 9718 resetcount } break
case 14 { setvar tempB 9719 resetcount } break
case 15 { setvar tempB 9720 resetcount } break
case 16 { setvar tempB 9721 resetcount } break
case 17 { setvar tempB 9722 resetcount } break
case 18 { setvar tempB 9723 resetcount } break
case 19 { setvar tempB 9724 resetcount } break
endswitch
}
{ rotatesprite 128 100 32768 0 tempB 0 0 0 windowx1 windowy1 windowx2 windowy2 }
etc etc
The problem is that this same gamevar will always return the same value; ie instead of having each monitor display different screens at any one time, they all cycle through the same sequence of images in unison. I know there's a very bloated solution to this problem that would involve creating 20 switch statements, with 20 vars but that seems pretty excessive to me... Is there a smarter way to go about this?
EDIT - It just occurred to me that displaying the above during EVENT_DISPLAYMENU doesn't show the animation anyway (I guess ifcount 2 is never true); so I'm not going to bother with this method for now.
This post has been edited by MC84: 06 June 2023 - 08:01 PM
#3323 Posted 06 June 2023 - 08:37 PM
#3324 Posted 06 June 2023 - 08:42 PM
#3325 Posted 06 June 2023 - 09:31 PM
Danukem, on 06 June 2023 - 08:37 PM, said:
Thanks for your explanation - I was referring to the current_menu 0 or MAIN_MENU screen. I decided to go for a much simpler approach but I noticed that even when the animation is set through BAFED or a def file it won't play during this particular screen. However when you press escape and enter current_menu 50 / INGAME the animation does play.
#3326 Posted 15 June 2023 - 09:19 PM
The following actually seems to work (I put that spawn SMOKEPUFF1 bit in there just to check that the timer is actually counting down to zero ) however it only seems to play one of the 3 sounds. I've sat there in the level for 5 mins and it will just play the same sound over and over...
defstate AIRPORTPAstate
{
ifsound AIRPORTPA1 sub soundtimer 1
ifsound AIRPORTPA2 sub soundtimer 1
ifsound AIRPORTPA3 sub soundtimer 1
ife soundtimer 0 { spawn SMOKEPUFF1 set soundtimer 270 }
else
ife soundtimer 270
{
randvar tempA 2
switch tempA
case 0 { sound AIRPORTPA1 break }
case 1 { sound AIRPORTPA2 break }
case 2 { sound AIRPORTPA3 break }
endswitch
}
else nullop
}
endsAnd then my actor itself is very basic;
useractor notenemy AIRPORTPA cstat 32768 state AIRPORTPAstate enda
TempA is a per-actor var (I also experimented with global vars but it didn't seem to make much difference). soundtimer is initiated to 270, as each sound is approx 9 seconds in length.
This post has been edited by MC84: 15 June 2023 - 09:48 PM
#3327 Posted 15 June 2023 - 10:09 PM
defstate AIRPORTPAstate ifsound AIRPORTPA1 break ifsound AIRPORTPA2 break ifsound AIRPORTPA3 break ifrnd 85 globalsound AIRPORTPA1 else ifrnd 128 globalsound AIRPORTPA2 else globalsound AIRPORTPA3 ends
#3328 Posted 15 June 2023 - 11:51 PM
Danukem, on 15 June 2023 - 10:09 PM, said:
Thanks Dan - I like simple solutions. Well it works just as well my overly complex code, however it still only plays one of the sounds. I must have done something silly somewhere to cause that.
#3329 Posted 16 June 2023 - 12:11 AM
MC84, on 15 June 2023 - 11:51 PM, said:
Look carefully at your sound definitions. You may have accidentally pasted the same sound file name in all 3 of them, even though the sounds have different labels. I have done that before myself.
#3330 Posted 16 June 2023 - 12:16 AM
Danukem, on 16 June 2023 - 12:11 AM, said:
I checked those, and the thing is that when I say it was 'playing the same sound' the sound would actually change between quitting and reloading the map... it's just that it would play the same sound each 'session'.
Anyway I had my sounds defined as 0 0 0 3 0 ... I think I was doing that for ambient sounds? And then I changed it to 0 0 254 0 0 and now it actually cycles randomly through the 3 sounds. Thanks again!
#3331 Posted 16 June 2023 - 12:20 AM
MC84, on 16 June 2023 - 12:16 AM, said:
Anyway I had my sounds defined as 0 0 0 3 0 ... I think I was doing that for ambient sounds? And then I changed it to 0 0 254 0 0 and now it actually cycles randomly through the 3 sounds. Thanks again!
From the original USER.CON file comments:
// BIT 0 (1) Repeat // BIT 1 (2) MUSICANDSFX (used for) // BIT 2 (4) A Duke Voice // BIT 3 (8) Par. Lockout // BIT 4 (16) Glob. Heard (sndist = 0)
So you had the sounds set on repeat and MUSICANDSFX. Repeat may have been the issue there.
#3332 Posted 27 June 2023 - 12:42 PM
switch sector[].floorpicnum
{
case FLOORSLIME
ifrnd 1
ifcanseetarget
spawn POISONSMOKE
break
case FLOORPLASMA
ifrnd 1
ifcanseetarget
{
spawn BURNINGSMOKE
ifrnd 1
{
randvar zdist -9984 add zdist 1024 randvar angvar 2048 ezshoot zdist EXPLOSIONSTREAM seta [RETURN].ang angvar
}
}
break
case PURPLELAVA
ifrnd 1
ifcanseetarget
spawn BURNINGSMOKE
break
}
endswitch
It works great but when I try to apply this same concept to wall textures it doesn't do anything. What am I doing wrong or is this not possible with wall textures?
switch wall[].picnum
{
case W_SCREENBREAK
case 358
case 359
case W_HITTECHWALL3
case W_HITTECHWALL4
case W_HITTECHWALL2
case W_HITTECHWALL1
ifrnd 1
ifcanseetarget
spawn BURNINGSMOKE
break
}
endswitch
#3333 Posted 27 June 2023 - 01:31 PM
I'm a little surprised that the wall switch doesn't throw an error or at least a warning.
EDIT: Since the code doesn't throw an error, I'm assuming there is *some* wall being referred to, but it could be wall 0 every time or some random wall.
This post has been edited by Danukem: 27 June 2023 - 01:40 PM
#3335 Posted 28 June 2023 - 04:31 AM
#3336 Posted 29 June 2023 - 12:14 PM
#3337 Posted 30 June 2023 - 06:21 AM
This post has been edited by Mark: 30 June 2023 - 06:23 AM
#3338 Posted 30 June 2023 - 11:07 AM
Mark, on 30 June 2023 - 06:21 AM, said:
Just a quick and dirty attempt without testing:
appendevent EVENT_DISPLAYROOMS ifp ponground ife sector[player[].cursectnum].lotag 1 add cameraz 1024 endevent
See if that works.
#3339 Posted 30 June 2023 - 12:09 PM
lllllllllllllll, on 29 June 2023 - 12:14 PM, said:
Presumably there is already a sprite in said sector for his EVENT_GAME code, he just doesn't know which wall to reference. And he didn't give any context so I'm not going to waste time guessing solutions to an unstated problem.
#3340 Posted 30 June 2023 - 02:24 PM
#3341 Posted 30 June 2023 - 03:01 PM
Danukem, on 30 June 2023 - 11:07 AM, said:
appendevent EVENT_DISPLAYROOMS ifp ponground ife sector[player[].cursectnum].lotag 1 add cameraz 1024 endevent
See if that works.
I'm half way there using your suggestion. When I enter the water from land I drop down to the lower height I wanted. 1024 was just right. but when I come back up from underwater I'm back to default onwater height. I'm going to doublecheck my SE placement above water to make sure it isn't raised when it shouldn't be.
edit: the above water SE is where it should be.
This post has been edited by Mark: 30 June 2023 - 03:23 PM
#3342 Posted 30 June 2023 - 09:19 PM
Mark, on 30 June 2023 - 03:01 PM, said:
edit: the above water SE is where it should be.
I guess emerging from the water is screwing with the results of ifp ponground
We will need to put in something home-brewed to replace that and give consistent results
#3343 Posted 30 June 2023 - 09:57 PM
appendevent EVENT_DISPLAYROOMS
ife sector[player[].cursectnum].lotag 1
{
getflorzofslope player[].cursectnum player[].posx player[].posy RETURN
sub RETURN cameraz
ifg RETURN 2048 ifl RETURN 6144 add cameraz 1280
set RETURN 0
}
endevent
#3344 Posted 01 July 2023 - 05:10 AM
Unrelated but playing around with water stuff reminded me of something I noticed a looong time ago and that was the ability to press jump when on water and the player is then at a slightly higher Z until it resets itself by going underwater again or up on land. I'm thinking it was discussed way back then but I can't recall what became of the discussion.
This post has been edited by Mark: 01 July 2023 - 05:16 AM
#3345 Posted 01 July 2023 - 11:38 AM
Mark, on 01 July 2023 - 05:10 AM, said:
Unrelated but playing around with water stuff reminded me of something I noticed a looong time ago and that was the ability to press jump when on water and the player is then at a slightly higher Z until it resets itself by going underwater again or up on land. I'm thinking it was discussed way back then but I can't recall what became of the discussion.
I actually don't know what you want then because I tested that code and it seemed fine. Yes it is true that jumping in the water will reset the height -- in fact you can end up lower in the water that way as well. You might have to do a full override of the water floating code to create your own custom code from scratch.
#3346 Posted 01 July 2023 - 02:13 PM
Its been an uphill battle trying to streamline out the code I don't need and have to deal with the modified executable. Months ago I should have just cut all ties with that project and attempt to move my stuff to a clean eduke32 but I would have lost some of the AWOL features I liked. So I've foolishly limped along all this time.
Thanks for your help. I will still use what you gave me because it works somewhat. There are only 2 underwater areas on the map and while it would have upped the cool factor with the desired player Z consistantly, it will be good enough getting it half the time.
This post has been edited by Mark: 01 July 2023 - 02:22 PM
#3347 Posted 01 July 2023 - 02:21 PM
EDIT: that might clip the player through the floor though depending on how he sits on the water
This post has been edited by Danukem: 01 July 2023 - 03:16 PM

Help
Duke4.net
DNF #1
Duke 3D #1


