dim3 Forum

Full Version: Removing rayguns
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, you know how i'm basing bw of the demo? weeell, i wanna get rid of the raygun, or at least make it so that you don't have to get it.

If i remove the part in red:
Quote://
// This is the object definition for a weapon.
//

function playerWeapon(name,bitmapName,meshName,hasClip,hasAmmo,hasAltAmmo)
{
this.name=name; // name of weapon
this.bitmapName=bitmapName; // name of bitmap in hud that represents this weapon
this.meshName=meshName; // name of mesh in player model that represents this weapon
this.hasClip=hasClip; // if this weapon uses clips
this.hasAmmo=hasAmmo; // if this weapon has ammo
this.hasAltAmmo=hasAltAmmo; // if this weapon has alternative ammo
}

//
// Now we create an array of these definitions
//

var weapons=new Array(6);
weapons[0]=new playerWeapon('Hammer','Hammer Icon','Hammer',false,false,false);
weapons[1]=new playerWeapon('Pistol','Pistol Icon','Pistol',true,true,false);
weapons[2]=new playerWeapon('Missile Launcher','Missile Icon','Missile Launcher',false,true,false);
weapons[3]=new playerWeapon('Mine','Mine Icon','Mine',false,true,false);
weapons[4]=new playerWeapon('Shock Launcher','Shock Cube Icon','Shock Launcher',false,true,false);
weapons[5]=new playerWeapon('Machine gun','Ray Gun Icon','B',true,true,false);
weapons[6]=new playerWeapon('Ray Gun','Ray Gun Icon','Ray Gun',true,true,false);
Then it won't open due to "references to undefined weapon.



If i remove the parts in blue:
Quote:
// setup weapons

for (i=0;i!=weapons.length;i++) obj.weapon.add(weapons[i].name);

// in game, start without raygun
if (!map.setting.multiplayer) {
obj.weapon.hideSingle('Ray Gun',true)
;
}
}

//
// player spawing
//

function playerSpawn(obj)
{
// select the hammer and hide the raygun
// we need to pick up the raygun, we start with
// all other weapons

obj.weapon.setSelect(weapons[0].name);
obj.weapon.hideSingle('Ray Gun',true);
Then it won't open at all, can't remember why.
Code:
// in game, start without raygun
if (!map.setting.multiplayer){   //<<this parentheses goes with
obj.weapon.hideSingle('Ray Gun',true);
}     //<<this parentheses, so you must remove them both.
}

the green parenthesis needs to be removed, or else the engine gets one too many closing parentheses and doesn't know what to do.

Also I'd recommend commenting things out, at least at first, so if you don't like the results you can easily go back.
I can't actually see the green, but i get you. i'll try now.
No, sorry, won't work.
Show us the new script Wink.
Don't worry, i just made the interface bitmap invisible. fixed.
Umm, I recommend actually fixing it Wink. Trust me, it's better that way Smile.
Reference URL's