irswat Posted April 15, 2014 Share Posted April 15, 2014 ill get started tonight. Link to comment Share on other sites More sharing options...
irswat Posted April 15, 2014 Share Posted April 15, 2014 (edited) Would it be easier to shut down vats, or get the key to activate VATS by script, and disable it while in the mech? Edited April 15, 2014 by irswat Link to comment Share on other sites More sharing options...
irswat Posted April 15, 2014 Share Posted April 15, 2014 (edited) I think to get the armor to work youll need to add it to a form list as you unequip it. Then use the formlist to get the reference of the armor that was equipped to reequip, and remove the items from the form list as you requip. 1 and 2 were very easy. I'm not sure what you want me to do for #3.I'm working on variable damage section of the script. It seems tricky.I was thinking of usingBegin OnHitWithorif GetAttacknext i need to get the refid of the NPC that is attacking, the refid of the weapon they are using and the formid of the projectile they are firing.Then I think I can use GetType and GetHitLocation to conditionally SetAttackDamage to the projectile formID. Weapon Type 0: HandToHandMelee 1: OneHandMelee 2: TwoHandMelee 3: OneHandPistol 4: OneHandPistolEnergy 5: TwoHandRifle 6: TwoHandAutomatic 7: TwoHandRifleEnergy 8: TwoHandHandle 9: TwoHandLauncher 10: OneHandGrenade 11: OneHandMine 12: OneHandLunchboxMine None -1 Torso 0 Head 1 1 Head 2 2 Left Arm 1 3 Left Arm 2 4 Right Arm 1 5 Right Arm 2 6 Left Leg 1 7 Left Leg 2 8 Left Leg 3 9 Right Leg 1 10 Right Leg 2 11 Right Leg 3 12 Brain 13 Hand or Weapon 14 I am not sure how to get the refid of the NPC (s) attacking, the refid of the weapon they are using, or the formid of the projectile being fired. Can you point me in the right direction? Edited April 15, 2014 by irswat Link to comment Share on other sites More sharing options...
devinpatterson Posted April 15, 2014 Author Share Posted April 15, 2014 Would it be easier to shut down vats, or get the key to activate VATS by script, and disable it while in the mech? True, easier to just disable the key. I think to get the armor to work youll need to add it to a form list as you unequip it. Then use the formlist to get the reference of the armor that was equipped to reequip, and remove the items from the form list as you requip. Sorry I'm not groking why you'd want to use a formlist as opposed to storing each items ID in a var. Could you clue me in? In my case the script swaps the armor fine, although not the helmet (but that may just be a hat vs head equip slot issue, I'll have to check the script), but it's not re-equiping any of alienzerox's stuff (or at least not his armor/outfit, don't know if he had a hat/helmet). We also need to add the weapon into the mix, if I didn't include it in the script, so that the player will have the same weapon holstered after exit. 1 and 2 were very easy. I'm not sure what you want me to do for #3. Well if you reduce the value for fJumpFallHeightMin and fJumpFallHeightExponent settings to 0 (via setNumericGameSetting), you won't take any fall damage. Although we probably don't want to go that far. Instead we want the mech to be able to fall a proportional amount of distance to it's 3.3X size. As it is now, a relatively small drop (proportionally to the mechs large size) can be deceptively deadly. So I'd play around with it a bit and see what's appropriate. I'm working on variable damage section of the script. It seems tricky. Is this in reference to the comment I made about small arms fire ( "By changing them (ie raising the minimum damage that gets through, in the DT formula) we can make the mech immune to small arms fire")? Or did you have a different intention in mind? If it's for the small arms fire, then simply changing FMinDamMultiplier to 0 will result in any attack that does less than 60 dam (the armors, DT) not penetrating the mech. We can of course lower or raise the mech's DT, but 60 isn't too bad. It knocks out most small arms but the 45-70s, AM rifle, gauss rifle and any armor piercing rounds will get through. Or is the script for a different feature of the mod? Your mention of getHitLocation sort of sparked an idea (not essential, just a bit of window dressing). We could have a hud element (say next to our radar) that resemble a schematic of the mech on screen. As it takes damage to a specific part, that part could be highlighted in red or something indicating a failing subsystem. Ie. getAV LeftMobilityCondition if it's low we can color the onscreen diagram of the mechs left leg yellow, if it's at 0 we can color it red (since you'd be crippled, ie system has failed). Doesn't change any gameplay dynamics, just a an extra bells and whistles thing for the cockpit HUD display. Link to comment Share on other sites More sharing options...
irswat Posted April 15, 2014 Share Posted April 15, 2014 Unless you are using a global variable I'm not sure how the script would know what you are trying to equip. A formlist would solve this. I'm not certain its the problem, it's my best guess. I'm still new to geck scripting.I'll let you do the fall damage part. Is the fall damage when you exit 'the mech'?I wanted to script the armor so it was resistant to small arms, and even rifles (except armor piercing variety bullets), but susceptible to energy weapons, and explosives. I'm not sure how to get the refid of the enemy (ies) that are attacking the player; the object id of the weapon they are using; the formid of the projectile it fires. Link to comment Share on other sites More sharing options...
devinpatterson Posted April 16, 2014 Author Share Posted April 16, 2014 Unless you are using a global variable I'm not sure how the script would know what you are trying to equip. A formlist would solve this. I'm not certain its the problem, it's my best guess. I'm still new to geck scripting. Naw I just stor it in a ref var, no glob needed....it's all in the same script. I was originally worried that since it was in a equip block I did't know if the function would return the id of the players items or the mech armor (ie does the script fire off that block before or after, but I think it's the original outfit for at least one frame while the script runs). Also if you ever worried about taping another scripts var you can do so with getScriptVariable, so you don't have to use a glob (not that there is anything wrong with using one, can be a useful shorthand if a lot of scripts tap into it). I'll let you do the fall damage part. Is the fall damage when you exit 'the mech'? No it's simply a reflection of the mech's increased size that the game engine doesn't scale with falls; re: setScale "Be careful when using setscale to large numbers. You may seem big and powerful, but a very small drop-off (in comparison to your size) will be fatal. Cliffs look very tiny from 50 feet up, but still kill you as if you were normal size." I wanted to script the armor so it was resistant to small arms, and even rifles (except armor piercing variety bullets), but susceptible to energy weapons, and explosives. Yeah I wouldn't go that direction, the mech should be resistant to not only ballistic damage but also energy weapons and explosives. On the other hand I'll add them to formlists for emp weapons, which will definitely screw with them. Link to comment Share on other sites More sharing options...
irswat Posted April 16, 2014 Share Posted April 16, 2014 doesn't the script return at end? how will it know the armor you had on unless you store it in a formlist or global variable? you get the formid for the armor/weapon when you dequip it right, and then you equip the armor. The script ends. Because the old armor/weapon are not equipped the engine won't have any idea what the player had equipped during the last iteration of the script running. Am I wrong? Link to comment Share on other sites More sharing options...
devinpatterson Posted April 16, 2014 Author Share Posted April 16, 2014 doesn't the script return at end? how will it know the armor you had on unless you store it in a formlist or global variable? you get the formid for the armor/weapon when you dequip it right, and then you equip the armor. The script ends. Because the old armor/weapon are not equipped the engine won't have any idea what the player had equipped during the last iteration of the script running. Am I wrong? Ah, I think I see the misunderstanding. This may be a situation where your programming background has led you a bit astray. A great many vars are stored in running scripts and are not reset/zero'd at the end. As an example when you have companions there are vars that keep track of whether this or that companion is dead, hired, fired, back at the lucky 38 etc. These are all kept (for each companion) in the vNPCfollowersQuestScript as local variables. If each of those vars were zero'd out at the end of this script that information would be lost every 5 seconds, instead they are retained between iterations and can also be tapped into by other scripts. Link to comment Share on other sites More sharing options...
irswat Posted April 16, 2014 Share Posted April 16, 2014 here is the script I am working with. Note the simple amendments to from your version for toggling VATS and the mouse wheel. I haven't tested, but assume the syntax is correct. Scn mechScript1 int bIsNPressed ;armor health float ;helmet health float ref rPLayerArmor ;players armor ref rPLayerHelmet ;players helmet ref rPlayerHat int WeapType 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 disablePlayerControls 0 1 0 0 0 1 1 DisableControl 16 ;VATS CC DisableControl 264 ;Mouse Wheel Up DX CC DisableControl 265 ;Mouse Wheel Down DX CC player.setScale 3.3 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 enablePlayerControls EnableControl 16 ;VATS CC EnableControl 264 ;Mouse Wheel Up DX CC EnableControl 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 End OK. From my understanding you can use quest script variables as global variables, so this makes sense. In what quest script is previously equipped armor/weapon stored?I see here where your storing the equipped armor, and helmet. set rPLayerArmor to player.getEquippedObject 2 set rPLayerHelmet to player.getEquippedObject 0 And I see here where you are attempting to re-equip the armor & helmet/hat player.equipitem rPLayerArmor 0 1 player.equipitem rPLayerHelmet 0 1 player.equipitem rPLayerHat 0 1 Again, I am no expert, but it is my understanding that unless this is a simulated global variable (e.g. a quest script variable), this variable that you created is reset every time the script ends/begins. think/thought that this occurs when the variable is initialized. I as thinking it is a local variable and it would only work within the script, and when the script ends it will be reset. Can you confirm? Link to comment Share on other sites More sharing options...
devinpatterson Posted April 16, 2014 Author Share Posted April 16, 2014 OK. From my understanding you can use quest script variables as global variables, so this makes sense. In what quest script is previously equipped armor/weapon stored?Do you have a link that expands on that, I am unaware of it being the case and would like to read up on it. Again, I am no expert, but it is my understanding that unless this is a simulated global variable (e.g. a quest script variable), this variable that you created is reset every time the script ends/begins. think/thought that this occurs when the variable is initialized. I as thinking it is a local variable and it would only work within the script, and when the script ends it will be reset. Can you confirm?Already confirmed that, and explicit stated (to the best of my knowledge) so. You can see it in the script itself when you exit the mech and your armor is re-equipped (at least mine is). If the var was zero'd out that woldn't happen, and this is an object script. So you can verify that empirically. Here is an additional example (once again a object script, not a quest script); scn VMS22LightSwitch01 ; Simple script to turn reference lights on or off through a switch to which the script attaches. ; - Jorge Short LightsOn Begin OnActivate If LightsOn != 1 MALightPod01REF.Enable MALightPod02REF.Enable MALightPod03REF.Enable MALightPod04REF.Enable MALightPod05REF.Enable MALightPod06REF.Enable MALightPod07REF.Enable Set LightsOn to 1 Return ElseIf LightsOn == 1 MALightPod01REF.Disable MALightPod02REF.Disable MALightPod03REF.Disable MALightPod04REF.Disable MALightPod05REF.Disable MALightPod06REF.Disable MALightPod07REF.Disable Set LightsOn to 0 Return Endif End Obviously the short is stored between activations. I don't mean to be harsh here, but there is an issue of time, and I'd much rather be spending it modding than burning it, going over the same ground again. Link to comment Share on other sites More sharing options...
Recommended Posts