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.
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
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 ScriptProject Rebuild: 90M/170M
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
It's not a DTM so much as an Object DTMI 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 ScriptProject Rebuild: 90M/170M
Okay thanks Pat
Current Project: Retired
Pat so I set up the Box and everything but I'm getting:
[Error] (135:23): Type mismatch at line 134
Compiling failed.
Failsafe:
This is the Box procedure:procedure FailSafe2 (Reason:String);
var
GoblinArea: TBox;
begin
if not (GoblinArea) then <--- Line 134
BoredHuman;
SPS_WalkToPos(Point(4830, 3700));
end;
procedure Location;
var
GoblinArea: TBox;
begin
GoblinArea := intToBox(4800, 3662, 4872, 3744);
end;
Current Project: Retired
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;
My Scripts:
Cafinated Killer|~~| Ghoul Killer With Bank|~~|CraftingGuild
First TuT, Objonscreenfinder!
Alright thanks
Current Project: Retired
There are currently 1 users browsing this thread. (0 members and 1 guests)