Skip to content

Example Chat Commands

Displaying the Player's Name - Beginner

  1. Open the "Full Blueprint Editor" for your command blueprint, and under the "Functions" context on the left, select "Override" and then select the function that corresponds to the Command Type that you specified earlier. (Server, Client, Standalone). In this example we are using On Server Execute Command. example_command_type

  2. Your blueprint should now look like the following image. The Return Node takes a Text value, which is messaged to the player upon command execution. example_return_node

  3. For this example, let's make the command message the player their own player name. To do this, we must first drag from the CallingPlayer pin of the OnServerExecuteCommand node, and type Get Player State. Press enter on the GetPlayerState selection to add the node to the blueprint graph. example_get_player_state

  4. Now, drag from the Player State pin, and type Get Player Name. Select that function and add it to the graph. example_get_player_name

  5. Drag the ReturnValue pin of the Get Player Name node and type Make Plain Response. This will create an un-localized chat response which the player will see. Connect the result of this to the Return Node.

example_make_plain_responseexample_unlocalized_response

  1. Try your new command! example_test_command

Using Command Parameters - Intermediate

  1. For this example, we are going to make each parameter be messaged to the player. To do this, drag from the Parameters pin and add a ForEachLoop node. example_for_each_loop

  2. From the Array Element pin, connect to a Make Plain Response node. Connect to the Loop Body execute pin of the ForEachLoop node.

example_inter_make_plain_response

  1. From the Make Plain Response node, create a Message Player node. example_message_player_node

  2. Ensure the PlayerController is connected to the Message Player node. Your blueprint should look something like this: example_inter_node_connections

  3. Once the ForEachLoop has completed, you can return a message to signify it has finished. From the Completed execution pin, make a plain response, and connect it to the Return node. example_completed_plain_response

  4. Test it! example_test_intermediate

Teleport All Players To You - Intermediate

  1. This command must be executed on the server as it needs to access all player's dinosaurs.

  2. Drag off from the CallingPlayer pin on the OnServerExecuteCommand node and add a Get Controlled Pawn node into the graph. example_get_controlled_pawn

  3. Take the ReturnValue pin of the new node and add an IsValid "macro" node. The "macro" node is the node with the white ? icon. We need to check if the player pawn is "Valid" so that we don't try to do anything to an invalid pawn. example_isvalid_pawn

  4. If the calling player's pawn is not valid, we need to return a message to explain this! example_invalid_pawn

  5. From the Valid execution pin, we can create a Teleport All Location node. This takes a location and optionally, an Instance. An instance is a place such as a Home Cave or Hatchling Cave. We won't use this here. example_valid_pawn_pin

  6. From the ReturnValue pin on the Get Controlled Pawn node, add a Get Actor Location node, then connect the output pin of that to the Location pin on the Teleport All Location node. example_teleport_return_value

  7. We should return a message to indicate the command completed successfully: example_command_successful

  8. Test it!

Footer Image

4a581e9