Team Spartan Cookies & Milk Forums
Ship Detector - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html)
+--- Thread: Ship Detector (/thread-1538.html)



Ship Detector - warhammer - 18-01-2016

If anyone has the time could someone make a screen or even use a radar screen that already exists to detect ships instead of players and a option so something like if rangefromship<2500 turn sound emitter on e.g. a alarm for proximity or even a light that would be great thanks


RE: Ship Detector - TheOneAndOnlyTee - 18-01-2016

So you don't want the one i started making Tongue


RE: Ship Detector - warhammer - 19-01-2016

I just want any one


RE: Ship Detector - TheOneAndOnlyTee - 19-01-2016

Well i've done it minus the alarm for now. just wondering why the alarm?, i don't really see how it can be used since you're not going to find ships close often unless they acidentally warp into you.


RE: Ship Detector - warhammer - 19-01-2016

i'm going to play around with the radius so if another shuttle comes too close it sets off a alarm


RE: Ship Detector - warhammer - 24-01-2016

Does anyone know how I can get this
Code:
@name Ship Radar by T-17 @inputs EGP:wirelink @model @persist Ships:array Players:array E:entity Lines:vector Outline:vector Text:vector Mode interval(1000) if(first()|duped()|changed(EGP)){ ##Config Text = vec(255,255,255) #text color Outline = vec(0,164,255) #the main color Lines = vec(51,51,51) #background grid lines color Range = 2000 #radius to trigger alarm for shuttles ##END NO CHANGES BELOW, If you change stuff below then you lose the right to ask for help Mode = 1 E = EGP:entity() timer("ships",500) timer("preDraw",100) timer("buttoncheck",100) function number wirelink:button(Cursor:vector2,ID:number) { local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } # findExcludePlayerProps(owner()) # findExcludeEntity(owner()) } if(clk("beep")){ E:soundPlay(1,100,"st/misc/tng_redalert.wav") } if(clk("ships")){ Ships = array() Players = array() findByClass("st_shuttle_*") Ships = findToArray() findByClass("player") Players = findToArray() timer("ships",4000) } ####DRAWING SHIPS/PLAYERS, this code is thanks to TSCM.Firestorm and TSCM.Alex5511. many use much thanks :P if(Mode==1){ for(I=1,Ships:count()){ Ship = Ships[I,entity] Dis = Ship:pos():distance(E:pos()) if(Dis<500 || Dis>5000 || Ship:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ship:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-2000*150,260+Y/-2000*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ship:owner():team())) EGP:egpText(200+I,Ship:owner():name():left(10)+"'s ship" +" (" + round(Dis) + ")",vec2(275+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ship:owner():team())) } } }else{ for(I=1,Players:count()){ Ply = Players[I,entity] Dis = Ply:pos():distance(E:pos()) if(Dis<200 || Dis>5000 || Ply:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ply:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-500*150,280+Y/-500*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ply:team())) EGP:egpText(200+I,Ply:name():left(10)+" (" + round(Dis) + ")",vec2(265+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ply:team())) } } } if(clk("preDraw")){ EGP:egpClear() EGP:egpBox(1,vec2(256,256),vec2(512,512)) EGP:egpColor(1,vec(31,31,31)) for(I=1,25){ local V = 512/25 EGP:egpLine(1+I,vec2(0,V*I),vec2(512,V*I)) EGP:egpColor(1+I,Lines) EGP:egpLine(27+I,vec2(V*I,0),vec2(V*I,512)) EGP:egpColor(27+I,Lines) } EGP:egpCircleOutline(52,vec2(256,256),vec2(2,2)) EGP:egpColor(52,Outline) EGP:egpText(53,"Ship Radar",vec2(20,20)) EGP:egpColor(53,Text) EGP:egpBox(54,vec2(60,492),vec2(120,40)) EGP:egpColor(54,Outline) EGP:egpBox(55,vec2(60,492),vec2(118,38)) EGP:egpColor(55,vec(31,31,31)) EGP:egpText(56,"Show Players",vec2(10,482)) EGP:egpColor(56,Text) } ##################### BUTTON CODE BY TSCM.BLACKHAWK, much easy many thanks :P if(clk("buttoncheck")){ User = EGP["User",entity] Use = User:keyUse() if(changed(Use) & Use){ Cursor = EGP:egpCursor(User) if(EGP:button(Cursor,55)){ if(Mode == 1){ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Ships") Mode = 0 }else{ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Players") Mode = 1 } } } timer("buttoncheck",200) }
to show more ships, at the moment it only shows shuttle11,6,9 but does anyone know how to add another such as the "puddle_jumper"?


RE: Ship Detector - warhammer - 28-01-2016

Code:
@name Ship Radar by T-17 @inputs EGP:wirelink @model @persist Ships:table Players:array E:entity Lines:vector Outline:vector Text:vector Mode interval(1000) if(first()|duped()|changed(EGP)){ ##Config Text = vec(255,255,255) #text color Outline = vec(0,164,255) #the main color Lines = vec(51,51,51) #background grid lines color Range = 2000 #radius to trigger alarm for shuttles ##END NO CHANGES BELOW, If you change stuff below then you lose the right to ask for help Mode = 1 E = EGP:entity() timer("ships",500) timer("preDraw",100) timer("buttoncheck",100) function number wirelink:button(Cursor:vector2,ID:number) { local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } # findExcludePlayerProps(owner()) # findExcludeEntity(owner()) } if(clk("beep")){ E:soundPlay(1,100,"st/misc/tng_redalert.wav") } if(clk("ships")){ Players = array() Ships["glider",string] = "sg_vehicle_glider" Ships["f302",string] = "sg_vehicle_f302" Ships["dest",string] = "sg_vehicle_shuttle" Ships["gateg",string] = "sg_vehicle_gate_glider" Ships["teltac",string] = "sg_vehicle_teltac" Ships["jumper",string] = "puddle_jumper" Ships["core",string] = "ship_core" Ships["node",string] = "resource_node_env" Ships["gyro",string] = "gyropod_advanced" Ships["shield",string] = "atlantis_shield" Ships["zpm",string] = "zpm_mk3" Ships["ag3",string] = "ag_3" Ships["drive",string] = "ship_drive" Ships["sbepdrive",string] = "warpdrive" Ships["turret",string] = "gmod_wire_turret" Ships["ring",string] = "ring_base_ancient" Ships["sat",string] = "stargate_asuran" Ships["rotaty",string] = "sf-rotatybase" Ships["prop",string] = "prop_physics" Ships["npc",string] = "npc_*" Ships["ragdoll",string] = "prop_ragdoll" Ships["grenade",string] = "grenade_ar2" Ships["stargate",string] = "stargate_*" Ships["jamming",string] = "jamming_device" Ships["st_shuttle_type11",string] = "st_shuttle_type11" Ships["shuttle11",string] = "st_shuttle_type11" Ships["shuttle",string] = "st_shuttle_type11" Ships["shuttle9",string] = "st_shuttle_type9" Ships["shuttle6",string] = "st_shuttle_type6" findByClass("player") Players = findToArray() timer("ships",4000) } ####DRAWING SHIPS/PLAYERS, this code is thanks to TSCM.Firestorm and TSCM.Alex5511. many use much thanks :P if(Mode==1){ for(I=1,Ships:count()){ Ship = Ships[I,entity] Dis = Ship:pos():distance(E:pos()) if(Dis<1 || Dis>5000 || Ship:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ship:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-2000*150,260+Y/-2000*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ship:owner():team())) EGP:egpText(200+I,Ship:owner():name():left(10)+"'s ship" +" (" + round(Dis) + ")",vec2(275+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ship:owner():team())) } } }else{ for(I=1,Players:count()){ Ply = Players[I,entity] Dis = Ply:pos():distance(E:pos()) if(Dis<200 || Dis>5000 || Ply:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ply:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-500*150,280+Y/-500*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ply:team())) EGP:egpText(200+I,Ply:name():left(10)+" (" + round(Dis) + ")",vec2(265+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ply:team())) } } } if(clk("preDraw")){ EGP:egpClear() EGP:egpBox(1,vec2(256,256),vec2(512,512)) EGP:egpColor(1,vec(31,31,31)) for(I=1,25){ local V = 512/25 EGP:egpLine(1+I,vec2(0,V*I),vec2(512,V*I)) EGP:egpColor(1+I,Lines) EGP:egpLine(27+I,vec2(V*I,0),vec2(V*I,512)) EGP:egpColor(27+I,Lines) } EGP:egpCircleOutline(52,vec2(256,256),vec2(2,2)) EGP:egpColor(52,Outline) EGP:egpText(53,"Ship Radar",vec2(20,20)) EGP:egpColor(53,Text) EGP:egpBox(54,vec2(60,492),vec2(120,40)) EGP:egpColor(54,Outline) EGP:egpBox(55,vec2(60,492),vec2(118,38)) EGP:egpColor(55,vec(31,31,31)) EGP:egpText(56,"Show Players",vec2(10,482)) EGP:egpColor(56,Text) } ##################### BUTTON CODE BY TSCM.BLACKHAWK, much easy many thanks :P if(clk("buttoncheck")){ User = EGP["User",entity] Use = User:keyUse() if(changed(Use) & Use){ Cursor = EGP:egpCursor(User) if(EGP:button(Cursor,55)){ if(Mode == 1){ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Ships") Mode = 0 }else{ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Players") Mode = 1 } } } timer("buttoncheck",200) }

I can figure out why now none of the ships show i have tried
changing the table eg Ships["st_shuttle_type11",entity] but it still does not show if anyone can figure it out please comment below


RE: Ship Detector - TheOneAndOnlyTee - 29-01-2016

Because you didn't read through Pho's targetting chip enough, those are classes used in the chat commands for targetting. ('/t core T-17')
You're not going to be able to do what you want by copying stuff from other chips.