id Tech Forums

id Tech 4 (Doom3/Prey/Q4) => id Tech 4 Scripting => Topic started by: VGames on June 12, 2015, 12:29:10 PM

Title: Screen overlay for looking through a scope
Post by: VGames on June 12, 2015, 12:29:10 PM
How do u make the screen look like you're looking through a scope? Like what are the commands for pulling this off? I know where to put it in the weapon script but what are the commands that I should look into using to pull this off?
Title: Re: Screen overlay for looking through a scope
Post by: VGames on June 13, 2015, 12:31:27 PM
Do u guys understand my question?
Title: Re: Screen overlay for looking through a scope
Post by: BielBdeLuna on June 13, 2015, 03:16:25 PM
in d3 there is that case in "marscity2" (the second time you go to Mars City) where you look at the mirror and the image gets an effect, I've never used it in my maps but I guess it has to be something like this only that you activate it in the script, but I've never done it, idk and I would like to know this too.
Title: Re: Screen overlay for looking through a scope
Post by: The Happy Friar on June 14, 2015, 01:03:35 PM
I've done it by having the weapon have a custom zoom and that zoom zoomes in to the scope on the weapon instead of a screen effect.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on June 14, 2015, 01:08:42 PM
That's a good idea. I'll try that out when I get into the modeling and animation stuff I want to add. But if anybody knows how to do a screen overlay that would be nice to know too.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on September 01, 2015, 08:07:19 PM
Ok Happy so I'm now at the stage where I'm trying to add this scoped ADS feature for the rocket launcher. I'm having trouble understanding just how you made the scope part of the model see through. Was that done through material coding? Or was something done to the actual model? I've tried a few different things but didn't get the scope on the rocket launcher to look see through. Should I make the texture on the scope see through? So confused.
Title: Re: Screen overlay for looking through a scope
Post by: The Happy Friar on September 02, 2015, 06:46:21 AM
I modeled the scope & crosshairs.
Title: Re: Screen overlay for looking through a scope
Post by: chimueloeldragon2011 on September 02, 2015, 10:50:32 AM
Man I did that in my assets pack you can take a look here, is this what you're looking for?

http://www.moddb.com/mods/star1088/images/new-media-hud-and-mod-internal-changes2
Title: Re: Screen overlay for looking through a scope
Post by: VGames on September 02, 2015, 11:06:16 AM
U did this with the rocket launcher? If u did I'll just use yours. It looks great. I'll have to make another melee animation for it but that's no big deal.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on September 08, 2015, 09:56:51 PM
Ok I've been struggling with this scope overlay. Does anybody here have any experience with the CED assets pack? I'm sure I've got everything in order but the scope will not show up. I'm guessing I haven't defined the material part of the textures but the thing is there is nowhere in the material files that defines the textures used for the scope overlay. They're defined in the guis hud file but they don't show the file format for the textures. So they must be defined somewhere in a material definition right? I've tried contacting the author but he doesn't respond.
Title: Re: Screen overlay for looking through a scope
Post by: bkt on September 09, 2015, 11:27:44 AM
It's all in the files somewhere.  Dig deeper into the pack to find it. 
Title: Re: Screen overlay for looking through a scope
Post by: VGames on September 09, 2015, 11:43:39 AM
Yeah I'm still looking. It's got me stumped.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on October 24, 2015, 02:43:25 PM
Ok I've looked through this code like crazy. There's even another guy that has been looking through it aswell and we've come to the conclusion that the gui_parm12 that is set in the doom_events file has not been defined so that the game knows when it's being called. There is no other place in the entire CED mod pack that has anything to do with gui_parm12 except for in the gui HUD file and the doom_events file. There is of course the calling of the event that tells gui_parm12 to either turn on or off in the rocket launcher script file but there are no other places that gui_parm12 is found. Here's the simplest version of the code for the gui HUD file. I have made several different versions of it trying to figure this out but this should be enough to get the scope to appear when gui_parm12 is activated:


//**************************************************************************

// RL SCOPE OVERLAY START

//**************************************************************************

windowDef RLSParentA {

rect 0,0,640,480

visible 1 // ("gui::weapon8" == 2)

windowDef RLSStatic {

rect 0,0,640,480

visible ("gui::gui_parm12" == 1)

background "gui/hud/filmgrain"

matcolor 0,0.9,0,1

matscalex 4

matscaley 2

}

windowDef RLSGlass {

rect 0, 0, 640, 480

visible ("gui::gui_parm12" == 1)

matcolor 0.1,0.2,0.15,0.1

background "textures/glass/glass1_nvp"

}

windowDef RLSBlack {

rect 0, 0, 640, 0

visible ("gui::gui_parm12" == 1)

backcolor 0,0,0,1

}

windowDef RLSBlackLeft {

rect 0, 0, 80, 480

visible ("gui::gui_parm12" == 1)

backcolor 0,0,0,1

}

windowDef RLSBlackRight {

rect 560, 0, 80, 480

visible ("gui::gui_parm12" == 1)

backcolor 0,0,0,1

}

}

windowDef RLSParent {

rect 0,0,640,480

visible 1 // ("gui::weapon8" == 2)

windowDef RLSA {

rect 60, -20, 520, 520

visible ("gui::gui_parm12" == 1)

matcolor 0.4,0.6,0.3,1

background "guis/assets/hud/crosshairs/rlaunchercircle"

}

windowDef RLSB {

rect 60, -20, 520, 520

visible ("gui::gui_parm12" == 1)

matcolor 0.4,0.6,0.3,0

background "guis/assets/hud/crosshairs/rlaunchercircle"

onTime 0 {

transition "matcolor" "0.4 0.6 0.3 0" "0.4 0.6 0.3 0.2" "400" "0" "1" ;

transition "rect" "110 30 420 420" "60 -20 520 520" "1000" "0" "1" ;

}

onTime 400 {

transition "matcolor" "0.4 0.6 0.3 0.2" "0.4 0.6 0.3 0" "600" "0" "1" ;

}

onTime 2500 {

resetTime "0" ;

}

}

windowDef RLS {

rect 80, 0, 480, 480

visible ("gui::gui_parm12" == 1)

matcolor 1,1,1,1

background "guis/assets/hud/crosshairs/rlauncher"

}

windowDef RLSCenter {

rect 80, 0, 480, 480

visible ("gui::gui_parm12" == 1)

matcolor 1,1,1,flickertable [ time * 0.0025 ]

background "guis/assets/hud/crosshairs/rlaunchercenter"

}

windowDef RLS2 {

rect 80, 0, 480, 480

visible ("gui::gui_parm12" == 1)

matcolor 1,1,1,1

background "guis/assets/hud/crosshairs/rlaunchermask"

}

windowDef RLSText {

rect 0,455,640,480

visible ("gui::gui_parm12" == 1)

forecolor 1,1,1,1

text "[ALT FIRE] = ZOOM X2"

textscale 0.14

textalign 1

font "fonts/zerohour"

onTime 0 {

transition "forecolor" "1 1 1 0.2" "1 1 1 0.05" "200" ;

}

onTime 200 {

transition "forecolor" "1 1 1 0.05" "1 1 1 0.2" "100" ;

}

onTime 300 {

resetTime "0" ;

}

}

}

//**************************************************************************

// RL SCOPE OVERLAY END

//**************************************************************************


And here are the events that turn gui_parm12 off and on which are called in the rocket launcher script file:


/*
// Rocket launcher scope
*/
void RLCS_ON() {
$player1.setGuiParm("gui_parm12", 1);
}
void RLCS_OFF() {
$player1.setGuiParm("gui_parm12", 0);
}


And of course here are the commands I'm using in the rocket launcher script file to call on these events. I've even called the event to turn on gui_parm12 in the rocket launcher's idle state just to get the dang thing to come on as soon as the weapon is selected:


RLCS_ON();
&
RLCS_OFF();


Please help if you can. I have not heard anything from CED2011 about this scope overlay issue. I wish he would respond.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 19, 2015, 08:12:41 AM
Still lost here. For some reason the Parms are not being used by the game. I don't want these hud effects to work unless the parm has been enabled but the parm is not being activated at all. It's like the game doesn't even know what they are but its not giving me an error. Does anybody know anything about adding new content to the player hud using Parms to enable or disable them?
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 19, 2015, 08:26:25 PM
Event setguiparm that's called in the utility script file simply does not work for me. Has anybody found this to be true for them?
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 22, 2015, 11:03:21 AM
For some reason I am unable to get a link between setguiparm and new content added to the hud file in the guis folder. Adding stuff to a specific weapons GUI file like the plasmaguns works. But not something added to the global hud file in the GUIs folder. Any ideas?
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 24, 2015, 03:54:34 PM
Seriously?? Nobody has ever tried doing some HUD additions to the global HUD file using setGuiParm as a way to get them to work? Only CED has done this?
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 24, 2015, 08:08:16 PM
Ok even setting the parm12 up as a cvar and setting the scope art to be visible like this:


visible ("cvar::gui_parm12" == 1)


does not work. What the heck is going on here? Is it even possible to make something visible like this? I've even gone as far as making a choiceDef that ontime 0 would set the visible setting for the scope overlay to 1 or 0 depending on what the cvar was set to over in the weapon script. Is the ontime function not possible in the HUD file? Is it only possible in menus?

I'm truly stumped and ready to smash my head through my screen. And if I survive that run into my living room and finish myself off with my 50 inch TV.
Title: Re: Screen overlay for looking through a scope
Post by: VGames on November 27, 2015, 02:50:01 PM
I figured it out. I had to make a choiceDef and then use the results of that choice in the visible parameter of the scope overlay. Not at all what CED did. I wonder why this worked for him so much easier.