Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Question about parameters
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Question about parameters

Assuming the parameters are the Parent, Child and State, they are primarily used in the declaration to determine what collides with what.

Basically, they are there so that within this routine if you do need to reference them within the braces, you can call them from the void, and the void pulls them from the declaration. This can save you from typing in the object names from the Level Editor on multiple occasions if things only happen between these two objects. A good example is using alState in an if statement:

PHP Code: (Select All)
void func_shelf(string &in asEntityint alState)
{
     if (
alState == 1)           //Pull lever down all the way.
     
{
     
SetMoveObjectState("shelf",1.0f);           //Move shelf to reveal path
     
PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);       //Play some catchy tunes
          
return;
     }


Another one could be something like using a key to open a door:

PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""rusty_key""locked_door_1""OpenDoor"true);
}
 
void OpenDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);          //locked_door_1 unlocks
    
PlaySoundAtEntity("""unlock_door"asEntity0false);     //Play unlock sound at door
    
RemoveItem(asItem);                     //Key comes out of inventory


Bottom line is that if something happens to the declared Parent, Child, State, Effects etc, they can be referenced within the braces with ease Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 12-26-2013, 05:59 AM by Romulator.)
12-26-2013, 05:56 AM
Find


Messages In This Thread
Question about parameters - by Zokrar - 12-26-2013, 04:58 AM
RE: Question about parameters - by Romulator - 12-26-2013, 05:56 AM
RE: Question about parameters - by Zokrar - 12-26-2013, 04:52 PM
RE: Question about parameters - by WALP - 12-26-2013, 05:17 PM
RE: Question about parameters - by Zokrar - 12-26-2013, 05:22 PM
RE: Question about parameters - by Zokrar - 12-27-2013, 01:59 AM
RE: Question about parameters - by Adrianis - 12-28-2013, 01:05 AM
RE: Question about parameters - by Romulator - 12-27-2013, 02:07 AM



Users browsing this thread: 2 Guest(s)