vsTASKER 7 Tutorial
×
Menu
Index

Simple Logic

 
Once an entity (unit or vehicle) has been created on VBS by vsTASKER, sending instruction from a logic is quite simple.
It would be the same as using a script on VBS with much more ease.
 
VBSproxy component is retrieved globally using:
  VBSproxy* proxy = (VBSproxy*) P:findComponent("VBSproxy");
 
 
 
No Auto Target:
  DTcommand cmd;
  sprintf(cmd.str, "%s disableAI \"AUTOTARGET\";", E:vbs->var);
  proxy->sendMessage(&cmd);
 
No Path Planning:
  VBSproxy* proxy = (VBSproxy*) P:findComponent("VBSproxy");
  DTcommand cmd;
 
  if (E:vbs->isVehicle()) {
     sprintf(cmd.str, "(driver %s) disableAI \"PATHPLAN\";", E:vbs->var);
     proxy->sendMessage(&cmd);
  }
 
No Waypoint Stop:
  DTcommand cmd;
 
  if (E:vbs->isVehicle()) sprintf(cmd.str, "(driver %s) disableAI \"WAYPOINT_STOP\";", E:vbs->var);
  else if (E:vbs->isUnit()) sprintf(cmd.str, "%s disableAI \"WAYPOINT_STOP\";", E:vbs->var);
  proxy->sendMessage(&cmd);
 
No Threat Path:
  DTcommand cmd;
 
  if (E:vbs->isVehicle()) sprintf(cmd.str, "(driver %s) disableAI \"THREAT_PATH\";", E:vbs->var);
  else if (E:vbs->isUnit()) sprintf(cmd.str, "%s disableAI \"THREAT_PATH\";", E:vbs->var);
  proxy->sendMessage(&cmd);
 
 
Speed Limit:
  DTcommand cmd;
 
  if (E:vbs->isVehicle()) {
     sprintf(cmd.str, "%s setMaxSpeedLimit 90;", E:vbs->var);
     proxy->sendMessage(&cmd);
  }
 
Steering:
  DTcommand cmd;
  sprintf(cmd.str, "%s setTurnWanted %.3f; %s setThrustWanted %.3f;",
          E:vbs->var, turn_factor, E:vbs->var, speed_factor);
  proxy->sendMessage(&cmd);
 
 
  DTcommand cmd;
 
  Entity* ied = (Entity*) S:findEntity(E:attached_ied);
  if (ied) {
     sprintf(cmd.str, "%s setDamage 1;", ied->vbs->var);
     proxy->sendMessage(&cmd);
  }