May 19, 2024, 11:27:57

Author Topic: Code Snippet: "Screenshot mode"  (Read 9005 times)

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
Code Snippet: "Screenshot mode"
« on: February 14, 2010, 22:16:34 »
Taking great screenshots in Nexus (maybe to promote your mod!?) is kinda hard, since there's no good way to remove the GUI... if you hide the GUI using GuiSelect(0), you lose camera control and the game can't be paused anymore, so I needed a workaround:

Code: [Select]
///////////////////////////////////////////////////////////////
// "Screenshot mode" (press CTRL+7 to remove GUI für 2 seconds)

RULE event Cheat7
:action
GuiSelect(0);
SetMotionFactor(0.1);
Timer(RestoreGuiAndMotion, 0.2, 0);
:end
END

RULE event RestoreGuiAndMotion
:action
GuiSelect(3);
SetMotionFactor(1);
:end
END

This only works in the editor, so don't even try it in the regular game. If you press CTRL+7 during gameplay, the GUI gets hidden and the game enters slow-motion mode, but only for two seconds. After that it returns to normal gameplay. So to get a great shot I wait for a good opportunity or arrange a screenshot-worthy scene myself, then pause the game to find a good camera position and press CTRL+7, when I'm ready to take the shot.

Might be handy for other modders so feel free to use this snippet (or modify it further to meet your individual needs). ;)

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #1 on: February 15, 2010, 00:51:12 »
Wow... a command to slow time... Damn, I didn't know that one... World of better cinematics, here I come!

Thanks Arparso, that's a most invaluable tool you made there!

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #2 on: August 07, 2010, 10:09:46 »
Okay, so I'm an idiot :)
How do you get this working? I tried adding it to the mission file but it doesn't seem to work at all.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #3 on: August 07, 2010, 11:08:46 »
Just add the snippet to the RULES section of your mission, like directly after your basic SceneInit RULE or in one of your MACHINES' STATEs (although the STATE has to be active for the "cheat" to work). I actually added this "cheat" to a separate file and add it to each mission using

Code: [Select]
#include "include_me.inc"Then, in the mission editor, CTRL+7 should activate the slow-motion.

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #4 on: August 07, 2010, 23:21:41 »
Yeah I don't know what I'm doing, but it doesn't work :p

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #5 on: August 08, 2010, 01:37:22 »
That's strange... well, try out this:

Create a new .mission file, paste this code into it and replace the DefLocation to some valid location in your mod (not at home, can't look for one myself right now). Now open up the mission editor and start the mission. When hitting CTRL+7, it should successfully remove the GUI and enter slow-mo mode for about 5 seconds. If that doesn't work, then I'll be damned...

Code: [Select]
MISSION Basic
Name "Basic"

DefLocation "XXXXXXXXXXX"

OBJECTIVES
1       "Destroy all enemies"
END

RULES

RULE event SceneInit
:action
Debug("#####################");
Debug("## Mission Start");
               
SelectEx(s.ship,
MakeFullyKnown(S.this);
FreezeReconState(S.this,1);
);
:end
END
       
///////////////////////////////////////////////////////////////
// "Screenshot mode" (press CTRL+7 to remove GUI for 2 seconds)

RULE event Cheat7
:action
GuiSelect(0);
SetMotionFactor(0.1);
Timer(RestoreGuiAndMotion, 0.2, 0);
:end
END

RULE event RestoreGuiAndMotion
:action
GuiSelect(3);
SetMotionFactor(1);
:end
END
       
END

/edit:
Thinking about it... are you pressing 7 on the numpad or the "regular" 7? I'm using the numpad, but actually I'm not sure about the regular 7 key...

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #6 on: August 08, 2010, 04:46:17 »
ahhhh yes, I was using the normal 7 key. Numpad 7 worked just fine :)

Thanks a lot, Arparso!