TheVaultProjects Posted June 29, 2014 Share Posted June 29, 2014 (edited) So, as ridiculous as this sounds, I've gotten pretty far into developing a two player mod for Fallout New Vegas, using only one script form. Basically, this script uses an NPC that I have created and allows you to control him with a different part of the keyboard. With that being said, of course there are some problems and I would like some experts to help me. Here's a list of some problems that I need to fix or need an expert to help me fix:1. When the second player moves forward or backward, he/she will automatically continue to move as if you were to press "Q". The only way to stop it as of now is to make the second player jump by pressing "U". I need this fixed.2. When moving or looking, the second player can only move forward + backward and look left + right, not sideways or up + down. This is a huge flaw of course. I need the second player to be able to look every direction, even if that means more keys will be used. Maybe "I,J,K,L" can be used the same way as "WASD" and perhaps "8,4,6,2" on the numberpad can be used to look. Here's a list of some other features that I would like to add over time:1. I would definitely like to add some floating crosshairs with collision, maybe even like a laser pointer crosshair. Obviously this is one of the harder improvements to make, but necessary. And finally, the biggest disappointment- all gameplay is featured on one screen as before, and in the same way. The perspective is from the main player's point of view, while the other player can move on the same screen. Keys:Y - Open's both your and the NPC's inventory, allowing you to give or take items from each otherH - Teleport NPC to youU - JumpO - AimP - AttackI - Move forwardK - Move backwardJ - Look leftL - Look right Here's the script, if you decide you want help develop this project with me. You will most certainly be included in the credits for contributions if you help out. Do not redistribute this script. Scn 2ndPlayerControl float player2x float player2y int idle int holstered ref npc int jumping float jumpheight float maxjumpheight float jumpforce float npcmass 1 float gravity -9.8 int jumpcount short doOnceGetClothes short pantsPercent short shirtPercent short shoesPercent int firedelaycount int weaponc float aimangle 0 int vx2 short PlayerEn begin GameMode set PlayerEn to 2 set idle to 1 set npc to getcontainer npc.setplayerteammate 1 npc.removefromallfactions npc.removescriptpackage npc.setignorefriendlyhits 999 npc.setav responsibility 1 npc.setav assistance 2 npc.setav aggression 1 npc.setav confidence 4 ref rSelf set rSelf to GetSelf SetAlert 1 ;======== ;Section01 ;======== if GetKnockedState == 0 if IsKeyPressed 25 ==1 if npc.GetAnimAction != 2 set firedelaycount to firedelaycount + 1 if firedelaycount > 2 set firedelaycount to 0 set idle to 0 PlayGroup AttackPower 1 if getEquipped WeapLaserRifle == 1 FireWeapon WeapLaserRifle endif if getEquipped WeapAlienBlaster == 1 FireWeapon WeapAlienBlaster endif if getEquipped WeapBaseballBat == 1 FireWeapon WeapBaseballBat endif if getEquipped WeapBBGun == 1 FireWeapon WeapBBGun endif ;if getEqupped WeapBladedGauntlet == 1 ;FireWeapon WeapBladedGauntlet ;endif if getEquipped WeapBooneSniperRifle == 1 FireWeapon WeapBooneSniperRifle endif If getEquipped WeapBrassKnuckles == 1 FireWeapon WeapBrassKnuckles Endif If getEquipped WeapCattleProd == 1 FireWeapon WeapCattleProd Endif If getEquipped WeapDeathclawGauntlet == 1 FireWeapon WeapDeathclawGauntlet Endif If getEquipped WeapFatman == 1 FireWeapon WeapFatman Endif If getEquipped WeapFlamer == 1 FireWeapon WeapFlamer Endif If getEquipped WeapGatlingLaser == 1 FireWeapon WeapGatlingLaser Endif If getEquipped WeapGrenadeFrag == 1 FireWeapon WeapGrenadeFrag Endif If getEquipped WeapGrenadeFragMisfits == 1 FireWeapon WeapGrenadeFragMisfits Endif If getEquipped WeapGrenadeGas == 1 FireWeapon WeapGrenadeGas Endif If getEquipped WeapGrenadePlasma == 1 FireWeapon WeapGrenadePlasma Endif If getEquipped WeapGrenadePulse == 1 FireWeapon WeapGrenadePulse Endif ;If getEquipped WeapHeavyIncinerator == 1 ;FireWeapon WeapHeavyInsinerator ;Endif If getEquipped WeapHuntingRifle == 1 FireWeapon WeapHuntingRifle Endif If getEquipped WeapKnife == 1 FireWeapon WeapKnife Endif If getEquipped WeapKnifeAssassin == 1 FireWeapon WeapKnifeAssassin Endif If getEquipped WeapKnifeCombat == 1 FireWeapon WeapKnifeCombat Endif If getEquipped WeapKnifeCombatCass == 1 FireWeapon WeapKnifeCombatCass Endif If getEquipped WeapLaserPistol == 1 FireWeapon WeapLaserPistol Endif If getEquipped WeapLaserRifleAlwaysCrits == 1 FireWeapon WeapLaserRifleAlwaysCrits Endif ;If getEquipped WeapLaserRifleUnique == 1 ;FireWeapon WeapLaserRifleUnique ;Endif If getEquipped WeapLeadPipe == 1 FireWeapon WeapLeadPipe Endif If getEquipped WeapLeadPipeRaul == 1 FireWeapon WeapLeadPipeRaul Endif If getEquipped WeapMineBottlecap == 1 FireWeapon WeapMineBottlecap Endif If getEquipped WeapMineFrag == 1 FireWeapon WeapMineFrag Endif If getEquipped WeapMineNellisMunition == 1 FireWeapon WeapMineNellisMunition Endif If getEquipped WeapMinePlasma == 1 FireWeapon WeapMinePlasma Endif If getEquipped WeapMinePulse == 1 FireWeapon WeapMinePulse Endif If getEquipped WeapMinigun == 1 FireWeapon WeapMinigun Endif If getEquipped WeapMissileLauncher == 1 FireWeapon WeapMissileLauncher Endif If getEquipped WeapNailBoard == 1 FireWeapon WeapNailBoard Endif If getEquipped WeapNV127mmPistol == 1 FireWeapon WeapNV127mmPistol Endif If getEquipped WeapNV127mmSubmachineGun == 1 FireWeapon WeapNV127mmSubmachineGun Endif If getEquipped WeapNV357Revolver == 1 FireWeapon WeapNV357Revolver Endif If getEquipped WeapNV357RevolverUnique == 1 FireWeapon WeapNV357RevolverUnique Endif If getEquipped WeapNV44Revolver == 1 FireWeapon WeapNV44Revolver Endif If getEquipped WeapNV44RevolverRaul == 1 FireWeapon WeapNV44RevolverRaul Endif If getEquipped WeapNV9iron == 1 FireWeapon WeapNV9iron Endif If getEquipped WeapNV9mmPistol == 1 FireWeapon WeapNV9mmPistol Endif If getEquipped WeapNV9mmPistolUnique == 1 FireWeapon WeapNV9mmPistolUnique Endif If getEquipped WeapNV9mmSubmachineGun == 1 FireWeapon WeapNV9mmSubmachineGun Endif If getEquipped WeapNV9mmSubmachineGunUnique == 1 FireWeapon WeapNV9mmSubmachineGunUnique Endif If getEquipped WeapNVAntiMaterielRifle == 1 FireWeapon WeapNVAntiMaterielRifle Endif ;If getEquipped WeapNVAssaultCarabine == 1 ;FireWeapon WeapNVAssaultCarabine ;Endif ;If getEquipped WeapNVAssaultCarabineLily == 1 ;FireWeapon WeapNVAssaultCarabineLily ;Endif If getEquipped WeapNVBallisticFist == 1 FireWeapon WeapNVBallisticFist Endif If getEquipped WeapNVBattleRifleUnique == 1 FireWeapon WeapNVBattleRifleUnique Endif If getEquipped WeapNVBBGunUnique == 1 FireWeapon WeapNVBBGunUnique Endif If getEquipped WeapNVBoxingGloves == 1 FireWeapon WeapNVBoxingGloves Endif If getEquipped WeapNVBoxingGoldenGloves == 1 FireWeapon WeapNVBoxingGoldenGloves Endif If getEquipped WeapNVBoxingTape == 1 FireWeapon WeapNVBoxingTape Endif If getEquipped WeapNVBrushGun == 1 FireWeapon WeapNvBrushGun Endif If getEquipped WeapNVBumperSword == 1 FireWeapon WeapNVBumperSword Endif If getEquipped WeapNVC4PlasticExplosive == 1 FireWeapon WeapNVC4PlasticExplosive Endif If getEquipped WeapNVCaravanShotgun == 1 FireWeapon WeapNVCaravanShotgun Endif If getEquipped WeapNVCaravanShotgunCass == 1 FireWeapon WeapNVCaravanShotgunCass Endif If getEquipped WeapNVChainsaw == 1 FireWeapon WeapNVChainsaw Endif If getEquipped WeapNVCleaver == 1 FireWeapon WeapNVCleaver Endif ;If getEquipped WeapNVCleaverUnique == 1 ; FireWeapon WeapNVCleaverUnique ==1 ;Endif If getEquipped WeapNVCowboyRepeater == 1 FireWeapon WeapNVCowboyRepeater Endif ;If getEquipped WeapNVCowboyRepeayerUnique == 1 ; FireWeapon WeapNVCowboyRepeaterUnique ;Endif If getEquipped WeapNVDebugMegaPistol == 1 FireWeapon WeapNVDebugMegaPistol Endif If getEquipped WeapNVDetonator == 1 FireWeapon WeapNVDetonator Endif If getEquipped WeapNVDetonatorLoyal == 1 FireWeapon WeapNVDetonatorLoyal Endif ;If getEquipped WeapNVDisplacerGlove == 1 ; FireWeapon WeapNVDisplacer ;Endif ;If getEquipped WeapNVDisplaserGloveUnique == 1 ; FireWeapon WeapNVDisplaserGloveUnique ;Endif If getEquipped WeapNVDogTagFist == 1 FireWeapon WeapNVDogTagFist Endif If getEquipped WeapNVDogTagFistUnique == 1 FireWeapon WeapNVDogTagFistUnique Endif If getEquipped WeapNVDressCane == 1 FireWeapon WeapNVDressCane Endif If getEquipped WeapNVDriverUnique == 1 FireWeapon WeapNVDriverUnique Endif If getEquipped WeapNVDynamite == 1 FireWeapon WeapNVDynamite Endif If getEquipped WeapNVEuclidsCFinder == 1 FireWeapon WeapNVEuclidsCFinder Endif If getEquipped WeapNVFireaxe == 1 FireWeapon WeapNVFireaxe Endif If getEquipped WeapNVFireaxeUnique == 1 FireWeapon WeapNVFireaxeUnique Endif If getEquipped WeapNVFireGeckoFlame == 1 FireWeapon WeapNVFireGeckoFlame Endif If getEquipped WeapNVGaussRifle == 1 FireWeapon WeapNVGaussRifle Endif If getEquipped WeapNVGaussRifleUnique == 1 FireWeapon WeapNVGaussRifleUnique Endif If getEquipped WeapNVGrenadeFragHoly == 1 FireWeapon WeapNVGrenadeFragHoly Endif If getEquipped WeapNVGrenadeIncendiary == 1 FireWeapon WeapNVGrenadeIncendiary Endif If getEquipped WeapNVGrenadeLauncher == 1 FireWeapon WeapNVGrenadeLauncher Endif If getEquipped WeapNVGrenadeMachinegun == 1 FireWeapon WeapNVGrenadeMachinegun Endif If getEquipped WeapNVGrenadeMachinegunUnique == 1 FireWeapon WeapNVGrenadeMachinegunUnique Endif If getEquipped WeapNVGrenadeRifle == 1 FireWeapon WeapNVGrenadeRifle Endif If getEquipped WeapNVGrenadeRifleUnique == 1 FireWeapon WeapNVGrenadeRifleUnique Endif If getEquipped WeapNVGrenadeStun == 1 FireWeapon WeapNVGrenadeStun Endif If getEquipped WeapNVHatchet == 1 FireWeapon WeapNVHatchet Endif If getEquipped WeapNVHuntingRevolver == 1 FireWeapon WeapNVHuntingRevolver Endif If getEquipped WeapNVHuntingShotgun == 1 FireWeapon WeapNVHuntingShotgun Endif If getEquipped WeapNVHuntingShotgunUnique == 1 FireWeapon WeapNVHuntingShotgunUnique Endif If getEquipped WeapNVIncinerator == 1 FireWeapon WeapNVIncinerator Endif If getEquipped WeapNVKnifeCombatUnique == 1 FireWeapon WeapNVKnifeCombatUnique Endif If getEquipped WeapNVLaserPistolUnique == 1 FireWeapon WeapNVLaserPistolUnique Endif If getEquipped WeapNVLaserRCW == 1 FireWeapon WeapNVLaserRCW Endif If getEquipped WeapNVLeadPipeUnique == 1 FireWeapon WeapNVLeadPipeUnique Endif If getEquipped WeapNVLegateSword == 1 FireWeapon WeapNVLegateSword Endif If getEquipped WeapNVLeverActionShotgun == 1 FireWeapon WeapNVLeverActionShotgun Endif If getEquipped WeapNVLightMachineGun == 1 FireWeapon WeapNVLightMachineGun Endif If getEquipped WeapNVLilyGauntlet == 1 FireWeapon WeapNVLilyGauntlet Endif If getEquipped WeapNVLilySword == 1 FireWeapon WeapNVLilySword Endif If getEquipped WeapNVLongFuseDynamite == 1 FireWeapon WeapNVLongFuseDynamite Endif If getEquipped WeapNVMachete == 1 FireWeapon WeapNVMachete Endif If getEquipped WeapNVMacheteBoone == 1 FireWeapon WeapNVMacheteBoone Endif If getEquipped WeapNVMacheteDeadSea == 1 FireWeapon WeapNVMacheteDeadSea Endif If getEquipped WeapNVMacheteGladiator == 1 FireWeapon WeapNVMacheteGladiator Endif If getEquipped WeapNVMacheteGladius == 1 FireWeapon WeapNVMacheteGladius Endif If getEquipped WeapNVMantisGauntlet == 1 FireWeapon WeapNVMantisGauntlet Endif If getEquipped WeapNVMarksmanCarbine == 1 FireWeapon WeapNVMarksmanCarbine Endif If getEquipped WeapNVMarksmanCarbineUnique == 1 FireWeapon WeapNVMarksmanCarbineUnique Endif If getEquipped WeapNVMinePowderCharge == 1 FireWeapon WeapNVMinePowderCharge Endif If getEquipped WeapNVMinigunUnique == 1 FireWeapon WeapNVMinigunUnique Endif If getEquipped WeapNVMissFortuneGun == 1 FireWeapon WeapNVMissFortuneGun Endif If getEquipped WeapNVMissileLauncherUnique == 1 FireWeapon WeapNVMissileLauncherUnique Endif If getEquipped WeapNVMultiPlasRifle == 1 FireWeapon WeapNVMultiPlasRifle Endif If getEquipped WeapNVPlasmaCaster == 1 FireWeapon WeapNVPlasmaCaster Endif If getEquipped WeapNVPlasmaDefender == 1 FireWeapon WeapNVPlasmaDefender Endif If getEquipped WeapNVPlasmaDefenderArcade == 1 FireWeapon WeapNVPlasmaDefenderArcade Endif If getEquipped WeapNVPlasmaRifleUnique == 1 FireWeapon WeapNVPlasmaRifleUnique Endif If getEquipped WeapNVPulseGun == 1 FireWeapon WeapNVPulseGun Endif If getEquipped WeapNVRangerSequoia == 1 FireWeapon WeapNVRangerSequoia Endif If getEquipped WeapNVRebarClub == 1 FireWeapon WeapNVRebarClub Endif If getEquipped WeapNVRechargerPistol == 1 FireWeapon WeapNVRechargerPistol Endif If getEquipped WeapNVRechargerRifle == 1 FireWeapon WeapNVRechargerRifle Endif If getEquipped WeapNVRiotShotgun == 1 FireWeapon WeapNVRiotShotgun Endif If getEquipped WeapNVServiceRifle == 1 FireWeapon WeapNVServiceRifle Endif If getEquipped WeapNVSilenced22Pistol == 1 FireWeapon WeapNVSilenced22Pistol Endif If getEquipped WeapNVSilenced22SMG == 1 FireWeapon WeapNVSilenced22SMG Endif If getEquipped WeapNVSingleShotgun == 1 FireWeapon WeapNVSingleShotgun Endif If getEquipped WeapNVSlaveBackPack == 1 FireWeapon WeapNVSlaveBackPack Endif If getEquipped WeapNVSniperRifleUnique == 1 FireWeapon WeapNVSniperRifleUnique Endif If getEquipped WeapNVSpikedKnucklesUnique == 1 FireWeapon WeapNVSpikedKnucklesUnique Endif If getEquipped WeapNVStraightRazor == 1 FireWeapon WeapNVStraightRazor Endif If getEquipped WeapNVStraightRazorUnique == 1 FireWeapon WeapNVStraightRazorUnique Endif If getEquipped WeapNVTeslaCannonUnique == 1 FireWeapon WeapNVTeslaCannonUnique Endif If getEquipped WeapNVThatGun == 1 FireWeapon WeapNVThatGun Endif If getEquipped WeapNVThrowingHatchet == 1 FireWeapon WeapNVThrowingHatchet Endif If getEquipped WeapNVThrowingKnife == 1 FireWeapon WeapNVThrowingKnife Endif If getEquipped WeapNVThrowingSpear == 1 FireWeapon WeapNVThrowingSpear Endif If getEquipped WeapNVTimeBomb == 1 FireWeapon WeapNVTimeBomb Endif If getEquipped WeapNVTrailCarbine == 1 FireWeapon WeapNVTrailCarbine Endif If getEquipped WeapNVTriBeamLaserRifle == 1 FireWeapon WeapNVTriBeamLaserRifle Endif If getEquipped WeapNVVarmintRifle == 1 FireWeapon WeapNVVarmintRifle Endif If getEquipped WeapNVVarmintRifleUnique == 1 FireWeapon WeapNVVarmintRifleUnique Endif If getEquipped WeapNVZapGlove == 1 FireWeapon WeapNVZapGlove Endif If getEquipped WeapNVZapGloveUnique == 1 FireWeapon WeapNVZapGloveUnique Endif If getEquipped WeapPlasmaPistol == 1 FireWeapon WeapPlasmaPistol Endif If getEquipped WeapPlasmaRifle == 1 FireWeapon WeapPlasmaRifle Endif If getEquipped WeapPlasmaRifleAlwaysCrit == 1 FireWeapon WeapPlasmaRifleAlwaysCrit Endif If getEquipped WeapPoliceBaton == 1 FireWeapon WeapPoliceBaton Endif If getEquipped WeapPoolCue == 1 FireWeapon WeapPoolCue Endif If getEquipped WeapPowerFist == 1 FireWeapon WeapPowerFist Endif If getEquipped WeapPowerFistVeronica == 1 FireWeapon WeapPowerFistVeronica Endif If getEquipped WeapRipper == 1 FireWeapon WeapRipper Endif If getEquipped WeapRipperArcade == 1 FireWeapon WeapRipperArcade Endif If getEquipped WeapRollingPin == 1 FireWeapon WeapRollingPin Endif If getEquipped WeapShishkebab == 1 FireWeapon WeapShishkebab Endif If getEquipped WeapShotgunSawedOff == 1 FireWeapon WeapShotgunSawedOff Endif If getEquipped WeapShotgunSawedOffNPC == 1 FireWeapon WeapShotgunSawedOffNPC Endif If getEquipped WeapShotgunSawedOffUnique == 1 FireWeapon WeapShotgunSawedOffUnique Endif If getEquipped WeapShovel == 1 FireWeapon WeapShovel Endif If getEquipped WeapSledgehammer == 1 FireWeapon WeapSledgehammer Endif If getEquipped WeapSniperRifle == 1 FireWeapon WeapSniperRifle Endif If getEquipped WeapSpikedKnuckles == 1 FireWeapon WeapSpikedKnuckles Endif If getEquipped WeapSuperSledge == 1 FireWeapon WeapSuperSledge Endif If getEquipped WeapSuperSledgeMeanie == 1 FireWeapon WeapSuperSledgeMeanie Endif If getEquipped WeapSuperSledgeUnique == 1 FireWeapon WeapSuperSledgeUnique Endif If getEquipped WeapSwitchBlade == 1 FireWeapon WeapSwitchBlade Endif If getEquipped WeapTeslaCannon == 1 FireWeapon WeapTeslaCannon Endif If getEquipped WeapThermicLance == 1 FireWeapon WeapThermicLance Endif If getEquipped WeapTireIron == 1 FireWeapon WeapTireIron Endif endif endif endif If IsKeyPressed 24 ==1 PlayGroup AttackLoopIS 1 endif ;============= ;Section02 ;============= If IsKeyPressed 36 == 1 set player2x to player2x - 100 Rotate Z player2x if idle == 1 PlayGroup TurnLeft 2 endif endif If IsKeyPressed 36 < 1 set player2x to 0 endif ;============== ;Section03 ;============== if IsKeyPressed 38 ==1 set player2x to player2x +100 Rotate Z player2x if idle == 1 PlayGroup TurnRight 2 endif endif If IsKeyPressed 38 < 1 set player2x to 0 endif ;================= ;Section04 ;================= If IsKeyPressed 21 ==1 OpenTeammateContainer endif endif set vx2 to vx2 + 1 ;========= ;Section05 ;========= If IsKeyPressed 23 ==1 ;if npc.isAnimPlaying FastForward == 0 ; forward - i ;set player2y to 10 if idle == 1 PlayGroup FastForward 0 endif set idle to 0 endif ;========= ;Section06 ;========= If IsKeyPressed 37 ==1 ;if npc.isAnimPlaying FastBackward == 0 ; backward i ;set player2y to -10 if idle ==1 PlayGroup FastBackward 0 endif set idle to 0 endif ;=================== ;Section07 ;=================== if IsKeyPressed 35 ==1 MoveTo Player endif ;======= ;Section08 ;======= If IsKeyPressed 22 == 1 if jumping == 0 PlayGroup JumpStart 0 PlayGroup BlockHit 0 PlayGroup JumpLoopForward 0 ;PushActorAway rSelf 1 PlayGroup JumpLoop 0 set idle to 0 set jumping to 1 set maxjumpheight to GetPos Z + 100 set jumpforce to 10 set jumpcount to 0 endif set jumpcount to jumpcount + 1 float zPos float finaljumpforce ;set finaljumpforce to gumpforce - gravity set zPos to GetPos Z + jumpforce if jumpcount < 10 SetPos Z zPos endif set jumpforce to jumpforce * 0.95 If GetPos Z < maxjumpheight set jumpheight to jumpheight + jumpforce endif else set jumping to 0 set jumpheight to 0 set jumpforce to 0 endif if IsKeyPressed 49 ==1 set aimangle to aimangle + 3 endif if IsKeyPressed 50 ==1 set aimangle to aimangle - 3 endif if aimangle > 90 set aimangle to 90 endif if aimangle < -90 set aimangle to -90 endif END Edited July 1, 2014 by TheVaultProjects Link to comment Share on other sites More sharing options...
spartenkiller897 Posted June 29, 2014 Share Posted June 29, 2014 This looks amazing! I wish you luck with this. Link to comment Share on other sites More sharing options...
luthienanarion Posted June 29, 2014 Share Posted June 29, 2014 You could replace most of "section 01" with 'GetEquippedObject 5' and a ref variable. Link to comment Share on other sites More sharing options...
Recommended Posts