ItsMods
[Tutorial] Random Things 2 - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: [Tutorial] Random Things 2 (/Thread-Tutorial-Random-Things-2.html)



Random Things 2 - Yamato - 09-18-2011

Hello, OMA

This is a random tutorial about some random functions.

First of all, some precaching commands, they need to go in Init() and will allow you to use different parametres in your mods:

Code:
PrecacheTurret("turretname"); PrecacheModel("modelname"); PrecacheShader("shadername"); PrecacheMiniMapIcon("minimapiconname"); PrecacheVehicle("vehiclename"); //forget about this one, all vehicles in MP are already precached PrecacheMenu("menuname"); PrecacheItem("itemname"); //forget about this one too PrecacheShellShock("shellshockname"); PrecacheRumble("rumblename");

There are a few more, but those are enough. Now Ill explain the command PlayFXonTag, it will play a certain FX in a model tag.

Code:
FX = PlayFXonTag(effect name, model, tag to play effect on);

Example: this will play a FX called level.omafx on your head.

Code:
FX = PlayFXonTag(level.omafx,self,"j_head");

If you want to stop the FX from previous example use this:

Code:
FX = StopFXonTag(level.omafx,self,"j_head");

You can also play a FX on tag on a certain player

Code:
FX = PlayFXonTagForClients(level.omafx,self,"j_head",level.players[1]);

Now, how to set a perk or unset it

Code:
self _setperk("perkname"); self _unsetperk("perkname");

This is a command to change player speed:

Code:
self SetMoveSpeedScale(speed);

Now Ill explain the use of the command GetPersStat, this command what it does is to take a player stadistics such as the number of assists, kills or headshots. You use it like this:

self GetPersStat("stat");

Example of headshots, this could be a aimbotter kicker example:

Code:
if(self GetPersStat("headshots") > 10) { kick(self GetEntityNumber(),"PLATFORM_STEAM_KICK_CHEAT"); }

The kick command I used in previous example works like this:

Code:
kick(player,message);

The GetEntityNumber() command what it does is to take a certain player id, like when you take them with console. Ill explain now a physics command, this one is perfect to make gravity objects.

Code:
model PhysicsLaunchServer(vector,origin);

Example:

Code:
OMA PhysicsLaunchServer((0,0,0),self.origin); //this one will make the object fall, it will interact with world

Now a command that is really useless, is only good to annoy players, it makes a certain player get EMPed, with false you make the EMP effects stop

Code:
self SetEMPJammed(true);

Now Ill explain how to play Loop sounds and how to stop them, this is a sound that will repeat all the time until you stop it:

Code:
thing PlayLoopSound(sound); thing StopLoopSound(sound); //to stop it

This is a random thing I found once while editing weapons, this are weapons that IW was going to add in MW2

Code:
[spoiler]WEAPON_MP44 WEAPON_RAPPEL_KNIFE WEAPON_MP5_SILENCER WEAPON_MAC10 WEAPON_G36C WEAPON_M14 WEAPON_WINCHESTER1200 WEAPON_SAW WEAPON_AW50 WEAPON_AG36 WEAPON_HK79 WEAPON_EGLM WEAPON_M21_SOCOM WEAPON_BINOCULARS WEAPON_G3_SILENCER WEAPON_AK74U_ACOG WEAPON_UMP45_BURST WEAPON_ANACONDA_SILENCER WEAPON_ICE_AXE WEAPON_AA12SP_HB_SILENCER WEAPON_SCAR_ROF WEAPON_G36_LMG WEAPON_AUG_SCOPE WEAPON_M14EBR WEAPON_P90_HEARTBEAT WEAPON_M79_BOOM WEAPON_RPG_BLING[/spoiler]

This is a command that allows you to fade in a shellshock, it makes the shellshock like weaker.

Code:
self FadeOutShellShock();

While looking through game code I found this different csv info commands, they already brought a info that IW left there. In BO you can use them more, in MW2 you dont need any kind of command like this.

Code:
tableLookup( filename, searchColumnNum, searchValue, returnValueColumnNum ) tableLookupByRow( filename, rowNum, returnValueColumnNum ) tableLookupRowNum( filename, searchColumnNum, searchValue )

There is also a better way to give many dvars, they will reduce your code lenght:

Code:
self SetClientDvars("dvar1",dvar1 value,"dvar2",dvar2 value,"dvar3",dvar3 value, etc);

I cant remember very well, but I think that setDvars works like this too

Now some HUD Info, this are the different game fonts you can use:

Code:
default objective bigfixed smallfixed

Now the positions in screen of HUD

In X:

Code:
Left Center Right

In Y:

Code:
Top Middle Bottom

In alignx you can find all this:

Code:
subleft left center right fullscreen noscale alignto640 center_safearea

In aligny you can find all this:

Code:
subtop top middle bottom fullscreen noscale alignto480 center_safearea

Thats all, OMA



RE: Random Things 2 - Nekochan - 09-18-2011

try this font too:
consolefont
Also you forgot:
weapon_oma


RE: Random Things 2 - iiTom - 09-20-2011

Randoms shit's nice Smile