Jump to content

Playable Fallout Mech


devinpatterson

Recommended Posts

At the very least I can use the script as the basis for a new function that gets/returns ammo type. While there was already a get player ammo type function that worked, there is no truly working GetWeaponAmmoType function in NVSE at the moment.

Interesting, I'd like to have it. Seems like it would be pretty useful.

 

I am wary as to whether DT adjustment is really able to accomplish the task of a weapon effectiveness gradient, based upon weapon type, projectile type, ammo type, etc. The actual damage modification formulas that I put together are rather arbitrary, and can be easily changed. If you want to incorporate DT in there it is certainly possible.

The weapon gradient is already baked in via weapon statistics, values, etc. It's kind of just a reflection of the existing framework and how the designers envision the fallout world. But that's not to say I don't see value in what your doing. I could see instances where being able to alter them on a more global scale (groups of weapons as opposed to an individual weapon) would be very useful.

 

The cost/benefit analysis, and performance related questions are duly noted. I will continue to work on optimizing the code, and getting it to work...

Definitely be curious to see how it does

 

By identifying the weapons, ammo, and projectile types being fired at the player, it is possible to make, for example, hollow tips useless against the mech, while retaining some use for an AP ammo, and make an EMP/pulse munition highly effective. It could be resistance to flame, but weak to energy, as an example.

Sure, but I'm curious if it would handle particular scenarios better than the current gameplay dynamics. For example the DT penalty of hollow points already disqualifies it from harming the mech. AP ammo has a built in DT bonus, so high powered weapons will already have better damaging capability. Pulse weapons already have an alternate damage built in for power armors we will use. Flame resistance can use the fire resistance attribute etc.

 

On the other hand if we go beyond vanilla fallout tech, say for an example a fallout forcefield emitter, it would be useful to be able to quickly adapt weapon effectivness. Although there are also built in solutions in hte vanilla game too (ie adding actor effects like resistances), it's possible they may not be as comprehensive or as flexible as what your script could provide.

 

So I'm not dismissing your work in any way, it's rather that I'm cautious since I believe most of what we want can be simulated with existing fallout gameplay dynamics without resorting to a very granular approach via scripting. And because the vanilla gameplay dynamics are handled by the game engine I suspect they can be much more efficient. But it may be that I'm wrong, and there are future or specific scenarios where it becomes indefensible with little or no drain to system resources.

 

Regardless I'd like to say great work on the script itself

Link to comment
Share on other sites

  • Replies 246
  • Created
  • Last Reply

Top Posters In This Topic

testing the mech now with what I hope is the finalized script. I run approximately 300 mods alongside this one and I can say the mech causes no lag even with the ref-walking script.

I did want to say that I thought it was weird that the mech doesn't have its own weapon system.

 

have we found anyone to make us custom models yet? maybe we can have a modular weapon system.

Here is the new mechscript if you want to look at it in the meantime. Once i've tested the features to make sure they all work I will PM you the dropbox link Dev. Am I permitted to release the new beta when its done or wait for you to test it?

 

 

 

Scn mechScript1

;devp
int bIsNPressed
;armor health float
;helmet health float
ref rPLayerArmor ;players armor
ref rPLayerHelmet ;players helmet
ref rPlayerHat
int WeapType
int RndFlag

;swat
int counter
int numNPC
int MechCheckFlag
int AmmoFoundFlag
int AmmoTypeFormListFlag
int DebugFlag
int CurrentNPCWeapType
int CurrentNPCCombatFlag
ref rCurrentNPC
ref rCurrentNPCWpn
ref rNPCTarget
ref rNPCAmmoList
ref rNPCAmmoType
float NPCProximity
float timer
short NormalAttackDmg
short ModifiedAttackDmg
short NormalDmgModifier
short AmmoDmgModifier
short NPCAmmoTypeCheck
string_var sv_EquippedAmmoName

Begin onAdd
    set rPLayerArmor to player.getEquippedObject 2
    set rPLayerHelmet to player.getEquippedObject 0
    player.equipItem ArmorUniqueEnclaveMech 0 1
    player.additem armorUniqueEnclaveHelmet 1 1
    player.equipItem armorUniqueEnclaveHelmet 0 1
    ;equip weapon
    ;player.unequipitem pipboy
    ;player.removeitem pipboy 1 1
    set MechCheckFlag to 1
    disablePlayerControls 0 1 0 0 0 1 1
    DisableControl 16 ;VATS CC
    DisableKey 264 ;Mouse Wheel Up DX CC
    DisableKey 265 ;Mouse Wheel Down DX CC
    player.setScale 3.3
    return
End

Begin GameMode
    if bIsNPressed != IsKeyPressed 49 ; N
        set bIsNPressed to IsKeyPressed 49 ; N
        if bIsNPressed
            ;get health of armor, set to var
            player.unequipItem ArmorUniqueEnclaveMech 0 1
            player.unequipItem armorUniqueEnclaveHelmet 0 1
            player.removeItem armorUniqueEnclaveHelmet 1 1
            set MechCheckFlag to 0
            enablePlayerControls
            EnableControl 16 ;VATS CC
            EnableKey 264 ;Mouse Wheel Up DX CC
            EnableKey 265 ;Mouse Wheel Down DX CC
            player.setScale 1.0
            player.drop ArmorUniqueEnclaveMech 1
            player.equipitem rPLayerArmor 0 1
            player.equipitem rPLayerHelmet 0 1
            player.equipitem rPLayerHat 0 1
            ;player.additem pipboy 1
            ;player.equipitem 15038 ;pipboy

        ;else
            ; N has been released
        endif
    endif
    
    ;this is for debug mode
    if bIsNPressed != IsKeyPressed 30 ; num *
        set bIsNPressed to IsKeyPressed 30 ; num *
        if bIsNPressed
            if (DebugFlag == 1)
                DisableControl 16 ;VATS CC
                DisableKey 264 ;Mouse Wheel Up DX CC
                DisableKey 265 ;Mouse Wheel Down DX CC
                MessageEx "Debug Mode Off"
            elseif (DebugFlag == 0)
                enablePlayerControls
                EnableControl 16 ;VATS CC
                EnableKey 264 ;Mouse Wheel Up DX CC
                EnableKey 265 ;Mouse Wheel Down DX CC
                MessageEx "Debug Mode On"
            endif
        else
        endif
    endif
    
    ;swats' weapon effectiveness script
    set counter to 0
    set timer to 0
    set AmmoDmgModifier to 0
    set numNPC to GetNumRefs 200 1

    if (numNPC == 0) || (player.IsInCombat == 0)
        return
    elseif (numNPC > 0)&&(player.IsInCombat)
        set rCurrentNPC to GetFirstRef 200 1
    endif
    
    if (DebugFlag == 1)
        MessageEx "Computer: Initializing Mech Damage Assessment Program"
        MessageEx "Generating Log"
        con_SCOF "Mech_Log.txt"
    endif

    ;fill form list with refwalk script
    ;sort form list by distance
    ;remove dead npcs
    ;run damage modification script
    
    while (counter <= numNPC) && (rCurrentNPC != 0) && (MechCheckFlag)
        set counter to (counter + 1)
        if (DebugFlag == 1)
            set timer to timer+GetSecondsPassed
            MessageEx "Computer: Analyzing NPC %g out of num %g. NPC : %i | %n" counter numNPC rCurrentNPC rCurrentNPC
            printc "Analyzing NPC %g out of num %g. NPC : %i | %n" counter numNPC rCurrentNPC rCurrentNPC
        endif
        set CurrentNPCCombatFlag to rCurrentNPC.IsInCombat
        if (CurrentNPCCombatFlag == 1) || (rCurrentNPC.GetCurrentAIPackage == 5)
            set rNPCTarget to rCurrentNPC.GetCombatTarget
            if (rNPCTarget == player)
                set rCurrentNPCWpn to rCurrentNPC.GetEquippedObject 5
                if (DebugFlag == 1)
                    MessageEx "Analyzing hostile NPC's"
                endif
                if (rCurrentNPCWpn != 0)
                    if (DebugFlag == 1)
                        MessageEx "Computer: Analyzing NPC Ammo Types"
                    endif
                    ;shout out to Gribbleshnibit8 for heads up about error checking form lists
                    ;see http://forums.nexusmods.com/index.php?/topic/839682-problem-with-getweaponammo/page-2#entry6742499 for potential issues
                    set rNPCAmmoList to GetWeaponAmmo rCurrentNPCWpn
                    set rNPCAmmoType to ListGetNthForm rNPCAmmoList 0 ;shout out to luthienanarion for this
                    
                    if (DebugFlag == 1)                
                        MessageEx "NPCAmmoType %i | NPCAmmoName %n" rNPCAmmoType rNPCAmmoType
                        printc "NPCAmmoType %i | NPCAmmoName %n" rNPCAmmoType rNPCAmmoType
                    endif
                    
                    ;This experimental method will try to flag whether the ammo that is being fired
                    ;is identifiable by its editor id. e.g. AP for Armour Piercing
                    ;If a recognized substring is found in the ammo name the script
                    ;will search the respective ammo type form list for this variety.
                    ;If the ammo type form is not found in that form list, it will be added.
                    
                    set sv_EquippedAmmoName to rNPCAmmoType.GetName
                    
                    ;Armor Piercing check
                    set AmmoFoundFlag to sv_Find "AP" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList APAmmoList == 0)
                            AddFormToFormList rNPCAmmoType APAmmoList
                        endif
                        set AmmoDmgModifier to 1
                    endif
                    set AmmoFoundFlag to sv_Find "Piercing" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList APAmmoList == 0)
                            AddFormToFormList rNPCAmmoType APAmmoList
                        endif
                        set AmmoDmgModifier to 1
                    endif
                    
                    ;High explosive check
                    set AmmoFoundFlag to sv_Find "HE" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList HEAmmoList == 0)
                            AddFormToFormList rNPCAmmoType HEAmmoList
                        endif
                        set AmmoDmgModifier to 2
                    endif
                    
                    ;Hollow Point check
                    set AmmoFoundFlag to sv_Find "HP" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList HPAmmoList == 0)
                            AddFormToFormList rNPCAmmoType HPAmmoList
                        endif
                        set AmmoDmgModifier to 3
                    endif
                    set AmmoFoundFlag to sv_Find "Hollow Point" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList HPAmmoList == 0)
                            AddFormToFormList rNPCAmmoType HPAmmoList
                        endif
                        set AmmoDmgModifier to 3
                    endif
                    set AmmoFoundFlag to sv_Find "HollowPoint" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList HPAmmoList == 0)
                            AddFormToFormList rNPCAmmoType HPAmmoList
                        endif
                        set AmmoDmgModifier to 3
                    endif
                    
                    ;Magnum check
                    set AmmoFoundFlag to sv_Find "Magnum" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList MagnumAmmoList == 0)
                            AddFormToFormList rNPCAmmoType MagnumAmmoList
                        endif
                        set AmmoDmgModifier to 4
                    endif
                    
                    ;Dragons Breath check
                    set AmmoFoundFlag to sv_Find "DragonsBreath" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList DragonsBreathAmmoList == 0)
                            AddFormToFormList rNPCAmmoType DragonsBreathAmmoList
                        endif
                        set AmmoDmgModifier to 5
                    endif
                    
                    ;Pulse check
                    set AmmoFoundFlag to sv_Find "Pulse" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList PulseAmmoList == 0)
                            AddFormToFormList rNPCAmmoType PulseAmmoList
                        endif
                        set AmmoDmgModifier to 6
                    endif
                    
                    ;EMP check
                    set AmmoFoundFlag to sv_Find "EMP" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList EMPAmmoList == 0)
                            AddFormToFormList rNPCAmmoType EMPAmmoList
                        endif
                        set AmmoDmgModifier to 7
                    endif
                    
                    ;Plasma check
                    set AmmoFoundFlag to sv_Find "Plasma" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList PlasmaAmmoList == 0)
                            AddFormToFormList rNPCAmmoType PlasmaAmmoList
                        endif
                        set AmmoDmgModifier to 8
                    endif
                    
                    ;Incendiary check
                    set AmmoFoundFlag to sv_Find "Incendiary" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList IncendiaryAmmoList == 0)
                            AddFormToFormList rNPCAmmoType IncendiaryAmmoList
                        endif
                        set AmmoDmgModifier to 9
                    endif
                    
                    ;Explosive check
                    set AmmoFoundFlag to sv_Find "Explosive" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList ExplosivesAmmoList == 0)
                            AddFormToFormList rNPCAmmoType ExplosivesAmmoList
                        endif
                        set AmmoDmgModifier to 10
                    endif
                    
                    ;Frag check
                    set AmmoFoundFlag to sv_Find "Frag" sv_EquippedAmmoName
                    if (AmmoFoundFlag != -1)
                        if (rNPCAmmoType.IsInList FragAmmoList == 0)
                            AddFormToFormList rNPCAmmoType FragAmmoList
                        endif
                        set AmmoDmgModifier to 11
                    endif
                                
                    
                    if (DebugFlag == 1)
                        MessageEx "Computer: Analyzing NPC weapon types"
                        printc "Computer: Analyzing NPC weapon types"
                    endif
                    
                    ;this block of code modifies damage to the mech based on the weapon type
                    ;e.g. small arms fire will not do much damage. Energy weapons will.
                    ;ammo types are also factored in
                    if (GetWeaponType rCurrentNPCWpn <= 3)
                        set NormalAttackDmg to GetAttackDamage rCurrentNPCWpn
                        set NormalDmgModifier to (NormalAttackDmg *.65)
                        set ModifiedAttackDmg to (NormalAttackDmg - NormalDmgModifier)
                        rCurrentNPCWpn.SetAttackDamage ModifiedAttackDmg
                        if (DebugFlag == 1)
                            MessageEx "NPC: %i| Weapon: %n| Ammo Name: %n" rCurrentNPC rCurrentNPCWpn rNPCAmmoType
                            MessageEx "Original Damage: %g |DmgModifier: %g| ModifiedDmg: %g" NormalAttackDmg NormalDmgModifier ModifiedAttackDmg
                            printc "NPC: %i| Weapon: %n| Ammo Name: %n" rCurrentNPC rCurrentNPCWpn rNPCAmmoType
                            printc "Original Damage: %g |DmgModifier: %g| ModifiedDmg: %g" NormalAttackDmg NormalDmgModifier ModifiedAttackDmg
                        endif
                    elseif (GetWeaponType rCurrentNPCWpn >= 7)
                        set NormalAttackDmg to GetAttackDamage rCurrentNPCWpn
                        set ModifiedAttackDmg to (NormalAttackDmg*1.2)
                        ;%25 increase in damage if munitions are effective verse mech armor
                        if (AmmoDmgModifier >= 1)
                            set AmmoDmgModifier to (NormalAttackDmg*.25)
                            set ModifiedAttackDmg to ModifiedAttackDmg + AmmoDmgModifier
                        endif
                        rCurrentNPCWpn.SetAttackDamage ModifiedAttackDmg
                        if (DebugFlag == 1)
                            MessageEx "NPC: %i| Weapon: %n| Ammo Name: %n" rCurrentNPC rCurrentNPCWpn rNPCAmmoType
                            MessageEx "Original Damage: %g |DmgModifier: %g| ModifiedDmg: %g" NormalAttackDmg NormalDmgModifier ModifiedAttackDmg
                            printc "NPC: %i| Weapon: %n| Ammo Name: %n" rCurrentNPC rCurrentNPCWpn rNPCAmmoType
                            printc "Original Damage: %g |DmgModifier: %g| ModifiedDmg: %g" NormalAttackDmg NormalDmgModifier ModifiedAttackDmg
                        endif
                    endif
                
                endif
            endif
        endif
        
        
        set rCurrentNPC to Apple
        set rCurrentNPC to GetNextRef ;this gets the next NPC ref
        set CurrentNPCCombatFlag to 0
        
        if (Player.GetEquipped ArmorUniqueEnclaveMech == 0)
            break
        endif

    loop
    
    if (DebugFlag == 0)
        MessageEx "Completed %g out of %g passes in %.2f seconds." counter numNPC timer
        printc "Completed %g out of %g passes in %.2f seconds." counter numNPC timer
        set timer to 0
    endif
    
    set numNPC to 0
    
    
    return
End

 



P.S. Dev how did you disable the pipboy? I see the coded in the script is commented out, but pipboy doesnt work.

P.P.S. I am also having the exit mech naked bug. I am going to try storing a players gear in a form list and reequipping from the list to see if that fixes the bug.

Edited by irswat
Link to comment
Share on other sites

Here is the damage modification formula I'm using. I am open to suggestions regarding this:

if the weapon attacking the mech is small arms fire the formula is: ( a 65% reduction in damage)

 

Normal attack damage-(normal attack damage * .65)


If the weapon is a mine, a launcher, a grenade,
or an energy weapon: (a 20% increase in damage)

normal attack damage + (normal attack damage * .2)

If the ammunition type is Armour piercing, explosive, emp, etc: (a 25% increase in damage on top of the weapon damage modification)

Link to comment
Share on other sites

testing the mech now with what I hope is the finalized script. I run approximately 300 mods alongside this one and I can say the mech causes no lag even with the ref-walking script.

Cool, how many hostiles (at a time) did you test it with?

 

I did want to say that I thought it was weird that the mech doesn't have its own weapon system.

We've been talking about weapon systems for a while, should be some info in this thread and the previous.

 

have we found anyone to make us custom models yet? maybe we can have a modular weapon system.

No one has volunteered, so I assume I'll probably do it. I can do hand canons (possibly with the gauntlet retracting, possibly with a permanent hand/glove replacement...I'll have to see what works best), and arm based weapon (example a rail gun mounted on forearm), and shoulder based rocket launchers....anything that has a projectile node in teh right spot for the animation is something I can work with. I'd like to do something akin to a chest based blaster but I don't know of a firing animation that would work with it (at the moment).

 

Am I permitted to release the new beta when its done or wait for you to test it?

No, I definitely don't want separate versions or a fork floating about. I'll be happy to include your version in the files as one of the main downloads (possibly as the main download, depending on performance and other aspects), but there are many aspects I want to finish before releasing the first public beta (not the least of which is the new models for weapons).

 

P.S. Dev how did you disable the pipboy? I see the coded in the script is commented out, but pipboy doesnt work.

Unequipping (or maybe it was the reequiping) the pipboy causes a insta-crash on my system. There was some info re: it in the pimpboy and tranquility lane subjects, but I haven't had time to trouble shoot it.

 

P.P.S. I am also having the exit mech naked bug. I am going to try storing a players gear in a form list and reequipping from the list to see if that fixes the bug.

Sure, give it a shot, see if it works.

 

 

Here is the damage modification formula I'm using. I am open to suggestions regarding this:

Yeah it can be somewhat arbitrary/opinion based. It's part of the reason I favor letting the existing game engine handle it (so it reflects current weapon/ammo stats in game) as opposed to re-inventing the wheel. However I'm sure the flexibility of the system will come in handy (now or in the future).

Link to comment
Share on other sites

Few quick and random ideas before I head to work;

 

I think a even slower crippled speed will be in order since our base speed is already reduced (or else crippled speed isn't going to seem much different). I think it could also be a great mech play dynamic. Where crippling the mech is almost as devastating as destroying it.

 

Re: damage models. Static or movable nif's have destruction stages that can show more damaged models. I think that would be good for the mech. I can make up several that are progressively more and more beat up (texture changes like burns or bullet holes, model changes with ragged or deformed meshes, and electrical effects like arcs, sparks, smoke and fire) as the armor health degrades.

 

Since the mech may not have a repair bay handy (other than in it's point of origin/home base) one way of having some semi-realistic healing could be a swarm of repair eyebots (they are a new variant from lonesome road). They could swarm over the mech arc welding and otherwise repair it.

Link to comment
Share on other sites

We'll have a version of the mod, that just drops the mech somewhere for players to run rampant with. For those that just want to blow stuff up and don't care about a rhyme or reason.

However for a lore friendly mod I have a couple of ideas. I havn't pinned down the location yet (some real life military installation that works with experimental weapons, maybe something akin to DARPA), and it will depend on whether we go with enclave or BOS elements, but I have an idea on the scenario that fits well with the simulation.

Essentially it would be something like operation anchorage. This is also a concept I had in mind for the mars mod. Essentially a training simulation would have to be completed before the player could gain access to teh mech (the mainframe assuming this is a new peep and following it's safety protocol programming only a certified pilot would be allowed access to the mech). After battling through various sims (one of which I'd like to be the Washington monument), the player gets access to the actual mech.

 

The trigger to get the ball rolling would be the player discovering enclave elements or a rogue BOS chapter are attempting to liberate the mech from it's facility (they havn't succeeded as of yet due to being unable to complete the sim). The player must sneak or fight their way in past enclave or BOS elements, complete the sims and utilize the mech. At the point the player liberates the Mech, a large number of reinforcements will arrive (with heavy weaponry; AM rifles, plasma canons, missile launchers, armed vertibird or two) and the player must escape/run the gauntlet.

Link to comment
Share on other sites

https://www.dropbox.com/s/8t0f9jtik8tqqoy/mech.zip

this includes the changes you asked for:

VATS disabled
Mousewheel disabled
Damage to the mech changes based upon type of ammo/type of weapon

there is a 'debug' mode i've included that enables player controls, and creates a log file in the fnv dir. to enable debug mode simply press A while in the mech.

I have tested and can confirm everything works as it should. if there is anything else I can do please let me know. I enjoy writing scripts a lot.

I found some sound fx for walking, and when an NPC gets squished. Does anyone know what format this needs to be in, and where I put the sound files?

I kind of want to figure out a way to make it possible to step on NPC's. Also NPC's within a couple feet of the mech get knocked down. I think the following will suffice, but I think there will be problems with visual. How can I apply this formula to only kill the npc if

A.) They are under the feet

B.) The foot has come down upon them

		set CurrentNPCPOSX to rCurrentNPC.GetPos X
		set CurrentNPCPOSY to rCurrentNPC.GetPos Y
		set CurrentNPCPOSZ to rCurrentNPC.GetPos Z
		set CurrentPOSX to player.GetPos X
		set CurrentPOSY to player.GetPos Y
		set CurrentPOSZ to player.GetPos Z
		
		If (CurrentNPCPOSX == CurrentPOSX) && (CurrentNPCPOSY == CurrentPOSY) && (CurrentNPCPOSZ == CurrentPOSZ)
			rCurrentNPC.KillActor 1 5
		endif
		
		set NPCProximity to player.GetDistance rCurrentNPC
		if (NPCProximity<=8)
			player.PushActorAway rCurrentNPC 10
		endif

we should also get permission to use this: http://www.nexusmods.com/newvegas/mods/55334/?

Edited by irswat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...