Aller au contenu

Photo

Is it possible to spawn a camera in runtime then send the view from that camera to a GUI?


  • Veuillez vous connecter pour répondre
19 réponses à ce sujet

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
So the title pretty much sums up my question. 

I want to be able to send the image from a camera (as in a cutscene) to a GUI.  Is this possible? 

#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I just saw a NWN script which appear to do this. Unfortunately and shamefully, I don't have NWN currently installed, so I can't check it, but I can check out the script which should sitll work, right?

#3
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Maybe? Possibly? You'd have to try it out. NWN-->NWN2 scripts can work, but sometimes the functionality is altered or removed.



I'm nearly positive you can get the view of the PC's camera and then restore it at some later point. Putting it into a GUI, however, seems a bit tricky. Let us know how it goes.

#4
Morbane

Morbane
  • Members
  • 1 883 messages
What are you trying to do? Some sort of Clairvoyance or Wizard Eye spell? That would be cool!

#5
PJ156

PJ156
  • Members
  • 2 983 messages
If that is the case perhaps have the spell spawn an I point speaker then start a convo with it. You can then fire off as many camera shots as you please but the camera has to exist already.

For me spawning a camera is perhaps only the first part of the problem. It needs to point where you want it to and that will be much more tricky.

PJ

#6
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Chaos Wielder wrote...

Maybe? Possibly? You'd have to try it out. NWN-->NWN2 scripts can work, but sometimes the functionality is altered or removed.

I'm nearly positive you can get the view of the PC's camera and then restore it at some later point. Putting it into a GUI, however, seems a bit tricky. Let us know how it goes.



God, I miss the days when I asked easy scripting questions and everyone just told me the answer!  :) 


Seriously though, thanks for the response, and I'll keep posting here to update my progress or lack thereof.

#7
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Morbane wrote...

What are you trying to do? Some sort of Clairvoyance or Wizard Eye spell? That would be cool!


That's what I'm going for.  It would really make the mage far more powerful because he/she would be able to know what to plan for.  I was thinking about making it a spell, but then it would definitely be divination and therefore inaccessible to necromancers, my favorite specialty, so I may just make an item.  We'll see.  Maybe I'll just cheat and not give it a school!

#8
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

PJ156 wrote...

If that is the case perhaps have the spell spawn an I point speaker then start a convo with it. You can then fire off as many camera shots as you please but the camera has to exist already.

For me spawning a camera is perhaps only the first part of the problem. It needs to point where you want it to and that will be much more tricky.

PJ


Yeah, this is going to be tough if it's possible at all.  I'm skeptical whether my vision for it is possible.  It may turn into creating a creature and somehow scripting it to be invisible and letting the PC posess it somehow and look around for a bit before the PC is forced to unposess it and is warped away. 

You know, maybe I could make a creature that joins the party and give it the icon of a spell or crystal ball or something, somehow disable the character GUI for it, and then the PC can just posess it when he/she wants to check out the area.  It would have to be flagged as immobile.  If the whole GUI thing doesn't pan out, I may use this.  Good idea PJ.  Thanks. 

#9
PJ156

PJ156
  • Members
  • 2 983 messages
Jumping to where you cant see might be problematic. How do you define where to jump to?

Could you temporarily give the mage the survival feat showing up enemies on the existing map or use the spell to reveal the whole map, bad guys and all. the spell could pull up the map GUI with critters on it? I realise that's a compromise but it's some of the way.

If you want to explore the area in the third person then, I guess, a hurdle is going to be having the companions stay still while your extra party member walks around.

It makes me green with envy reading what you guys do with scripting :)

PJ

#10
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
If you want to disable all visual UIs for the player and then have them possess something, here you go:



CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_PARTY_BAR);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_2);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_V1);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_V2);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_MODEBAR);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_PLAYERMENU);

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_ACTIONQUEUE);

CloseGUIScreen(oPC, "SCREEN_MINIMAP");

CloseGUIScreen(oPC, "ChatSelect");

CloseGUIScreen(oPC, "SCREEN_MESSAGE_1");



And don't ask why I have this list available so easily! :D

#11
Morbane

Morbane
  • Members
  • 1 883 messages

Chaos Wielder wrote...

And don't ask why I have this list available so easily! :D


That is kinda funny=]

#12
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Chaos Wielder wrote...

If you want to disable all visual UIs for the player and then have them possess something, here you go:

CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_PARTY_BAR);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_2);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_V1);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_HOTBAR_V2);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_MODEBAR);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_PLAYERMENU);
CloseGUIScreen(oPC, GUI_SCREEN_DEFAULT_ACTIONQUEUE);
CloseGUIScreen(oPC, "SCREEN_MINIMAP");
CloseGUIScreen(oPC, "ChatSelect");
CloseGUIScreen(oPC, "SCREEN_MESSAGE_1");

And don't ask why I have this list available so easily! :D


Hey, funny that you should mention this, I was just wondering how do to this. Could I use the DisableGUIScreen command to make sure they don't get pulled back up until I want them back up?

I think this is the route I will probably take, thanks for the info it will be very useful.

Cheers

#13
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
What I do is simply have a heartbeat come every 1000 milliseconds and call this same command. It looks like you could call the SetGUIObjectDisabled function and lock them. However, as I haven't tried it, I cannot say one way or the other. That said, I'll test it out later today.

#14
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Also, for the above, you need to make sure you have #include "ginc_overland". That has the constants for the GUI screens.

#15
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Hey, thanks for the help Chaos, I was really unsure about making this happen but it is starting to look possible.

#16
0100010

0100010
  • Members
  • 87 messages
Are you wanting a fixed point position scry or a mobile one?



In either case if you are opting for moving the PC (faked out though) You'll need to Immobilize the PC for a fixed position scry, set the PC to script hidden, and as the others said turn off the gui possibly. If in related to your question on the scripting forums you are aiming to find a way to get feedback to move the camera or at least turn it, You shoudl create a new gui screen "Scry controls" with buttons that let you move the camera via callbacks. However for that your better off just making a mobile scry position, and allowing the PC to move around.

#17
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
So it is possible to move the 3D camera through callbacks? Based on the tags of the functions I found at NWN2 source, I thought it may be possible. I will most likely just do what everyone is suggesting and make the PC invisible, immobile, and disable the GUIs and teleport the player to the scry location, but it is good to know that the camera can be moved for other purposes.



Thanks for the response.

#18
0100010

0100010
  • Members
  • 87 messages
No quite, your still dependent on a defined custscene camera or the PC in the cuscne,s but you can set the camera facing and height. Using a hidden PC is much easier.

#19
SkywingvL

SkywingvL
  • Members
  • 351 messages
There's no way for the server to ask the client to move its camera without moving the control object (as has already been suggested).



Theoretically, a server-side modification (such as a NWNX plugin) might allow an already placed static camera object to be moved (I haven't tested what the client's reaction to this would be, but there is a protocol for updating object positions, not exposed via script however). New static camera objects cannot be created on the fly effectively as the only way to inform the client of them is during initial area loading.

#20
SkywingvL

SkywingvL
  • Members
  • 351 messages
This is definitely a hack, but one other option you might consider would be to try these steps (if you want to 'move' the camera within an area);



- Remove the player from their party

- Create a temporary roster creature with a guaranteed unique name via AddRosterMemberByTemplate or AddRosterMemberByObject

- Create the new roster member (if you used AddRosterMemberByTemplate)

- Make the roster member creature invisible and stuck in place (and otherwise made harmless)

- Transfer object control to the new roster member via SetOwnersControlledCompanion. Unfortunately, it looked to me like this checks that the target object is really a roster member first, so you probably will have to deal with the roster functions beforehand as noted above.

- When the PC is done, restore previous control with SetOwnersControlledCompanion and clean up the roster object.



Here, the roster object functions as a way to move the player's viewpoint around without moving their PC object. (For example, if you wanted to keep the PC vulnerable to attack while they're off scrying or whatnot.)



You'll probably want to test this when multiple players are in use if this is not for single player only.