Code:
@name 39Bot
@inputs
@outputs Fire Light:vector Yes AimTarmod:vector AimTar:entity
@persist Force_final:angle Vector1:vector Varc1 Varc2 Varc3
@persist Follow Aim PlayerTar:entity Playername:string
@persist ObjectTar:entity Objectname:string AimTar:entity
@persist AimTarmod:vector
runOnTick(1)
##### SETTINGS #####
Box = entity():isWeldedTo()
Owner = Box:owner()
Box:setMass(50)
##### CALCULATIONS #####
if ( Aim == 0 ) {
P = Box:angles():pitch()
Y = Box:angles():yaw()
R = Box:angles():roll()
}
if ( Aim == 1 ) {
P = Box:angles():pitch()
Y = Box:bearing(Owner:aimPos())
R = Box:angles():roll()
}
if ( Aim == 2 ) {
P = Box:elevation(Owner:aimPos())
Y = Box:bearing(Owner:aimPos())
R = Box:angles():roll()
}
if ( Aim == 3 ) {
P = Box:elevation(PlayerTar:pos()+vec(0,0,60))
Y = Box:bearing(PlayerTar:pos())
R = Box:angles():roll()
PlayerTarH = PlayerTar:health()
if ( PlayerTarH > 0 ) {
Fire = 1
}
elseif ( PlayerTarH <= 0 ) {
Fire = 0
print("Target is down.")
interval(3000)
Aim = 1
}
}
if ( Aim == 4 ) {
if ( AimTar:model():sub(0,11) == "models/head" ) { AimTarmod = vec(0,0,-60) Yes = 1}
if ( AimTar:model():sub(0,11) == "models/antl" ) { AimTarmod = vec(0,0,-55) }
if ( AimTar:model():sub(0,50):trim() == "models/zombie/classic_torso.mdl" ) { AimTarmod = vec(0,0,-55) }
if ( AimTar:model():sub(0,50):trim() == "models/zombie/fast_torso.mdl" ) { AimTarmod = vec(0,0,-55) }
if ( AimTar:model():sub(0,50):trim() == "models/combine_scanner.mdl" ) { AimTarmod = vec(0,0,-60) }
if ( AimTar:model():sub(0,50):trim() == "models/manhack.mdl" ) { AimTarmod = vec(0,0,-60) }
if ( AimTar:model():sub(0,50):trim() == "models/crow.mdl" | "models/pigeon.mdl" | "models/seagull.mdl" ) { AimTarmod = vec(0,0,-60) }
P = Box:elevation(AimTar:pos()+vec(0,0,60)+AimTarmod)
Y = Box:bearing(AimTar:pos())
R = Box:angles():roll()
AimTarH = AimTar:health()
if ( AimTarH > 0 ) {
Fire = 1
}
elseif ( AimTarH <= 0 ) {
Fire = 0
print("Target is down.")
interval(3000)
Aim = 1
}
}
##### PYR MOVEMENT #####
Force_final = -ang(P,Y,R) * 100
Box:applyAngForce(Force_final + $Force_final*5)
##### XYZ MOVEMENT #####
if ( Follow ) {
Vector1 = (Owner:pos() - Box:pos() + vec(0,0,100)) * 500
Box:applyForce(Vector1 + $Vector1*5)
}
##### SPEECH #####
runOnChat(1)
if (Owner:lastSaid():lower() == "hello, 39bot." & chatClk(Owner)) {
print("Hello, master.")
}
if (Owner:lastSaid():lower():sub(0,6) == "[color" & chatClk(Owner)) {
Varc1 = Owner:lastSaid():lower():sub(8,10):toNumber()
Varc2 = Owner:lastSaid():lower():sub(12,14):toNumber()
Varc3 = Owner:lastSaid():lower():sub(16,18):toNumber()
Box:setColor(Varc1,Varc2,Varc3)
hint("Color changed.",7)
}
if (Owner:lastSaid():lower():sub(0,11) == "[killplayer" & chatClk(Owner)) {
Playername = Owner:lastSaid():lower():sub(13,50):trim()
PlayerTar = findPlayerByName(Playername)
Aim = 3
print("Attempting to terminate target.")
}
if (Owner:lastSaid():lower():sub(0,11) == "[killtarget" & chatClk(Owner)) {
AimTar = Owner:aimEntity()
AimTarmod = vec(0,0,0)
Aim = 4
print("Attempting to terminate target.")
}
if (Owner:lastSaid():lower() == "[killclosest" & chatClk(Owner)) {
findClosest(Owner:pos))
AimTar = find()
AimTarmod = vec(0,0,0)
Aim = 4
print("Attempting to terminate target.")
}
if (Owner:lastSaid():lower() == "[passive" & chatClk(Owner)) {
Follow = 1
Aim = 1
hint("Passive mode.",7)
}
if (Owner:lastSaid():lower() == "[follow" & chatClk(Owner)) {
Follow = 1
hint("Following.",7)
}
if (Owner:lastSaid():lower() == "[stop" & chatClk(Owner)) {
Follow = 0
Fire = 0
hint("Stopping.",7)
}
if (Owner:lastSaid():lower() == "[off" & chatClk(Owner)) {
Follow = 0
Aim = 0
Fire = 0
Light = vec(0,0,0)
hint("Turning off.",7)
}
if (Owner:lastSaid():lower() == "[look" & chatClk(Owner)) {
Aim = 1
hint("Look mode.",7)
}
if (Owner:lastSaid():lower() == "[aim" & chatClk(Owner)) {
Aim = 2
hint("Aim mode.",7)
}
if (Owner:lastSaid():lower() == "[lighton" & chatClk(Owner)) {
Light = vec(255,255,255)
hint("Light on.",7)
}
if(Owner:lastSaid():lower() == "[lightoff" & chatClk(Owner)) {
Light = vec(0,0,0)
hint("Light off.",7)
}
if(Owner:lastSaid():lower() == "[lightdim" & chatClk(Owner)) {
Light = vec(100,100,100)
hint("Light dimmed.",7)
}
if(Owner:lastSaid():lower() == "[info" & chatClk(Owner)) {
AimTar = Owner:aimEntity()
if ( AimTar:isPlayer() ) {
print("Target is a player.")
print("Name:"+AimTar:name())
print("Health:"+AimTar:health())
print("Armor:"+AimTar:armor())
print("Frags:"+AimTar:frags())
}
if ( AimTar:isNPC() ) {
print("Target is an NPC.")
print("Type:"+AimTar:model())
print("Health:"+AimTar:health())
}
if ( AimTar:isVehicle() ) {
print("Target is a vehicle.")
print("Type:"+AimTar:model())
}
if ( AimTar:isWorld() ) {
print("Target is the world geometry.")
}
if ( !AimTar:isPlayer() & !AimTar:isNPC() & !AimTar:isVehicle() & !AimTar:isWorld() ) {
print("Target is a prop or other object.")
print("Type:"+AimTar:model())
print("Mass:"+AimTar:mass())
print("Size:"+AimTar:radius())
}
}
Bookmarks