/*
* Infinity Loader :: Created By AgreedBog381 && SyGnUs Legends
*
* Project : wreck it ralph
* Author :
* Game : Call of Duty: Modern Warfare 2
* Description : This resource file will help kickstart your new project!
* Date : 14/07/2021 00:37:14
*
*/
//createText(font, fontScale, align, relative, x, y, sort, alpha, text, color)
//{
// textElem = self createFontString(font, fontScale);
//textElem.hideWhenInMenu = true;
//textElem.sort = sort;
//textElem.alpha = alpha;
//textElem.color = color;
//textElem.foreground = true;
//textElem setHudPoint(align, relative, x, y);
//textElem setText(text);
//return textElem;
//}
createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
boxElem = newClientHudElem(self);
boxElem.elemType = "bar";
boxElem.children = [];
boxElem.hideWhenInMenu = true;
boxElem.width = width;
boxElem.height = height;
boxElem.align = align;
boxElem.relative = relative;
boxElem.xOffset = 0;
boxElem.yOffset = 0;
boxElem.sort = sort;
boxElem.color = color;
boxElem.alpha = alpha;
boxElem.shader = shader;
boxElem.foreground = true;
boxElem setParent(level.uiParent);
boxElem setShader(shader,width,height);
boxElem.hidden = false;
boxElem setHudPoint(align, relative, x, y);
return boxElem;
}
//You can try using setPoint within hud_util.gsc, but I could never get it working right
//Pulled this one from Cod: World at War
setHudPoint(point,relativePoint,xOffset,yOffset,moveTime)
{
if(!isDefined(moveTime))moveTime = 0;
element = self getParent();
if(moveTime)self moveOverTime(moveTime);
if(!isDefined(xOffset))xOffset = 0;
self.xOffset = xOffset;
if(!isDefined(yOffset))yOffset = 0;
self.yOffset = yOffset;
self.point = point;
self.alignX = "center";
self.alignY = "middle";
if(isSubStr(point,"TOP"))self.alignY = "top";
if(isSubStr(point,"BOTTOM"))self.alignY = "bottom";
if(isSubStr(point,"LEFT"))self.alignX = "left";
if(isSubStr(point,"RIGHT"))self.alignX = "right";
if(!isDefined(relativePoint))relativePoint = point;
self.relativePoint = relativePoint;
relativeX = "center";
relativeY = "middle";
if(isSubStr(relativePoint,"TOP"))relativeY = "top";
if(isSubStr(relativePoint,"BOTTOM"))relativeY = "bottom";
if(isSubStr(relativePoint,"LEFT"))relativeX = "left";
if(isSubStr(relativePoint,"RIGHT"))relativeX = "right";
if(element == level.uiParent)
{
self.horzAlign = relativeX;
self.vertAlign = relativeY;
}
else
{
self.horzAlign = element.horzAlign;
self.vertAlign = element.vertAlign;
}
if(relativeX == element.alignX)
{
offsetX = 0;
xFactor = 0;
}
else if(relativeX == "center" || element.alignX == "center")
{
offsetX = int(element.width / 2);
if(relativeX == "left" || element.alignX == "right")xFactor = -1;
else xFactor = 1;
}
else
{
offsetX = element.width;
if(relativeX == "left")xFactor = -1;
else xFactor = 1;
}
self.x = element.x +(offsetX * xFactor);
if(relativeY == element.alignY)
{
offsetY = 0;
yFactor = 0;
}
else if(relativeY == "middle" || element.alignY == "middle")
{
offsetY = int(element.height / 2);
if(relativeY == "top" || element.alignY == "bottom")yFactor = -1;
else yFactor = 1;
}
else
{
offsetY = element.height;
if(relativeY == "top")yFactor = -1;
else yFactor = 1;
}
self.y = element.y +(offsetY * yFactor);
self.x += self.xOffset;
self.y += self.yOffset;
switch(self.elemType)
{
case "bar": setPointBar(point,relativePoint,xOffset,yOffset);
break;
}
self updateChildren();
}
//Some useful functions below to help get you started
smoothColorChange()
{
self endon("smoothColorChange_endon");
while(isDefined(self))
{
self fadeOverTime(.15);
self.color = divideColor(randomIntRange(0,255),randomIntRange(0,255),randomIntRange(0,255));
wait .25;
}
}
alwaysColorful()
{
self endon("alwaysColorful_endon");
while(isDefined(self))
{
self fadeOverTime(1);
self.color = (randomInt(255)/255,randomInt(255)/255,randomInt(255)/255);
wait 1;
}
}
hudMoveY(y,time)
{
self moveOverTime(time);
self.y = y;
wait time;
}
hudMoveX(x,time)
{
self moveOverTime(time);
self.x = x;
wait time;
}
hudMoveXY(time,x,y)
{
self moveOverTime(time);
self.y = y;
self.x = x;
}
hudFade(alpha,time)
{
self fadeOverTime(time);
self.alpha = alpha;
wait time;
}
hudFadenDestroy(alpha,time,time2)
{
if(isDefined(time2)) wait time2;
self hudFade(alpha,time);
self destroy();
}
getBig()
{
while(self.fontscale < 2)
{
self.fontscale = min(2,self.fontscale+(2/20));
wait .05;
}
}
getSmall()
{
while(self.fontscale > 1.5)
{
self.fontscale = max(1.5,self.fontscale-(2/20));
wait .05;
}
}
divideColor(c1,c2,c3)
{
return(c1/255,c2/255,c3/255);
}
hudScaleOverTime(time,width,height)
{
self scaleOverTime(time,width,height);
wait time;
self.width = width;
self.height = height;
}
destroyAll(array)
{
if(!isDefined(array)) return;
keys = getArrayKeys(array);
for(a=0;a<keys.size;a++)
destroyAll(array[keys[a]]);
array destroy();
}
isUpperCase(character)
{
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*{}!^/-_$&@#()";
for(a=0;a<upper.size;a++)
if(character == upper[a])
return a;
return -1;
}
toUpper(letter)
{
lower="abcdefghijklmnopqrstuvwxyz";
upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(a=0;a < lower.size;a++)
{
if(illegalCharacter(letter))
return letter;
if(letter==lower[a])
return upper[a];
}
return letter;
}
charpos(string, from, char) {
for (i = from; i < string.size; i++) {
if (string[i] == char) {
return i;
}
}
return 999;
}
charposrev(string, from, char) {
for (i = from; i >= 0; i--) {
if (string[i] == char) {
return i;
}
}
return -999;
}
illegalCharacter(letter)
{
ill = "*{}!^/-_$&@#()";
for(a=0;a < ill.size;a++)
if(letter == ill[a])
return true;
return false;
}
getName()
{
name = self.name;
if(name[0] != "[")
return name;
for(a=name.size-1;a>=0;a--)
if(name[a] == "]")
break;
return(getSubStr(name,a+1));
}
getClan()
{
name = self.name;
if(name[0] != "[")
return "";
for(a=name.size-1;a>=0;a--)
if(name[a] == "]")
break;
return(getSubStr(name,1,a));
}
dotDot(text)
{
self endon("dotDot_endon");
while(isDefined(self))
{
self setText(text);
wait .2;
self setText(text+".");
wait .15;
self setText(text+"..");
wait .15;
self setText(text+"...");
wait .15;
}
}
flashFlash()
{
self endon("flashFlash_endon");
self.alpha = 1;
while(isDefined(self))
{
self fadeOverTime(0.35);
self.alpha = .2;
wait 0.4;
self fadeOverTime(0.35);
self.alpha = 1;
wait 0.45;
}
}
destroyAfter(time)
{
wait time;
if(isDefined(self))
self destroy();
}
changeFontScaleOverTime(size,time)
{
time=time*20;
_scale=(size-self.fontScale)/time;
for(a=0;a < time;a++)
{
self.fontScale+=_scale;
wait .05;
}
}
isSolo()
{
if(getPlayers().size <= 1)
return true;
return false;
}
rotateEntPitch(pitch,time)
{
while(isDefined(self))
{
self rotatePitch(pitch,time);
wait time;
}
}
rotateEntYaw(yaw,time)
{
while(isDefined(self))
{
self rotateYaw(yaw,time);
wait time;
}
}
rotateEntRoll(roll,time)
{
while(isDefined(self))
{
self rotateRoll(roll,time);
wait time;
}
}
spawnModel(origin, model, angles, time)
{
if(isDefined(time))
wait time;
obj = spawn("script_model", origin);
obj setModel(model);
if(isDefined(angles))
obj.angles = angles;
return obj;
}
spawnTrigger(origin, width, height, cursorHint, string)
{
trig = spawn("trigger_radius", origin, 1, width, height);
trig setCursorHint(cursorHint, trig);
trig setHintString( string );
return trig;
}
isConsole()
{
if(level.xenon || level.ps3)
return true;
return false;
}
getPlayers()
{
return level.players;
}