Jump to content

The fireweapon command


BrendonLeCount

Recommended Posts

Does anybody have any experience with the "fireweapon" command? It causes the subject to fire a projectile from whatever weapon is specified in the script, regardless of whether that weapon is equipped or even in inventory. The projectile originates from about waist height, by default, but you are supposed to be able to assign a new node for it to originate from, and I can't figure out how to do that.

 

It's for this mod, which puts the player in Liberty Prime's driver's seat:

 

http://www.fallout3nexus.com/downloads/file.php?id=11932

 

I'm trying to recreate the Liberty Prime laser, and I've got it working, but the projectile fires from the bellybutton rather than the visor.

 

From the Bethesda function description article:

 

http://geck.bethsoft.com/index.php/FireWeapon

 

The fired projectile should spawn in the middle of the ref and go straight out in the direction the ref is pointing, UNLESS it has a dummy node called "ProjectileNode" (the name is dependent on the weapon's data in the editor but "ProjectileNode" is the default). If the ref has such a node the projectile will come out of it instead.

 

My guess is that I either need to rename the node to a node that's already part of the human body .nif (though I've tried that), add the dummy node to the human body .nif (which would cause incompatibility with custom body mods), or create an invisible object that hovers right in front of the player's head, and fire the projectile from that. If there's an easier way, though, I'd love to hear it.

Link to comment
Share on other sites

The "projectile node" that can be used as an optional firing point for the fireweapon command is defined within the model (nif) of the object in question. Creatures that have embedded ranged weapons (like fire ants) and weapons themselves use this, but most other objects don't have them. You would have to edit the nif and add a new node if you want to do this and the object you are firing from does not have a projectile node to begin with. Your original post doesn't really describe fully (to me anyway) what you are firring from and what weapon you are using the fireweapon command with. That said, you can create a custom weapon and use the embedded weapon field to specify any node to fire from as long as the node you specify exists in the model you are using as the ref from which to fire. When using an object (like a helmet) to use the fireweapon command, you cannot control what direction the projectile will be fired as the projectile will emanate along a normal (perpendicular to a tangent) path from the node from which it is fired. If you added a projectile node in the correct location in the model, you could, then control the emanation point of the projectile. As an example, I used the baby rattle and a cue ball to fire flamers. I had to adjust the orientation of those objects such that the flames came out the direction I wanted (not up or backward, etc...) because I did not add a projectile node to their models.
Link to comment
Share on other sites

The "projectile node" that can be used as an optional firing point for the fireweapon command is defined within the model (nif) of the object in question. Creatures that have embedded ranged weapons (like fire ants) and weapons themselves use this, but most other objects don't have them. You would have to edit the nif and add a new node if you want to do this and the object you are firing from does not have a projectile node to begin with. Your original post doesn't really describe fully (to me anyway) what you are firring from and what weapon you are using the fireweapon command with. That said, you can create a custom weapon and use the embedded weapon field to specify any node to fire from as long as the node you specify exists in the model you are using as the ref from which to fire. When using an object (like a helmet) to use the fireweapon command, you cannot control what direction the projectile will be fired as the projectile will emanate along a normal (perpendicular to a tangent) path from the node from which it is fired. If you added a projectile node in the correct location in the model, you could, then control the emanation point of the projectile. As an example, I used the baby rattle and a cue ball to fire flamers. I had to adjust the orientation of those objects such that the flames came out the direction I wanted (not up or backward, etc...) because I did not add a projectile node to their models.

 

The mod I'm working on puts the player in the driver's seat of a brainless "Mech" version of Liberty Prime. It does this by putting the player in a suit of gorrow333's Liberty Prime armor, from his Monster Costumes mod, rescaling to match Prime's size, and doing a number of other things to make you act and sound more Prime-like. I've been trying to implement the laser cannon that fires from Prime's visor. Adding a projectile node to the player's body .nif might work, but it would mean having to create compatibility files for any other mod out there that alters the player's human body .nif.

 

I've managed to make it work, though (check the FO3Nexus link I posted above for screenshots). I use placeatme to spawn an invisible (no model specified) dummy object at the player, then use getpos, setpos, getangle, setangle, and some trig functions to move the dummy object right in front of the player's face, oriented in the direction the player is looking. I fire the projectile from that, then disable and delete it. The code is in the gamemode block of an object script, so it can be attached to any item placed in the player's inventory (which is fine for this application, but I'll need to come up with a different method for any application where there's a chance that more than one of those objects will be in existence at a given time, like with a purchasable laser helmet). It fires, there's no auto aim but it hits what the cursor is pointed at. If you do create a projectile node, does it then take advantage of auto-aim?

Link to comment
Share on other sites

I don't believe fireweapon will ever take advantage of auto-aim as there is no AI to use to determine who the combat target is. What you are already doing is about as good as it will get in that you are coding your own version of AI to target the fireweapon in the direction of the cursor. To take advantage of auto-aim, the projectile would need to be fired from an embeded weapon of some form of creature that is in combat along with the player. That would be cool to figure out, cause the player could be firing at one target, while the visor-creature is firing at another.
Link to comment
Share on other sites

That it would. I use an auto-aim disabler myself anyway (although those don't do it quite as effectively), but something like the predator's shoulder cannon or self-guided shoulder missiles would be cool. I just recently tried out Oblivion, and the protector creatures you can summon are basically the same thing, except they go about their own business after being spawned instead of having their position linked to the player's.

 

I'm actuating the laser via FOSE's getkeypressed, so you can fire the laser at the same time that you're firing another weapon, but you can't simultaneously target two different enemies. Having the option to switch between manual control and autotargeting would be awesome.

 

One potential problem - in order to look right, the projectile needs to originate from right in front of whatever visual prop is supposed to be firing it. If the visor creature decided to target something behind you, the projectile would pass through your head, killing you. Maybe the AI already prevents that though (I can't remember ever being shot by one of my companions).

Link to comment
Share on other sites

I'm no modeller, but if one could make a tiny, invisible, non-talking, imobile except for turning creature, then that creature could be placed atop the player and rotate around to fire without hitting the player. Their combat style cound include the ability to not attack using explosives if allys might get hurt. One could start with a Mr. Gutsy as they already fly, just remove the visuals, shrink it, and make them always 'fly' right above the player, then change their weapons to yours. But that's just a guess.
Link to comment
Share on other sites

You can use getpos and setpos on creatures, so I'm guessing if you had a gamemode script that repeatedly relocated the object to a position fixed relative to the player, it would be stuck there regardless of whether it could move or fly. You could position it above your head so that it could hit stuff in any direction, and from 1st person view it would look OK, but to look right in 3rd person it would really need to be right at the spot where the projectile is supposed to be originating from. That means either having a model of a weapon sprouting from your head or shoulder, or having the projectile originate from the location of your eyes or a gadget stuck to your helmet (the BOS helmets have plenty).

 

I think if you borrowed whatever script or AI package prevents your followers and allies from friendly firing (it might just be default behavior for anything not hostile to the player), that would be enough to prevent it from turning around and blowing a hole through your head regardless of where it was located.

 

Turrets are creatures, and are also incapable of movement. Looking through their data, there's an "Immobile" flag that can be set on the animation tab. So an invisible turret (just set scale to 0.001?) with friendly AI and a position update script might be it. Giving explosives to followers though is usually dicey, so you'd probably have to write your own friendly fire prevention code for AOE weapons.

Link to comment
Share on other sites

It sounds like you are well on your way then. The turret idea does sound like a good place to start. Just watch for collision issues. I say this because a while back someone asked me to help them make a mini soccer match in Fallout. I was experimenting with placing a tiny raider chick next to a toy ball using SetPos. It ended up being quite hilarious as the raider chick would spout her dialogue even though you couldn't see her and her collision kept interfering with the ball such that the ball would fly around randomly like a super-ball saying stuff like "You want to be my new boyfriend"
Link to comment
Share on other sites

I'm facing a collision issue right now - if you exit prime while in a cluttered area, the static prime model that is placed in the location you were standing doesn't seem to be created, or something, which dumps you out of my script. I'll either need to rethink how I handle that part, or issue a warning that you need to be careful to dismount in a relatively level, uncluttered area. I'm hoping I can at least create some kind of error handling, maybe based on whether the reference object I use to keep track of the spawned prime object contains a valid reference.

 

As for the turret, I haven't tried it out yet, but apparently the trig functions I would need to use to keep it in the right location relative to the player are really slow, and not supposed to be executed every frame. I'm hoping I can get around that by updating the thing's position only once every 5 or ten frames - only its projectile is visible, so it shouldn't be too horrendous visually. As for colliding with the player, I think I can set the turret's base scale to something really small to make that easier to avoid. I'm also hoping the small scale, or the Invulnerable flag, will keep the invisible turret from blocking shots that would otherwise hit the player in the head.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...