Jump to content


Photo

Triggering with a mover elevator


5 replies to this topic

#1 Garreth

Garreth

    Member

  • Member
  • PipPip
  • 210 posts

Posted 26 March 2012 - 02:32 PM

I made a elevator it has 3 floors, When the elevator comes close to a door there is a block that moves trough a trigger multiple block wich is supposed to controll the 3 floors doors, but nothing happens, i dont think a trigger reacts on a mover.
Normaly the trigger should react, i have made arrow triggers like that.
How can i controll doors on 3 floors to open and close?
Posted Image
Taf you, you taffin taffer

#2 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11495 posts

Posted 26 March 2012 - 03:45 PM

Are you open to scripting?

There are spawnargs you can place on the atdm:mover_multistate_position at each floor:

"call_on_arrive" "<script function name>"

"call_on_leave" "<script function name>"

When the elevator arrives at a floor, the m_m_p at that floor will call the "call_on_arrive" script function.

When the elevator leaves, the m_m_p at that floor will call the "call_on_leave" script function.

Each of these script functions can trigger whatever activities you want to occur when arriving or leaving.

#3 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11495 posts

Posted 26 March 2012 - 03:50 PM

For example, you might have on the m_m_p:

"call_on_arrive" "ArriveFirstFloor"
"call_on_leave" "LeaveFirstFloor"

And the script functions could just open/close the elevator doors.


void ArriveFirstFloor()
{
     $ElevatorDoorLeft1.Open();
     $ElevatorDoorRight1.Open();
}

void LeaveFirstFloor()
{
     $ElevatorDoorLeft1.Close();
     $ElevatorDoorRight1.Close();
}


#4 Garreth

Garreth

    Member

  • Member
  • PipPip
  • 210 posts

Posted 26 March 2012 - 05:26 PM

I get an error when i run the script

File "<string>", line 1
void ArriveFirstFloor()
^
SyntaxError: invalid syntax




void ArriveFirstFloor()
{
$atdm_mover_door_sliding_1.Open();
$atdm_mover_door_sliding_4.Open();
}

void LeaveFirstFloor()
{
$atdm_mover_door_sliding_1.Close();
$atdm_mover_door_sliding_4.Close();
}


i dont know anything of scripting.
Taf you, you taffin taffer

#5 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11495 posts

Posted 26 March 2012 - 06:15 PM

Do you get the error when the map is loading, or when the script runs after the elevator arrives?

PM me the script file, please.

#6 stumpy

stumpy

    Advanced Member

  • Member
  • PipPipPip
  • 1601 posts

Posted 27 March 2012 - 11:39 AM

a

void main()
{
sys.print("map script running.\n");
}

is needed as the last function in the script file, else you get a script error.
it always goes at the end of the script file, its primaly use is to run scripts needed at start of map, eg like a clock with hands.

Edited by stumpy, 27 March 2012 - 11:43 AM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users