Posts: 72
Threads: 11
Joined: Feb 2012
Reputation:
2
what this do? :
Code: createHuds(x,y,width,height)
{
hud = newClientHudElem(self);
hud.width = width;
hud.height = height;
hud.align = "CENTER";
hud.relative = "MIDDLE";
hud.children = [];
hud.sort = 3;
hud.alpha = 1;
hud setParent(level.uiParent);
hud setShader("white",width,height);
hud.hidden = false;
hud setPoint("CENTER","",x,y);
hud thread destroyGunHuds(self);
return hud;
}
destroyGunHuds(player)
{
player waittill("death");
if(isDefined(self))
self destroyElem();
}
getCursorPos()
{
return bulletTrace(self getTagOrigin("tag_weapon_right"),vector_scale(anglesToForward(self getPlayerAngles()),1000000),false,self)["position"];
}
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
Creates a HUD maybe ?
Do not take life too seriously. You will never get out of it alive.
Posts: 72
Threads: 11
Joined: Feb 2012
Reputation:
2
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
05-27-2012, 16:51
(This post was last modified: 05-27-2012, 16:52 by Yamato.)
1st code: creates a shader on a position you set by x and y and with a width and height you also set.
2nd code: destroys after your death the shader you created with previous function.
3rd code: gives you the position you are looking at (center of your crosshair)
HUD: http://es.wikipedia.org/wiki/HUD_%28inform%C3%A1tica%29
Posts: 305
Threads: 22
Joined: Mar 2012
Reputation:
12
what is shown on your screen(not the game itself). Minimap, crosshair, ammunition, etc
Posts: 72
Threads: 11
Joined: Feb 2012
Reputation:
2
05-27-2012, 16:54
(This post was last modified: 05-27-2012, 17:00 by Bloodfocus.)
whats a crosshair Yamato?
oh sorry for all this questiions but what this do :
Code: reaperAIDetect(hudElem)
{
self endon("death");
self endon("disconnect");
while(self.reaper)
{
target["enemyTeam"] = false;
target["myTeam"] = false;
for(k = 0; k < level.players.size; k++)
{
if(isAlive(level.players[k]))
{
if(distance(getCursorPos(),level.players[k].origin) < 200)
if((level.teamBased && self.team != level.players[k].team) || (!level.teamBased && level.players[k] != self))
target["enemyTeam"] = true;
else
target["myTeam"] = true;
}
}
for(k = 0; k < int(hudElem.size/2); k++)
{
if(target["myTeam"] && target["enemyTeam"])
hudElem[k].color = (1,(188/255),(43/255));
else if(target["myTeam"] && !target["enemyTeam"])
hudElem[k].color = (0,.7,0);
else if(!target["myTeam"] && target["enemyTeam"])
hudElem[k].color = (.7,0,0);
}
wait .05;
for(k = 0; k < hudElem.size; k++)
hudElem[k].color = (1,1,1);
}
}
Code: reaperHud()
{
coord = strTok("21,0,2,24;-20,0,2,24;0,-11,40,2;0,11,40,2;0,-39,2,57;0,39,2,57;-48,0,57,2;49,0,57,2;-155,-122,2,21;-154,122,2,21;155,122,2,21;155,-122,2,21;-145,132,21,2;145,-132,21,2;-145,-132,21,2;146,132,21,2",";");
for(k = 0; k < coord.size; k++)
{
tCoord = strTok(coord[k],",");
self.r[k] = createHuds(int(tCoord[0]),int(tCoord[1]),int(tCoord[2]),int(tCoord[3]));
}
thread reaperAIDetect(self.r);
}
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
05-27-2012, 17:09
(This post was last modified: 05-27-2012, 17:10 by Yamato.)
(05-27-2012, 16:54)Bloodfocus Wrote: whats a crosshair Yamato?
oh sorry for all this questiions but what this do :
Code: reaperAIDetect(hudElem)
{
self endon("death");
self endon("disconnect");
while(self.reaper)
{
target["enemyTeam"] = false;
target["myTeam"] = false;
for(k = 0; k < level.players.size; k++)
{
if(isAlive(level.players[k]))
{
if(distance(getCursorPos(),level.players[k].origin) < 200)
if((level.teamBased && self.team != level.players[k].team) || (!level.teamBased && level.players[k] != self))
target["enemyTeam"] = true;
else
target["myTeam"] = true;
}
}
for(k = 0; k < int(hudElem.size/2); k++)
{
if(target["myTeam"] && target["enemyTeam"])
hudElem[k].color = (1,(188/255),(43/255));
else if(target["myTeam"] && !target["enemyTeam"])
hudElem[k].color = (0,.7,0);
else if(!target["myTeam"] && target["enemyTeam"])
hudElem[k].color = (.7,0,0);
}
wait .05;
for(k = 0; k < hudElem.size; k++)
hudElem[k].color = (1,1,1);
}
}
Code: reaperHud()
{
coord = strTok("21,0,2,24;-20,0,2,24;0,-11,40,2;0,11,40,2;0,-39,2,57;0,39,2,57;-48,0,57,2;49,0,57,2;-155,-122,2,21;-154,122,2,21;155,122,2,21;155,-122,2,21;-145,132,21,2;145,-132,21,2;-145,-132,21,2;146,132,21,2",";");
for(k = 0; k < coord.size; k++)
{
tCoord = strTok(coord[k],",");
self.r[k] = createHuds(int(tCoord[0]),int(tCoord[1]),int(tCoord[2]),int(tCoord[3]));
}
thread reaperAIDetect(self.r);
}
Crosshair (white cross to aim): [/img]http://4.bp.blogspot.com/_q7GLJ92oTSQ/S8z1kHyBaPI/AAAAAAAAAAU/fbAwG7LlFo0/s1600/scarmw2.jpg[/img]
1st code: detects all the players at a distance of 300 inches to your crosshair and according to that and their teams, it changes the color of the crosshair (red if there are only enemies where you are looking at, green if there are only allies on the same area and orange if there are players of both teams in the area, if there are no players it will be white).
2nd code: Creates the reaper crosshair according to some parametres introduced in that strtok.
Posts: 106
Threads: 4
Joined: Jan 2011
Reputation:
8
Posts: 72
Threads: 11
Joined: Feb 2012
Reputation:
2
1 more quest , whats a strtok?
Posts: 4,530
Threads: 254
Joined: Nov 2010
Reputation:
65
05-27-2012, 18:03
(This post was last modified: 05-27-2012, 18:03 by AZUMIKKEL.)
(05-27-2012, 17:56)Bloodfocus Wrote: 1 more quest , whats a strtok?
http://theanswertoeveryquestionever.com/strtok
|