User Tools

Site Tools


scripting:basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting:basics [2022/08/11 14:14] – [Get a CharacterEntity, and control it] jerryhopperscripting:basics [2022/08/11 14:32] (current) jerryhopper
Line 45: Line 45:
  
  
-So, the result of the above is that we have a variable with the name 'btr' which 'type' is 'GenericEntity'+So, the result of the above is that we have a variable with the name '**btr**' which '**type**' is '**GenericEntity**'
  
  
Line 76: Line 76:
 Lets continu from Example #2.  We now have an entity, and its time we control it. Lets continu from Example #2.  We now have an entity, and its time we control it.
  
-==== Character: Change stance ====+==== Change stance ====
  
  
Line 94: Line 94:
  
 Great!  You are now able to control a soldier's stance by script! Great!  You are now able to control a soldier's stance by script!
 +
 +==== Move ====
 +
 +Now lets try make the character move. To move a character, we need to know what speed and direction you want to move. We will use a variable which we declare as a '[[scripting:datatypes#vector]]' as shown below.
 +
 +
 +  vector direction = {0,0,1};
 +
 +The 'soldier_c' variable contains the CharacterController, and like with the stances, you can control the movement. Below you see the 'SetMovement' command to which we pass 'speed' (2) and the variable 'direction'.
 +
 +  soldier_c.SetMovement(2, direction);
 +  
 +That should do the trick. Your character should be moving in the given direction.
scripting/basics.1660223691.txt.gz · Last modified: 2022/08/11 14:14 by jerryhopper

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki