Results 1 to 8 of 8

Thread: Help With a Failsafe

  1. #1
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default Help With a Failsafe

    How could I implement a failsafe that's set up so that if a script leaves a certain area it will return to it?

    Thanks in advance for any help and guidance.
    Current Project: Retired

  2. #2
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    1,784
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You could set up the area you want the player to be in as an SPS-Box, using 2 points as boundaries, then checking to see if the player is inside the box.

    The other way would be using Object DTM's, and checking to see if the player is inside the node for a point.

    Currently: Working on Defending&Attacking in my Castle-Wars Script
    Project Rebuild: 90M/170M

  3. #3
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    hmmmm how could I make a SPS box, I have done SPS walking but I'm not sure how the box works. If you could point me to a tutorial that would help with the DTM then I might use that as I have never used DTM's
    Current Project: Retired

  4. #4
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    1,784
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It's not a DTM so much as an Object DTM I know that didn't make sense, but they are made(by a scripter) differently. I know there is a very detailed guide on object DTM's so I would check that out.

    For the SPS Box you would get the point for the spots of the top-left and bottom-right areas of the area you want(as a box), then declared it as something likes
    Simba Code:
    Box := intToBox(x1,y1,x2,y2);

    Then I'm not sure what you would call exactly, but it's almost definitely in the SPS include.

    Currently: Working on Defending&Attacking in my Castle-Wars Script
    Project Rebuild: 90M/170M

  5. #5
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Okay thanks Pat
    Current Project: Retired

  6. #6
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Pat so I set up the Box and everything but I'm getting:

    [Error] (135:23): Type mismatch at line 134
    Compiling failed.

    Failsafe:

    procedure FailSafe2 (Reason:String);
    var
    GoblinArea: TBox;
    begin
    if not (GoblinArea) then <--- Line 134
    BoredHuman;
    SPS_WalkToPos(Point(4830, 3700));
    end;
    This is the Box procedure:

    procedure Location;
    var
    GoblinArea: TBox;
    begin
    GoblinArea := intToBox(4800, 3662, 4872, 3744);
    end;
    Current Project: Retired

  7. #7
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You cant have it in seperate procedures. So you could do something like.
    Simba Code:
    procedure FailSafe2 (Reason:String);
    var
    GoblinArea: TBox;
    begin
    GoblinArea := intToBox(4800, 3662, 4872, 3744);
    if not (GoblinArea) then <--- Line 134
    BoredHuman;
    SPS_WalkToPos(Point(4830, 3700));
    end;

    And next time put in simba tags, but i would recomend doing a distance check from a certain point with sps.

    This is one of the dead checkers in my new soulwars script

    Simba Code:
    Function BDead: Variant;
    Var
    Z:TPoint;
    Begin
      Z:= SPS_GetMyPos;
      if (Distance(Z.X, Z.Y, 489, 5082) < 7) or FindBlackChatMessage('you are dead!') then
      Begin
      Result := True;
      end else if (Not (Distance(P.X, P.Y, 489, 5082) > 5)) or (Not FindBlackChatMessage('you are dead!')) then
      Begin
      Result := False;
      end;
    End;


    And so for your procedure you could do.

    Simba Code:
    procedure FailSafe2 (Reason:String);
    var
    Z:TPoint;
    begin
    Z:= SPS_GetMyPos;
    if (Not (Distance(Z.X, Z.Y, 4830, 3700) < 25)) then//Change the 25 to whatever you want your distance checking to be.
    Begin
    BoredHuman;
    SPS_WalkToPos(Point(4830, 3700));
    end;
    end;

  8. #8
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Alright thanks
    Current Project: Retired

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •