Author Topic: Helicopter verticle takeoff help  (Read 1730 times)

Try doing the following, see if anything seems to happen.

If nothing happens there try changing %obj.AddVelocity to %this.addVelocity.
Code: [Select]
function GSFSeaCopterVehicleData::OnTrigger(%this, %obj, %triggerNum, %val)
{
%obj.addVelocity("0 0 10");
echo("Rofl copter goes SwooshSwooshSwoosh!");
}

flyingWheeledVehicle::onTrigger(%this,%obj,%triggerNum,%val) is not an existing method.  It will not work.  It has to be packaged with the armor::onTrigger() and parented.

I'm still getting syntax errors:
Code: [Select]
package GSFSeaCopter
{
armor::onTrigger(%this,%obj,%slot,%state)
{
if(%slot == 2 && %state == 1 && %obj.getObjectMount().getDataBlock().getName() $= "GSFSeaCopter")
{
%obj.addVelocity("0 0 10");
}
Parent::onTrigger(%this,%obj,%slot,%state);
}
};
activatePackage(GSFSeaCopter);


Code: [Select]
function ServerCmdHeliup(%client)
{
%pmount = %client.player.getObjectMount();
if(%pmount.getDataBlock().GetName() $= "NameVehicle")
{
%pmount.setVelocity("0 0 10");
}else{
messageclient(%client,"","You are not on a Name.");
}
}

function NameVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val){
      if(%triggerNum == 2){
      ServerCmdHeliup(%obj.spawnbrick.client);
  }
   }
}
This does get the Vehicle up, but you have to keep on repressing the spacebar.

Why would you use a server command if anyone can do it by pressing Jump? I could understand if you'd made a special keybind, but that just seems useless.

Code: [Select]
function NameVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val){
      if(%triggerNum == 2){
      %pmount = %client.player.getObjectMount();
      %pmount.setVelocity("0 0 10");
 }
   }
}
« Last Edit: August 14, 2009, 10:33:52 AM by Sniper4hire »

Dumping a vehicle:
Code: [Select]
Member Fields:
  canSetIFLs = "0"
  dataBlock = "BoxTrain"
  disableMove = "0"
  position = "-33 -36.9998 1.00139"
  rotation = "1 0 0 0"
  scale = "1 1 1"
Tagged Fields:
  brickGroup = "7761"
  color = "1 1 1 1"
  creationTime = "44934"
  lastDrivingClient = "7759"
  spawnBrick = "9012"
Methods:
  addScheduledEvent() -
  applyDamage() - (float amt)
  applyImpulse() - (Point3F Pos, VectorF vel)
  applyRepair() - (float amt)
  cancelEvents() -
  canCloak() -
  clearDamageDt() -
  clearEvents() -
  clearInventory() -
  clearNTObjectName() -
  clearScopeToClient() - clearScopeToClient(%client)Undo the effects of a scopeToClient() call.
  Damage() -
  decInventory() -
  delete() - obj.delete()
  disableNodeColor() - (string name)
  dump() - obj.dump()
  dumpEvents() -
  finalExplosion() -
  getAIRepairPoint() - Get the position at which the AI should stand to repair things.
  getCameraFov() -
  getClassName() - obj.getClassName()
  getControllingClient() - Returns a GameConnection.
  getControllingObject() -
  getDamageFlash() -
  getDamageLevel() -
  getDamagePercent() -
  getDamageState() -
  getDataBlock() - ()Return the datablock this GameBase is using.
  getEnergyLevel() -
  getEnergyPercent() -
  getEyePoint() -
  getEyeTransform() -
  getEyeVector() -
  getForwardVector() - Returns a vector indicating the direction this object is facing.
  getGhostID() -
  getGroup() - obj.getGroup()
  getId() - obj.getId()
  getImageAmmo() - (int slot)
  getImageLoaded() - (int slot)
  getImageSkinTag() - (int slot)
  getImageState() - (int slot)
  getImageTrigger() - (int slot)
  getInventory() -
  getMountedImage() - (int slot)
  getMountedObject() - (int slot)
  getMountedObjectCount() -
  getMountedObjectNode() - (int node)
  getMountNodeObject() - (int node)
  getMountSlot() - (ShapeBaseImageData db)
  getMuzzlePoint() - (int slot)
  getMuzzleVector() - (int slot)
  getName() - obj.getName()
  getObjectBox() - Returns the bounding box relative to the object's origin.
  getObjectMount() - Returns the ShapeBase we're mounted on.
  getPendingImage() - (int slot)
  getPosition() - Get position of object.
  getRechargeRate() -
  getRepairRate() -
  getScale() - Get scaling as a Point3F.
  getShapeName() -
  getSkinName() -
  getSlotTransform() - (int slot)
  getTransform() - Get transform of object.
  getType() - obj.getType()
  getUpVector() - Returns a vector indicating the relative upward direction of this object.
  getVelocity() -
  getWaterCoverage() -
  getWheelCount() - obj.getWheelCount()
  getWhiteOut() -
  getWorldBox() - Returns six fields, two Point3Fs, containing the min and max points of the worldbox.
  getWorldBoxCenter() - Returns the center of the world bounding box.
  hideNode() - (string nodeName)
  incInventory() -
  isCloaked() -
  isDestroyed() -
  isDisabled() - True if the state is not Enabled.
  isEnabled() -
  isHidden() -
  isImageFiring() - (int slot)
  isImageMounted() - (ShapeBaseImageData db)
  isMounted() - Are we mounted?
  isNodeVisible() - (string nodeName)
  maxInventory() -
  mountImage() - (ShapeBaseImageData image, int slot, bool loaded=true, string skinTag=NULL)
  mountObject() - ( ShapeBase object, int slot )Mount ourselves on an object in the specified slot.
  onActivate() -
  onCollision() -
  onDriverLeave() -
  onInventory() -
  onRemove() -
  pauseThread() - (int slot)
  pickup() -
  playAudio() - (int slot, AudioProfile ap)
  playThread() - (int slot, string sequenceName)
  ProcessInputEvent() -
  save() - obj.save(fileName, <selectedOnly>)
  schedule() - object.schedule(time, command, <arg1...argN>);
  scopeToClient() - (NetConnection %client)Cause the NetObject to be forced as scoped on the specified NetConnection.
  serializeEvent() -
  serializeEventToString() -
  setCameraFov() - (float fov)
  setCloaked() - (bool isCloaked)
  setDamageDt() -
  setDamageFlash() - (float lvl)
  setDamageLevel() - (float level)
  setDamageState() - (string state)
  setDamageVector() - (Vector3F origin)
  setDatablock() - (DataBlock db)Assign this GameBase to use the specified datablock.
  setEnergyLevel() - (float level)
  SetEventEnabled() -
  setHidden() - (bool show)
  setIflFrame() - (ifl name, int)
  setImageAmmo() - (int slot, bool hasAmmo)
  setImageLoaded() - (int slot, bool loaded)
  setImageTrigger() - (int slot, bool isTriggered)
  setInventory() -
  setInvincibleMode() - (float time, float speed)
  setName() - obj.setName(newName)
  setNodeColor() - (string name, float color)
  setNTObjectName() -
  setRechargeRate() - (float rate)
  setRepairRate() - (float amt)
  setScale() - (Point3F scale)
  setScopeAlways() - Always scope this object on all connections.
  setShapeName() - (string tag)
  setShapeNameColor() - (string RGB)
  setShapeNameDistance() - (F32)
  setSkinName() - (string tag)
  setThreadDir() - (int slot, bool isForward)
  setTransform() - (Transform T)
  setVelocity() - (Vector3F vel)
  setWheelPowered() - obj.setWheelPowered(wheel#,bool)
  setWheelSpring() - obj.setWheelSpring(wheel#,spring)
  setWheelSteering() - obj.setWheelSteering(wheel#,float)
  setWheelTire() - obj.setWheelTire(wheel#,tire)
  setWhiteOut() - (float flashLevel)
  startFade() - ( int fadeTimeMS, int fadeDelayMS, bool fadeOut )
  stopAudio() - (int slot)
  stopThread() - (int slot)
  teleportEffect() -
  throw() -
  throwObject() -
  ToggleEventEnabled() -
  tumbleCheck() -
  unHideNode() - (string nodeName)
  unmount() - Unmount from the currently mounted object if any.
  unmountImage() - (int slot)
  unMountObject() - (ShapeBase obj)Unmount an object from ourselves.
  use() -
There is no addVelocity() in this class.

Thanks Sniper4hire it works fine; I'll give credit when the Sea Copter is released. And thanks everyone else for helping.

Tom

There is no addVelocity() in this class.
Then addVelocity is in its parent classes.

Then addVelocity is in its parent classes.
No, it is not.  If it was in a parent class, the WheeledVehicle class would contain the method.

Tom

Oh yeah, addVelocity is only for player objects, but setVelocity is on many classes.