Page 1 of 1
Dialogs Question
Posted: Wed Apr 08, 2009 12:40 pm
by metal_head
Me and my team went and recorded some of the voices from Metal Force last sunday, but I got several questions:
I did a small script in High Level, that plays all the sounds just great, here's the script:
Code: Select all
{
Spawn[ ()
{
Console(true);
NewOrder("Talk");
} ]
Talk[ ()
{
Delay("", 2, "");
Delay("", 2.8, "Jake/1.wav");
Delay("", 1,"");
Delay("", 6 , "Commander/1.wav");
Delay("", 1.5, "");
Delay("", 2, "Jenity/1.wav");
Delay("", 1, "");
Delay("", 4, "Bolt/1.wav");
Delay("", 0.7, "");
Delay("", 9, "Commander/2.wav");
Delay("", 0.5, "");
Delay("", 1.2, "Jake/2.wav");
Delay("", 0.5, "");
Delay("", 0.65, "Jenity/2.wav");
} ]
}
The problem is, that I'm not sure if this is the best way to do it, and I also want the character avatars to appear, for example when Jenity (it's a character from metal force) talks, her picture to appear at the top right corner, I can use the command
but it's in Low Level, and the script is in High level, I'll have to switch from low to high and from high to low level many times.
There's the command:
PlaySound();
which is also in low level, I can make the script low level, but which command shall I use for the delay between the sounds? I looked at all the command, but I couldn't see a delay command for low Level.
Also: What is the best way to attatch the pawn to the player, I found the command
AttatchToActor();, or something like this, but I couldn't use it to attatch the pawn to the player. I need to attatch the pawn to the player, so the player can hear the sounds no matter where he goes.
Re: Dialogs Question
Posted: Wed Apr 08, 2009 10:13 pm
by Jay
For checking time in low level you can use this:
http://www.realityfactory.info/forum/vi ... fdf#p28715
Sadly never made it to sticky.
You could use the command teleportToPlayer() to teleport the pawn to the player. I believe this command is low-level, so if you are using lowlevel this would be the command of choice.
Re: Dialogs Question
Posted: Thu Apr 09, 2009 8:56 pm
by metal_head
amm, I can use this, but every time I wanna make a delay, I'll have to make separate orders, checking timers, right? It's not very clear to me...
Re: Dialogs Question
Posted: Fri Apr 10, 2009 4:58 pm
by Jay
You have to add it to every script in which you want to use timers. There is no other way i think since calling orders in from a pawn to another is somehow bugged - or i misunderstood it.
In one script you can have multiple timers, and you don't have to make seperate orders for more than one. You can have:
SetTimer(0, 1); //Timer 0 will be true in 1 seconds
SetTimer(1, 2); //Timer 1 will be true in 2 seconds
SetTimer(2, 3.5) //Timer 2 will be true in 3.5 seconds
and then check them both:
if(CheckTimer(0)) { //Check timer 0 (the 1 seconds timer)
...
}
if(CheckTimer(1)) { //Check timer 1 (the 2 seconds timer)
...
}
if(CheckTimer(1)) { //Check timer 2 (the 3.5 seconds timer)
...
}
Timers are automaticly reset once you check them and they are true (so that an action will not be done twice). If you want them to trigger again sometime in the future, you must set them again.
If you want more timers you just have to make the size of the TIMERS array bigger.
I hope this clarifies your questions.
Re: Dialogs Question
Posted: Fri Apr 10, 2009 7:28 pm
by metal_head
Aaaa, now I get it, but I don't get something else now:
Code: Select all
{
Spawn[ ()
{
Console(true);
LowLevel("Talk");
} ]
Talk[ ()
{
SetTimer(0, 2);
if(CheckTimer(0))
{
PlaySound("Jake/1.wav");
}
} ]
}
My script starts, goes to low level, sets the timer "0" to 2, than the timer is checked....wait...it's not checked, the console says that the method SetTimer is not found..why is that.. the order is in low level, it shouldn't be happening...
Re: Dialogs Question
Posted: Fri Apr 10, 2009 8:33 pm
by bernie
SetTimer() does NOT appear in the RF documentation. the only timer command in documentation is High Level AddTimerOrder(int Timer#, float Time, string Order); and DelTimerOrder(int Timer#); Maybe Jay has a modified version or something.
Re: Dialogs Question
Posted: Fri Apr 10, 2009 8:48 pm
by QuestOfDreams
Look at the topic Jay linked to. SetTimer is not a built-in script method, you need to copy the function into your script to use it.
Re: Dialogs Question
Posted: Fri Apr 10, 2009 9:38 pm
by metal_head
WOW, everything get's too compplicated with this... I'm gonna try to make an alternative method with HighLevel and LowLevel commands switching, if this doesn't work for me, than I'll return to Jay's timer script.

Re: Dialogs Question
Posted: Fri Apr 10, 2009 9:50 pm
by Jay
Maybe i should have given an example...
All you had to do was this:
Code: Select all
{
//My code
//Remember to make this array big enough if needed
TIMERS
{
0 [0]
1 [0]
2 [0]
3 [0]
}
SetTimer[ (timer, time)
{
TIMERS[timer]=self.time+StringCopy(time);
} ]
CheckTimer[ (timer)
{
if(TIMERS[timer]=0)
{
return false;
}
if(self.time>TIMERS[timer])
{
TIMERS[timer]=0;
return true;
}
return false;
} ]
//Your code
Spawn[ ()
{
Console(true);
LowLevel("SetupLowLevel");
} ]
SetupLowLevel[ ()
{
SetTimer(0,2);
self.think="Talk";
} ]
Talk[ ()
{
if(CheckTimer(0)) //First time talking
{
PlaySound("Jake/1.wav");
SetTimer(1,4); //In this example it the next 'talk' will be in 4 seconds.
return;
}
if(CheckTimer(1)) //Second time talking
{
//Do the next talking, set next timer
}
//And so on
} ]
}
I hope this helps. If you don't want to use it, then do it your way. (btw i hope you don't feel stupid now, when i was starting out i wasn't too good either)
Re: Dialogs Question
Posted: Fri Apr 10, 2009 10:11 pm
by metal_head
Well, I feel a bit stupid, but I've gotten used to it

. I'm still having troubble understanding how all this works, but I think I'll get it (..one day). That CheckTime thing is confusing me a little, but now I think I can go on myself

Re: Dialogs Question
Posted: Fri Apr 10, 2009 10:40 pm
by metal_head
Amm, I'm really sorry for the doubble post, but I seem to have problem with something so stupid this time...
Code: Select all
{
TIMERS
{
0 [0]
1 [0]
2 [0]
3 [0]
}
SetTimer[ (timer, time)
{
TIMERS[timer]=self.time+StringCopy(time);
} ]
CheckTimer[ (timer)
{
if(TIMERS[timer]=0)
{
return false;
}
if(self.time>TIMERS[timer])
{
TIMERS[timer]=0;
return true;
}
return false;
} ]
Spawn[ ()
{
Console(true);
LowLevel("SetupLowLevel");
} ]
SetupLowLevel[ ()
{
SetTimer(0,2);
self.think="Talk";
} ]
Talk[ ()
{
if(CheckTimer(0))
{
ShowHudPicture(17, true, "", 630, 0,"");
PlaySound("Jake/1.wav");
SetTimer(1,3.8);
return;
}
if(CheckTimer(1))
{
PlaySound("Commander/1.wav");
SetTimer(2,6.5);
return;
}
if(CheckTimer(2))
{
PlaySound("Jenity/1.wav");
} ]
}
The command ShoHudPicture(); just seems not to work...Picture17 is defined in HUD.ini... I've used this command before, and I've had no problems with it... The console shows no error report and everything seems to be OK with the bitmaps... what could it be?
Re: Dialogs Question
Posted: Sat Apr 11, 2009 12:42 am
by QuestOfDreams
The last parameter in ShowHudPicture should be a number (time) not a string ...
Re: Dialogs Question
Posted: Sat Apr 11, 2009 10:33 am
by metal_head
Oh....yeah...thanks!
Re: Dialogs Question
Posted: Sat Apr 11, 2009 10:42 pm
by metal_head
OK, I got a new problem (that may not be fixable). The script works great, the pawn is attatched to the player and follows him wherever he goes, but I got a sound problem. OK, let's say I'm in a room with a door

... the first sound starts playing, if I go out of the room through the door, the sound will stay in the room and I'll hear the next sound in the script in the room I'm in the moment... why is that, the pawn seems to be following me, but the sounds don't ...