This thread is only to highlight upcoming breaking changes to the ScriptAPI in Alpha 1.2.0 (so you can plan accordingly).
The update is still work-in-progress and will take some time to complete.
"IPlayer.SetBotType()" and "IPlayer.BotType" will be removed in future versions of SFD and replaced with the new concept "BotBehavior" which will control how a bot will behave. BotBehavior can only activate the old BotType.TutorialA for the time being but will be built upon in future versions.
Code: Select all
// SetBotType is removed
// player.SetBotType(BotType.TutorialA);
// BotBehavior is the replacement
BotBehavior bb = new BotBehavior();
bb.Active = true;
bb.TutorialMelee = true;
player.SetBotBehavior(bb);
A new concept PlayerCommands will be introduced which can control a player in more detail. This can be done through the ScriptAPI or by chaining command triggers together in the editor.
Following commands will be available:
► Show Spoiler
/// <summary>
/// 0, No action
/// </summary>
None = 0,
/// <summary>
/// 1, Moves the player to the given position (x-coordinate only) in strict known situations. Continous action.
/// </summary>
MoveToPosition = 1,
/// <summary>
/// 2, Waits for the player to reach given destination set with MoveToPosition. Only useful when paired with MoveToPosition.
/// </summary>
DestinationReached = 2,
/// <summary>
/// 3, Makes the player walk when moving.
/// </summary>
Walk = 3,
/// <summary>
/// 4, Makes the player run when moving.
/// </summary>
Run = 4,
/// <summary>
/// 5, Makes the player sprint when moving.
/// </summary>
Sprint = 5,
/// <summary>
/// 6, Makes the player jump when possible.
/// </summary>
Jump = 6,
/// <summary>
/// 7, Land, completes once the player is standing on ground. Good to pair with Jump.
/// </summary>
Land = 7,
/// <summary>
/// 8, Makes the player roll when possible.
/// </summary>
Roll = 8,
/// <summary>
/// 9, Makes the player dive when possible.
/// </summary>
Dive = 9,
/// <summary>
/// 10, Stops any MoveToPosition action.
/// </summary>
StopMove = 10,
/// <summary>
/// 11, Makes the player start crouching. Certain actions can't be performed while Crouching is active until StopCrouch is called. Continous action.
/// </summary>
Crouch = 11,
/// <summary>
/// 12, Stops any Crouch action.
/// </summary>
StopCrouch = 12,
/// <summary>
/// 13, Makes the player face at given direction or target.
/// </summary>
FaceAt = 13,
/// <summary>
/// 14, Makes the player start the grab sequence.
/// </summary>
Grab = 14,
/// <summary>
/// 15, Makes the player draw the handgun weapon if any equipped.
/// </summary>
DrawHandgun = 15,
/// <summary>
/// 16, Makes the player draw the melee weapon if any equipped.
/// </summary>
DrawRifle = 16,
/// <summary>
/// 17, Makes the player draw the melee weapon if any equipped.
/// </summary>
DrawMelee = 17,
/// <summary>
/// 18, Makes the player draw the throwable weapon if any equipped.
/// </summary>
DrawThrowable = 18,
/// <summary>
/// 19, Makes the player draw/use the powerup weapon/item if any equipped.
/// </summary>
DrawPowerup = 19,
/// <summary>
/// 20, Makes the player sheath current drawn weapon.
/// </summary>
Sheath = 20,
/// <summary>
/// 21, Makes the player pick up or activate items in the world.
/// </summary>
Activate = 21,
/// <summary>
/// 22, Makes the player drop current drawn item.
/// </summary>
Drop = 22,
/// <summary>
/// 23, Makes the player enter throwing mode with current drawn item.
/// </summary>
EnterThrowingMode = 23,
/// <summary>
/// 24, Makes the player exit throwing mode.
/// </summary>
ExitThrowingMode = 24,
/// <summary>
/// 25, Prepares to throw current throwable item.
/// </summary>
PrepareThrow = 25,
/// <summary>
/// 26, Throws current throwable item.
/// </summary>
Throw = 26,
/// <summary>
/// 27, Makes the player reload current drawn weapon (if possible).
/// </summary>
Reload = 27,
/// <summary>
/// 28, Makes the player kick.
/// </summary>
Kick = 28,
/// <summary>
/// 29, Makes the player start aiming at a specific direction/target when possible. Must call StopAim to stop aiming. Continous action.
/// </summary>
AimAt = 29,
/// <summary>
/// 30, Makes the player stop aiming.
/// </summary>
StopAim = 30,
/// <summary>
/// 31, Makes the player attack/fire once.
/// </summary>
AttackOnce = 31,
/// <summary>
/// 32, Makes the player attack/fire until StopAttack is called. Continous action.
/// </summary>
AttackRepeat = 32,
/// <summary>
/// 33, Makes the player stop attacking from AttackRepeat.
/// </summary>
StopAttackRepeat = 33,
/// <summary>
/// 34, Makes the player block.
/// </summary>
Block = 34,
/// <summary>
/// 35, Makes the player take cover.
/// </summary>
TakeCover = 35,
/// <summary>
/// 36, Makes the player drop a platform.
/// </summary>
DropPlatform = 36,
/// <summary>
/// 37, Makes the player start the grab sequence. If a player is grabbed it will not end until Drop or Throw is called. Continous action.
/// </summary>
GrabInfinite = 37,
/// <summary>
/// 38, Makes the player start aiming at a specific direction/target when possible. Must call StopAim to stop aiming. Continous action.
/// </summary>
AimAtPrecise = 38,
/// <summary>
/// 39, Makes the player enter death kneel and fall.
/// </summary>
DeathKneel = 39,
/// <summary>
/// 40, Makes the player enter death kneel until player falls or StopDeathKneel is called. Continous action.
/// </summary>
DeathKneelInfinite = 40,
/// <summary>
/// 41, Makes the player stop death kneeling.
/// </summary>
StopDeathKneel = 41,
/// <summary>
/// 42, Makes the player fall.
/// </summary>
Fall = 42,
/// <summary>
/// 43, Makes the player stagger for a short period.
/// </summary>
Stagger = 43,
/// <summary>
/// 44, Makes the player stagger until StopStagger or other disabling actions. Continous action.
/// </summary>
StaggerInfinite = 44,
/// <summary>
/// 45, Makes the player stop stagger.
/// </summary>
StopStagger = 45,
/// <summary>
/// 46, Performs all player command stop actions.
/// </summary>
StopAll = 46
"IPlayer.RunToPosition()" will be removed in future versions of SFD and replaced with the "MoveToPosition" command.
Code: Select all
// RunToPosition will be removed
// player.RunToPosition(new Vector2(100f, 0f), 1);
// PlayerCommand is the replacement
player.AddCommand(new PlayerCommand(PlayerCommandType.MoveToPosition, new Vector2(100f, 0f)));
Note that PlayerCommands will only be possible to perform while all input is disabled for the targeted player. While PlayerCommands can control a player the purpose is not to be able to create your own AI (even if you can do that to a certain degree) but rather to allow map makers to script NPC:s to create short action scenes or cutscenes in their maps.
| ! | Message from: Gurt |
| Old maps using the old code will still run for some time after this update but you should update your maps as soon as possible after this update before the functions are removed permanently in future versions of SFD. |
Other new content for the ScriptAPI for Alpha 1.2.0 will be listed in the patch notes once we release the update.