![]() |
|
T-16's E2 Help & Request Thread - 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: T-16's E2 Help & Request Thread (/thread-580.html) |
RE: T-16's E2 Help & Request Thread - mariofludd - 24-12-2015 T-16? I don't see a T-16 anywhere... I only see a T-17. :33 RE: T-16's E2 Help & Request Thread - TheOneAndOnlyTee - 24-12-2015 ;p, on another note for future requests I'm only going to do them if they're really easy to do. RE: T-16's E2 Help & Request Thread - warhammer - 18-01-2016 I dont know if this would be "realy" easy but could you make a radar screen that only shows ships so that a alarm or light flashes when another ship_core or other ship comes near to your ship? RE: T-16's E2 Help & Request Thread - TheOneAndOnlyTee - 18-01-2016 If i get time i'll see what i can do, just a simple radar though. RE: T-16's E2 Help & Request Thread - warhammer - 20-01-2016 hows it coming? RE: T-16's E2 Help & Request Thread - TheOneAndOnlyTee - 20-01-2016 Done, i threw the alarm on it out of gmod so idk if it'll sound right but it should. When using this have a screen on an angle and the objects are relative to the screens direction like Pho's, as this was a quick one i just used the same radar code he did and to save some ops the button are slightly laggy so hold E for a second for it to work Code: @name Ship Radar by T-17
@inputs EGP:wirelink EnableAlarm
@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")){
if(EnableAlarm==1){
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{
if(Dis<Range){timer("beep",10)}
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)
}Also i'm closing this thread because ew E2, if you need help with anything find me ingame (8pm - 7am / 4am - 11am +10:30GMT). |