Repeating Conversations

Topics regarding Scripting with Reality Factory
Post Reply
froach85
Posts: 5
Joined: Wed Jul 06, 2005 12:03 am
Location: Los Angeles

Repeating Conversations

Post by froach85 »

Hi,

I'm creating a virtual art exhibit in RF where you can walk up to the pictures and click on them, and then a larger higher quality version of the picture appears on screen. So far I have everything working, except once you click on a picture and look at it once, it doesn't allow you to do it again unless you restart the level.

What I am using is the pawn conversation system to do this. First I put an invisible brush in front of the picture of interest and make it a model. Then I hook a trigger to it that can only be activated with the use key. When clicked, the trigger spawns a pawn (proj.act) with a conversation script attached to it, and in this script I override the conversation background with my higher quality image as the background that corresponds to the image the user clicked on.

What I think my problem is is that the pawn can only spawn once, so therefore the conversation will only appear once, but I could be wrong. Is there a way I can script it into the pawn so the conversation can be repeated, and thus the picture will keep being displayed everytime the user clicks on the model? I have been away from RF and am a bit rusty, but I've searched thru the forums and the docs but haven't been able to solve this.

Here is the conversation script I am using...

Code: Select all

{
	
    	CHARPROSEC [0]

	Spawn[()
	{
		CustomBackground("reclaiming_space_01.bmp", 0, 0, 0, 0);
		Speak("PictureText", "");
		SoundConversation(CHARPROSEC);
		NewConversation("Spawn", false);
	}]

}  

Here is how the pawn is defined in pawn.ini

Code: Select all

[Picture]
actorname = Projectile\proj.act
actorrotation = 0 180 0
actorscale = 1
fillcolor = 0 0 0
ambientcolor = 0 0 0
subjecttogravity = false
boundingboxanimation = nocollide
shadowsize = 0
And here is the script linked to the pawn

Code: Select all

{
	Start[ ()
	{
	Conversation();

	}]
}
Does anyone have any suggestions? I know next to nothing about scripting so I fiddled with the default scripts until I got it to do what I wanted...almost :-p

Thanks for taking the time to read this everyone!

p.s. Speak("PictureText", "") is just referring to PictureText in the conversation.txt file telling the user to press the space bar to return to the exhibit (exit the conversation)

And of course I checked to make sure I didn't have the bOnlyOnce flag set to true in the trigger.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Yes, the problem is that the pawn spawns only once.

This can be solved with a simple script, however. You could make the pawn spawn immediately when the level starts, but go to conversation only when the needed trigger is activated.

So, try this:

Code: Select all

{
   Start[ ()
   {
    if(GetEventState(TRIGGER))
    {
        Conversation();
    }
    RestartOrder();
   }]
}
TRIGGER is the trigger that is activated when the player "uses" the model.
Pain is only psychological.
froach85
Posts: 5
Joined: Wed Jul 06, 2005 12:03 am
Location: Los Angeles

Post by froach85 »

Juutis,

Thank you for the script help. However, I now seem to be stuck in a loop as when I press the space bar to exit the conversation it starts right back up immediately, and the only way to exit is to press alt+F4.

I tried adding a SetEventState(TRIGGER, false) to the script to try to reset the trigger back to false, so then the script wouldn't automatically restart the conversation, but I must not be thinking about all this correctly because it doesn't seem to want to work. It prevents the conversation from even occuring in the first place.

Do you have any suggestions? Thanks again for the help!
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post by Jay »

Mabe this could help:

Code: Select all

{ 
   Start[ () 
   { 
    if(GetEventState(TRIGGER)) 
    { 
        Conversation();
        SetEventState(TRIGGER,false);
    } 
    RestartOrder(); 
   }] 
} 
So after the 'Conversation' is over the trigger goes back to false.

I hope this helps. :)
Everyone can see the difficult, but only the wise can see the simple.
-----
Post Reply