laser hook script, help needed

hey folks

i downloaded this map: http://www.tribaloutpost.com/tribes2/maps/view/battle-room-2-enders-war

and it happens to have a script that turns your targeting laser into a sort of grappling hook, basically it pulls you to the object youre targeting

i sent a mail to the author asking for permission etc but havent got a response yet.

heres the script: http://www.speedyshare.com/984661355.html

ctrl+f for "laser" i think thats where the code for the laser hook starts.
ive tried to remove all the other code (which he uses for his map to spawn objects randomly) but when i did, the hook wouldnt work anymore.
i probably removed too much, idk..

i made my own map and included his script as-is and it worked well on my own lan server, then i got someone to put it on his dedi but when trying to load the map the server would crash.

i went on irc and i was told that i shouldn't try to change weapons on the fly like that, someone said "I'd use a MapSupport package" and someone else said "server.cs to integrate"

i have absolutely no idea what im supposed to do, i cant script and idk the proper way to get this script running on a server, do i need to make a whole new gamemode like TR2?

i have no T2 modding experience except of making maps and doing small replacements..

any help is greatly aprechiated :)

Comments

  • We'll help you. Just have patience.
  • Please hold untill our community has a smart member active....
  • hey folks

    i downloaded this map: http://www.tribaloutpost.com/tribes2/maps/view/battle-room-2-enders-war

    and it happens to have a script that turns your targeting laser into a sort of grappling hook, basically it pulls you to the object youre targeting

    i sent a mail to the author asking for permission etc but havent got a response yet.

    heres the script: http://www.speedyshare.com/984661355.html

    ctrl+f for "laser" i think thats where the code for the laser hook starts.
    ive tried to remove all the other code (which he uses for his map to spawn objects randomly) but when i did, the hook wouldnt work anymore.
    i probably removed too much, idk..

    i made my own map and included his script as-is and it worked well on my own lan server, then i got someone to put it on his dedi but when trying to load the map the server would crash.

    i went on irc and i was told that i shouldn't try to change weapons on the fly like that, someone said "I'd use a MapSupport package" and someone else said "server.cs to integrate"

    i have absolutely no idea what im supposed to do, i cant script and idk the proper way to get this script running on a server, do i need to make a whole new gamemode like TR2?

    i have no T2 modding experience except of making maps and doing small replacements..

    any help is greatly aprechiated :)

    Send the code to one of the members here that know how to code, and if they are not busy and nice enough they can remove no needed stuff, and just leave the codes you would like.
  • i can try, who would these members be? :P

    also, the author of the map i got the script from posted:
    hook laser:

    I have added a variant of Bean's string idea to the map (Thx Dev and Riatha for the script and idea). This "hook", placed where the target laser would be

    is Dev or Riatha still active? since it may be a good idea for me to try and ask the initial authors
  • Dev made most of his code public on http://www.advancedmod.com/. He developed Havoc mod way back when. I don't think he's active anymore.
  • edited March 2009
    okay, i tried again to seperate the hook code from the rest and thought it worked but in fact it was just the .dso which made it work.

    heres the script for only the hook, or at least i think this is all it needs:
    function CnHGame::startMatch( %game )
    function TargetingLaserImage::onFire(%data, %Player, %Slot)
    {
       if (%Player.FlingyTime == true)
       {
          %Player.setImageTrigger($WeaponSlot, false);
    
          return;
       }
       %Player.FlingyTime = true;
    
       parent::onFire(%data, %Player, %slot);
    
       %Normal = VectorNormalize(%Player.getMuzzleVector($WeaponSlot));
       %ScaledVector = vectorScale(%Normal, $VisibleDistance);
    
       %StartPosition = %Player.getMuzzlePoint($WeaponSlot);
       %EndPosition = vectorAdd(%StartPosition, %ScaledVector);
    
       %Target = containerRayCast(%StartPosition, %EndPosition, $EverythingMask, %Player);
       if (%Target $= "0")
       {
          %Player.setImageTrigger($WeaponSlot, false);
    
          if (%Player.GrappleNotify != true)
          {
             //messageClient(%Player.client, '', "Nothing in range to grapple onto.");
    
             %Player.GrappleNotify = true;
             //%Player.schedule(1250, ResetGrappleMessage);
          }
    
          return;
       }
    
       %Player.PullStrength = %Player.getDataBlock().mass * 0.5;
    
       %Player.BeamYank(1);
    }
    
    function TargetingLaserImage::deconstruct(%data, %Player, %Slot)
    {
       Parent::deconstruct(%data, %Player, %Slot);
    
       %Player.flingyTime = "";
    
       if (%Player.BeamYank !$= "")
       {
          cancel(%Player.BeamYank);
          %Player.BeamYank = "";
       }  
    }
    
    function Player::BeamYank(%Player, %LoopCounter)
    {
       if (%Player.FlingyTime != true)
          return;
    
       // For the sake of lag, we only test the current facing every 4th time.
       if (%LoopCounter == 0)
       {
          %Vector = %Player.getMuzzleVector($WeaponSlot);
          %Range = vectorScale(%Vector, $VisibleDistance);
    
          %StartPosition = %Player.getMuzzlePoint($WeaponSlot);
          %EndPosition = vectorAdd(%StartPosition, %ScaledVector);
    
          %Target = containerRayCast(%StartPosition, %EndPosition, $EverythingMask, %Player);
          if (%Target $= "0")
          {
             %Player.setImageTrigger($WeaponSlot, false);
    
             //messageClient(%Player.client, '', "Nothing in range to grapple onto.");
             return;
          }
       }
    
       %Position = posFromTransform(%Player.getTransform());
    
       %Normal = VectorNormalize(%Player.getMuzzleVector($WeaponSlot));
       %ImpulseVector = VectorScale(%Normal, %Player.PullStrength);
    
       %Player.applyImpulse(%Position, %ImpulseVector);
    
       %LoopCounter++;
       if (%LoopCounter > 3)
          %LoopCounter = 0;
    
       %Player.BeamYank = %Player.schedule(2000, BeamYank, %LoopCounter);
    }
    
    function Player::ResetGrappleMessage(%Player)
    {
       %Player.GrappleNotify = "";
    }
    

    i dunno if i even need the first line, or if im missing a line which executes the script, idk..

    ive been told that the script would need to be "converted" so that it can be run on the server.

    now since i cant script and im not willing to devote idk how many hours to learn it just to get this script working i may be at a dead end.

    UNLESS there is someone who could do this for me (incase it isnt too much work), in return all i can offer is my modelling or mapping skills.

    i dont believe that each single member of a modding community should be able to do every aspect of modding, im specialised in modelling and animating, others are specialised in coding, helping each other out is key.

    to me, this hook script would revolutionize tribes2 cause it eliminates groundshooting and i have plans to make various maps specially designed for this script. it could support other game modes like rabbit or team rabbit for which i would love to make maps as well.

    if you want you can download my test map here: http://liberty-unleashed.co.uk/reb/argh02fixingHOOK.vl2
    (rename it to .vl2 incase it downloads as a .zip)
    put it in your base folder, run a lan server, CnH, load my map (argh02fixingHOOK) and experience the greatness of just pulling yourself back into the action when youre out of energy, this would be so much fun online :p

    [/beg]
  • that code looks very familiar to public code I saw on Advanced Mod.
    Dev made most of his code public on http://www.advancedmod.com/. He developed Havoc mod way back when. I don't think he's active anymore.

    I just noticed that...
Sign In or Register to comment.