Release Spawning Weapons
#1
Here's some code that spawns weapons the right way, special thanks to @Nukem for telling me how to spawn them. I added some code so you can control the pickup and shit. Dual wielded weapons seem to screw up .. one of the weapons only has 1 bullet in the clip when you pick them up, dunno why this happens or how to fix it.

Code:
spawnWeapon( weapon, location, floating, deleteDropped ) { // create the weapon item = spawn( "weapon_" + weapon, location ); item.angles = ( 0, 0, 0 ); item setPickupStartAmmo( weapon ); // the weapon will drop to the ground, this will prevent that from happening if( isDefined( floating ) && floating ) { item.placeholder = spawn( "script_origin", location ); item.placeholder enableLinkTo(); item linkTo( item.placeholder ); } while( true ) { // waittill a player picks up the gun item waittill( "trigger", player, droppedWeapon ); if( !isDefined( player ) ) continue; // // do other stuff when someone picks it up here // if( isDefined( droppedWeapon ) ) { // make sure the dropped weapon won't stay forever droppedWeapon thread maps\mp\gametypes\_weapons::watchPickup(); droppedWeapon thread maps\mp\gametypes\_weapons::deletePickupAfterAWhile(); // delete the dropped weapon when deleteDropped = true if( isDefined( deleteDropped ) && deleteDropped ) droppedWeapon delete(); } } } // give the right amount of ammo when picked up setPickupStartAmmo( weapon ) { curWeapon = weapon; altIndex = 0; while ( altIndex == 0 || ( curWeapon != weapon && curWeapon != "none" ) ) { clipAmmo = weaponClipSize( curWeapon ); stockAmmo = clipAmmo * 3; if( isSubStr( curWeapon, "dw_" ) ) stockAmmo = clipAmmo * 4; self itemWeaponSetAmmo( clipammo, stockAmmo, altIndex ); curWeapon = weaponAltWeaponName( curWeapon ); altIndex++; } }
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] [SOURCE] Random Weapons. [HARD] Tony. 1 6,148 11-08-2013, 11:11
Last Post: Nekochan
  Help Spawning carepackage helicopter -- DidUknowiPwn 4 5,650 11-08-2013, 08:18
Last Post: DidUknowiPwn
  Help source random weapons [HARD] Tony. 4 6,556 11-08-2013, 05:25
Last Post: [HARD] Tony.
  MW3 Hide WEAPONS [HARD] Tony. 7 9,602 10-09-2013, 15:16
Last Post: [HARD] Tony.
  Porting some weapons, ADS broken? DidUknowiPwn 0 3,645 09-10-2013, 01:13
Last Post: DidUknowiPwn
  Spawning Solid Models akillj 5 6,066 09-08-2013, 00:07
Last Post: akillj
  Chicken spawning possible? akillj 8 6,962 09-07-2013, 06:22
Last Post: ScHmIdTy56789
  [Request] Mw2 lock weapons seraph1995 1 4,711 08-18-2013, 15:31
Last Post: DidUknowiPwn
  [Release] Pack-A-Punch Weapons TheSchitt 40 40,438 08-07-2013, 04:51
Last Post: FrostLight
  Help DONATE points for weapons [HARD] Tony. 10 10,245 05-24-2013, 10:59
Last Post: Pozzuh

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.