This script manages a PaintBall game, and the bot needs to have Eject and Build rights. Read the instructions at the begining of the script to customise it.
To count the objects dropped by the bot when it ejects some-one and clear them, use the SkullCounter Bot.
You can download this script: click here
[Head] Type=Script Version=2.0 [Settings] Origin=0.000n 0.000w 0.00a 0.0° Run [Script] ################################### # The PaintBall Bot # # a Xelagot script # # (c) 1999 Alex Grigny de Castro # ################################### # This is a paintball bot # which is trained to eject on left mouse click # outside the GZ zone, within a certain range # it will eject for 5 seconds # but will not eject other bots, nor the Caretaker # define in Sub Settings the safe zone (GZ) # by entering the NW and SE coords of GZ # and the other parameters as necessary # if you wish it to put an object (e.g.) a skull # where the victim was hit # (in worlds without registry only, it must have Build rights) # define the $Model, otherwise leave it blank var $Error var %Avatar, @Pos, @Center, @Seat, @LimitA, @LimitB var @gz_NW, @gz_SE var @InGZ, %InGZ var %maxd var &Hunter, &Victim, %Session var ~mem, $Model var $rules var /t_Ejected ClearLists OnWorldReconnectEvent Reconnect $Error = "" Stop GetLocation @Pos Gosub Settings WarpLocal @Seat OnAvatarClickEvent Click1 Say Ready to shoot... Stop RandomMove Label MainLoop Goto MainLoop Label End IfString $Error <> "" Say $Error End Sub Settings # bot's avatar %Avatar = 255 # maximum shooting range in meters %maxd = 60 Concat $rules "Rules: 1. not in GZ 2. target within " %maxd "m" # select a model for the bot to dump where he hits the victim # if $Model left blank, no object will be dumped # otherwise, define it as for example # $Model = "skull.rwx" $Model = "" GetModel ~mem $Model @Center = 0n 0w 0a 0 # GZ WAR: North-West and South-East coordinates of GZ area @gz_NW = 2.050n 1.560w 0a 0 @gz_SE = 0.950s 1.460e 0a 0 # coords of where bot remains, and of area covered by bot @Seat = @Center @LimitA = 20n 20w 0a @LimitB = 20s 20e 0a # set Random motion parameters, and avatar RandomCentre @Seat RandomHRadius 10 RandomHStep 2 RandomHShift 20 RandomHAngle 30 RandomVHeight 3 RandomVStep 1 RandomWait 0 Avatar %Avatar EndSub Event Click1 # get ejector data GetSourcePerson &Hunter # get target (= victim) data GetTargetPerson &Victim # check source is in own area IfLoc &Hunter IsInSquare @LimitA @LimitB # carry on LOL Else EndEvent # Victim's session to check eject timeout GetSession %Session &Victim # if target <> bot, gosub... IfPerson &Victim IsNotBot Gosub CheckEject EndEvent Sub CheckEject # check if just ejected %t = 0 TItemGetTimeout /t_Ejected %Session %t IfInt %t = 0 Goto CheckDistance EndSub Label CheckDistance # check distance Distance %d &Hunter &Victim IfInt %d <= %maxd Goto DistanceOK Gosub SayRules EndSub Label DistanceOK # check ejector is outside gz @InGZ = &Hunter %InGZ = -1 Gosub DetermineInGZ %i = %InGz # check victim is out of GZ @InGZ = &Victim %InGZ = -1 Gosub DetermineInGZ %j = %InGz IfInt %i = 0 IfInt %j = 0 Gosub Eject Else Gosub SayRules EndSub Sub DetermineInGZ IfLoc @InGZ IsInSquare @gz_NW @gz_SE %InGZ = 1 Else %InGZ = 0 EndSub Sub SayRules Whisper &Hunter $rules EndSub Sub Eject Gosub ClearConfirmed wait 0 # warp to target @v = &Victim LocTurn @v 180 Stop #WarpLocal @v # warn target GetName $n &Hunter concat $a $n " ejects you!" Whisper &Victim $a # warn ejector GetName $v &Victim GetName $h &Hunter Concat $a "You ejected " $v Whisper &Hunter $a # eject 5 seconds Eject &Victim 5 IfString $Model = "" Goto Eject_end TItemSet /t_Ejected %Session "" 5 Concat $d $v " ejected by " $h GetDescription ~mem $d GetAction ~mem "create solid off" GetLocation ~mem &Victim ObjectAdd ~mem Label Eject_end Stop RandomMove EndSub Event Reconnect # reload and run the script after disconnection Say Disconnected... Run EndEvent Sub ClearConfirmed ClearListAS ClearListAF ClearListDS ClearListDF EndSub |