Author Topic: Coding Lingo  (Read 1798 times)

I need to know what I use for "when you scroll through your items and select this particular weapon, not a particular slot, this happens:"

WeaponImage::Onmount

Hold on.

function _____Image::onMount(%this,%obj,%slot)
{

}
« Last Edit: March 15, 2010, 06:57:57 PM by rkynick »

so like, if I were to use the gun, it would go:

Code: [Select]
function gunImage::onMount(%this, %obj, %slot)
{
   //do stuff
}

Yes.
%obj being the player.
%slot being 0.

will this work too?

Code: [Select]
function gunImage::onUnMount(%this, %obj, %slot)
{
   //do stuff
}

I forget how unmounting works.

I think its like unequip or something.


You could also do a WeaponImage::onMount to cover all images and do your stuff when it changes.


What about checking to see if a file exists?

if(isFile("file with path"))


When I used this:

function rocketLauncherImage::onMount(%this,%obj,%slot)
{
   //did stuff
}

It made it to where the rocket launcher doesn't fire anymore. It works just fine with the Gun, Shotgun, and SniperRifle.

Post your entire code.

Mmkay.

Code: [Select]
//client.cs

//Akimbo
function AkimboGunImage::onMount(%this,%obj,%slot)
{
if(isFile("base/client/ui/crosshairs/gunAkimboCrossHair.png"))
crosshair.setBitmap("base/client/ui/crosshairs/gunAkimboCrossHair.png");
}

function AkimboGunImage::onUnMount(%this,%obj,%slot)
{
crosshair.setBitmap("base/client/ui/crosshair.png");
}

//Gun
function gunImage::onMount(%this,%obj,%slot)
{
if(isFile("base/client/ui/crosshairs/gunCrossHair.png"))
crosshair.setBitmap("base/client/ui/crosshairs/gunCrossHair.png");
}

function gunImage::onUnMount(%this,%obj,%slot)
{
crosshair.setBitmap("base/client/ui/crosshair.png");
}

//Rocket Launcher
function rocketLauncherImage::onMount(%this,%obj,%slot)
{
if(isFile("base/client/ui/crosshairs/rocketLauncherCrossHair.png"))
crosshair.setBitmap("base/client/ui/crosshairs/rocketLauncherCrossHair.png");
}

function rocketLauncherImage::onUnMount(%this,%obj,%slot)
{
crosshair.setBitmap("base/client/ui/crosshair.png");
}

//Shotgun
function ShotgunImage::onMount(%this,%obj,%slot)
{
if(isFile("base/client/ui/crosshairs/shotgunCrossHair.png"))
crosshair.setBitmap("base/client/ui/crosshairs/shotgunCrossHair.png");
}

function ShotgunImage::onUnMount(%this,%obj,%slot)
{
crosshair.setBitmap("base/client/ui/crosshair.png");
}

//SniperRifle
function SniperRifleImage::onMount(%this,%obj,%slot)
{
if(isFile("base/client/ui/crosshairs/sniperRifleCrossHair.png"))
crosshair.setBitmap("base/client/ui/crosshairs/sniperRifleCrossHair.png");
}

function SniperRifleImage::onUnMount(%this,%obj,%slot)
{
crosshair.setBitmap("base/client/ui/crosshair.png");
}

Problems:

RL Won't shoot
Akimbo Crosshair doesn't change.

1)
Put them in a package

2)
include a parent::onMount(%this,%obj,%slot); and parent::onUnMount(%this,%obj,%slot); at the end of each function.