I have a problem with a script not working.
I have two pawns. One as a button, and one as a platform.
When the player clicks on the button with the mouse, the platform is supposed to move to a point and then return.
I have two ScriptPoint entities. One at the point the platform goes to, and the other where it returns.
When I click on the button, the platform moves to the first point (ScriptPoint1), but it stops there and does not return (scriptPoint2).
In ScriptPoint1 szEntityName I have DesPointA, and in the NextPoint I have HomePointA.
In ScriptPoint2 szEntityName I have HomePointA.
In the script for the button I have:
Spawn[()
{
Console(true);
HideFromRadar(true);
Gravity(true);
LowLevel("SelectEntityByMouse");
}]
SelectEntityByMouse[()
{
if(self.lbutton_pressed)
{
SetFlag(1, true); //Start up PlatformA to move
}]
}
Then in the script for the platform I have:
{
Spawn[()
{
HideFromRadar(true);
Gravity(false);
AddFlagOrder(1, true, "ActivateDiscA");
}]
ActivateDiscA[()
{
RotateToPlayer("", 60, false, "");
MoveToPoint("", 30, "my_sounds\\transfer.wav");
NewOrder("Home");
}]
Home[()
{
NextPoint();
MoveToPoint("", 30, "my_sounds\\transfer.wav");
Delay("", 10, "");
}]
}
I don't see anything in the console to show me why the platform is not moving to the second point. Can anyone help me out please?
Using SetFlag and AddFlagOrder
-
- Posts: 96
- Joined: Sun May 20, 2007 7:47 am
Using SetFlag and AddFlagOrder
All things you want men to do to you, you also must likewise do to them.
-
- Posts: 16
- Joined: Sat Jul 07, 2007 4:44 pm
- Location: Berlin, Germany
Hello Jaguar, just one question (I am new to scripting RF):
Is it possible to use a flag defined in one pawn script, to be used be another pawn? I dont think so. I think the flag is only seen by the pawn the flag was set for. It can't be used by the other pawn. Am I right? If, then u could use a trigger within
the level with triggerstate set by the first pawn.
Is it possible to use a flag defined in one pawn script, to be used be another pawn? I dont think so. I think the flag is only seen by the pawn the flag was set for. It can't be used by the other pawn. Am I right? If, then u could use a trigger within
the level with triggerstate set by the first pawn.
At the long run we are all dead.
-
- Posts: 96
- Joined: Sun May 20, 2007 7:47 am
I was using the rfscriptingv1 demo that came with RF. In the scripting_virgil script it has:
SetFlag(1, true); //Start up Rob to walk in
NewOrder("WaitForRob");
}]
WaitForRob[()
{
AddFlagOrder(2, true, "RobCompletedWalking"); // Rob completed walking in
RestartOrder();
}]
Then in the scripting_robot script it has:
Spawn[()
{
// Console(true);
BoxWidth(10);
AddFlagOrder(1, true, "StartWalking");
}]
StartWalking[()
{
MoveForward(WALK, SPEED, 45, "");
RotateMove(WALK, SPEED, SPEED, 0, 40, 0, "");
ShowText(1, "Rob", "", "Hello,<CR>My name is Rob Ot.", FONT,"", 0, -150, "right", 255);
MoveForward("", SPEED, 100, "");
RemoveText(1);
RotateMove(WALK, SPEED, SPEED, 0, 70, 0, "");
NewOrder("ProgressWalking");
}]
ProgressWalking[()
{
ShowTextDelay(1, "Rob", IDLE, "I'm supporting Nout to show this demo", FONT, 2, "", 10, -160, "right", 255);
SetFlag(2, true);
ShowTextDelay(9, "Nout", "Idle", "Now we animate some attributes!", FONT, 2, "", 10, -160, "left", 255);
LowLevel("AnimateAttributes");
}]
I think it works. In fact mine worked. The platform moved.
It's just that it may require specific code to get it to continue, which I can't figure out.
SetFlag(1, true); //Start up Rob to walk in
NewOrder("WaitForRob");
}]
WaitForRob[()
{
AddFlagOrder(2, true, "RobCompletedWalking"); // Rob completed walking in
RestartOrder();
}]
Then in the scripting_robot script it has:
Spawn[()
{
// Console(true);
BoxWidth(10);
AddFlagOrder(1, true, "StartWalking");
}]
StartWalking[()
{
MoveForward(WALK, SPEED, 45, "");
RotateMove(WALK, SPEED, SPEED, 0, 40, 0, "");
ShowText(1, "Rob", "", "Hello,<CR>My name is Rob Ot.", FONT,"", 0, -150, "right", 255);
MoveForward("", SPEED, 100, "");
RemoveText(1);
RotateMove(WALK, SPEED, SPEED, 0, 70, 0, "");
NewOrder("ProgressWalking");
}]
ProgressWalking[()
{
ShowTextDelay(1, "Rob", IDLE, "I'm supporting Nout to show this demo", FONT, 2, "", 10, -160, "right", 255);
SetFlag(2, true);
ShowTextDelay(9, "Nout", "Idle", "Now we animate some attributes!", FONT, 2, "", 10, -160, "left", 255);
LowLevel("AnimateAttributes");
}]
I think it works. In fact mine worked. The platform moved.
It's just that it may require specific code to get it to continue, which I can't figure out.
All things you want men to do to you, you also must likewise do to them.