Script function to get weapon currently equipped?

Post » Sat May 28, 2011 10:17 am

I have a flashback where the player walks into a room, the screen whites out, and fades back in and they are in another place. They are instructed by someone to shoot some prisoners (tied up infront of them) and once they do the flashback ends. The only issue here, is I am going to have it equip a 44 magnum, so they use that to shoot htem, and having unlimited ammo for that short period and such. So when they leave the flashback, they will have no weapon equipped, which might kill the immersion a little bit. So, is there a script command I can use to get the ID of the EXACT weapon they have equipped? So that after the flashback I can re-equip that weapon, and they are none the wiser. Does this exist? I have barely used FOSE so I am note sure if it does or not. Thanks for any help.

Gunmaster95
User avatar
Jessica Stokes
 
Posts: 3315
Joined: Fri Jul 28, 2006 11:01 am

Post » Sat May 28, 2011 10:52 am

http://fose.silverlock.org/fose_command_doc.html#GetEquippedObject will work for the weapon, then you will need to use http://geck.gamesas.com/index.php/GetWeaponHealthPerc saved as a variable. Then when you add the weapon back you can use http://fose.silverlock.org/fose_command_doc.html#SetEquippedCurrentHealth to return the weapons previous health.
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Sat May 28, 2011 6:36 am

Alright that should just about do it... However since it technically wont be the exact same weapon, I should remove it alltogether, then add a brand new one right? not just unequip it, or they would suddently have 2. The only thing there is then it wont be hotkeyed anymore, but I guess I can deal with that. Also could I use http://geck.gamesas.com/index.php/SetWeaponHealthPerc instead of http://fose.silverlock.org/fose_command_doc.html#SetEquippedCurrentHealth if I wanted?
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Sat May 28, 2011 11:32 am

Ya, you can just unequip it after setting the reference variable with GetEquippedObject. Then there is no need to check the health percent as you are not removing it (not sure why I thought you wanted to remove it). Then just equip it using the same reference variable. That will preserve the hot keys also.

As far as I know SetWeaponHealthPercent changes the base value of the weapons health, affecting all other instances in the game.
User avatar
Guy Pearce
 
Posts: 3499
Joined: Sun May 20, 2007 3:08 pm

Post » Sat May 28, 2011 2:45 pm

Oh thats awsome. So if they have, say like 3 assault rifles it will equip the exact same assault rifle out of the three? Or will it just equip one of them at random?
User avatar
Dan Stevens
 
Posts: 3429
Joined: Thu Jun 14, 2007 5:00 pm

Post » Sat May 28, 2011 1:38 pm

According to the wiki it will equip the lowest health percentage one (guessing that's not exactly what you want). If you do remove it, then later add it back and equip it in the same frame it should equip the newly added weapon. Then you can use the fose function to set it's health, however if the player only had one instance of the gun then their hot key would be lost. I guess you could check the item count on the weapon and use the appropriate method, ie; player has only one then unequip it, player has more than one, remove it.
User avatar
luis ortiz
 
Posts: 3355
Joined: Sun Oct 07, 2007 8:21 pm

Post » Sat May 28, 2011 1:55 pm

Ok I will do that. Detect the amount, then do one of those two things. Thanks so much for all the help! I will write the script now (as I was putting it off till this was figured out) and let you know if anything goes wrong. :)
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Sat May 28, 2011 12:59 pm

Just so you don't run into any surprises like I did recently - the value you give when using SetEquippedCurrentHealth isn't a percentage. Lets say the weapon, in the Geck, has a health of 200. If you do:
SetEquippedCurrentHealth 50 5
you end up with a weapon at 25% health.
User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am

Post » Sat May 28, 2011 4:35 pm

So then this will not work, since GetWeaponHealthPerc returns a percent... so how would I know what the weapons total health is? This is why I think http://geck.gamesas.com/index.php/SetWeaponHealthPerc would work, since it would set it to that percent. I dont think it actually changes any stats to the weapon, just the percent of health the current one has. So I will try it with this.

EDIT: Ok after looking at alot of things, I think I will just get the weapon, then equip that one, be it the same exact one, or one of different condition. The player shouldnt really notice, and if they do its an easy fix for them. But if they only have one, then its no problem at all.
User avatar
Mylizards Dot com
 
Posts: 3379
Joined: Fri May 04, 2007 1:59 pm

Post » Sat May 28, 2011 5:27 am

There's also GetEquippedCurrentHealth, and SetEquippedCurrentHealth that should be more along the lines of what you need.
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Sat May 28, 2011 4:01 pm

As long as you use - Either - the two non FOSE functions, or the two FOSE functions, you should be ok for what you want to do.
User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Sat May 28, 2011 8:02 pm

Hrmmmm.... Alright, for the sake of setting this up, I am simply going to have it equip the same type of object, be it the same one or not, which will also maintain the hotkey. Then once I have it all set up, I will see what I can add to have it return their weapon better. Would there be a command for getting what hotkey (if any) a weapon is, and setting it? Because then I can just unequip it no matter what, then set it back to that hotkey when it is re equipped right?
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Sat May 28, 2011 5:58 pm

FOSE has a http://fose.silverlock.org/fose_command_doc.html#GetHotkeyItem function, but there is currently no way to set one of these hotkeys via script.

Cipscis
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Sat May 28, 2011 3:50 pm

Oh ok, and that returns for a specific slot too, so ohh well. I will leave it rather simple for now. Thank you everyone for all of your help!!! You saved me so much time of searching for these commands on my own. I will be back if something doesnt work for some reason, but I think I have it all set up.

Cheers!

Gunmaster95
User avatar
Brandon Bernardi
 
Posts: 3481
Joined: Tue Sep 25, 2007 9:06 am

Post » Sat May 28, 2011 10:29 am

Ok, I have a slightly related question. So far with my script the unequiping the weapon part works, so re equiping it should work fine, but I have another thing I would love. Is there a command somewhat like the opposite of forcing the player to holster their weapon with the flag in DisablePlayerControls? I would like it to force the player to bring their weapon up. Otherwise they might stand there wondering what to do for a while if I dont make it obvious they have a gun in their hands and they should be using it. :P So far all I do is disable all controls but looking (and at that point take away their gun, and give them my special one),then once the evil guy leaves (since I dont want them to be able to shoot him) it enables on their fighting flag, so they can shoot. Except all other things are still disabled, so it may not be obvious they should pull out the gun and use it. So enough rambling, in short, is there a command to force the player to bring their weapon up?
User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Sat May 28, 2011 9:50 am

Hmm... You got me on that one. I don't know if UseWeapon will work with the player, and then, I don't know if it will work if the number of shots fired is set to 0. You could try to get the player to play an idle that does this. Or you might want to just display a little timed message in the upper left corner of the screen warning the player somehow. I dunno.
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Sat May 28, 2011 7:08 pm

You could try using FOSE's http://fose.silverlock.org/fose_command_doc.html#TapControl.

Cipscis
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Sat May 28, 2011 4:25 pm

Hmm TapControl does not work. I said TapControl 256 which should be left mouse, but nothing happens. I even tried putting a .1 second timer in between the enabling of fighting, and the 'raising of the gun'. But no cigar.

Also, I have 3 people standing infront of the player, enabled when he is moved there moments earlier, that should be tied up (using FFCaptiveMarker) but they just stand still and dont do the anim of being captive. How will I get this to work? I have a package on each one telling them to sandbox 0 units away from the markers, that should make them 'use' them right? Maybe I should call evp to make sure...

EDIT: I just tried using EVP in the console ingame, they still did not sit down and be tied up... what am I doing wrong here?
User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Sat May 28, 2011 2:50 pm

You're thinking of http://fose.silverlock.org/fose_command_doc.html#TapKey. http://fose.silverlock.org/fose_command_doc.html#TapControl uses a different enumeration scheme - in this case you'll want to use 4 for attack:[code]TapControl 4 ; Attack[/url]

Cipscis
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Sat May 28, 2011 6:13 pm

Ahh ok, I just looked down till I found Left Mouse Button. I will try 4 instead and see how that works. :P

Any clue what I am messing up with the packages though?
User avatar
patricia kris
 
Posts: 3348
Joined: Tue Feb 13, 2007 5:49 am

Post » Sat May 28, 2011 5:56 pm

Alright, 4 works perfectly. :P Thanks so much to everyone, as I have the whole weapon thing pretty much figured out and done. Now all that remains is these damn NPC's that refuse to do what I tell them to. -_-
User avatar
aisha jamil
 
Posts: 3436
Joined: Sun Jul 02, 2006 11:54 am

Post » Sat May 28, 2011 8:14 pm

Hmm TapControl does not work. I said TapControl 256 which should be left mouse, but nothing happens. I even tried putting a .1 second timer in between the enabling of fighting, and the 'raising of the gun'. But no cigar.

Also, I have 3 people standing infront of the player, enabled when he is moved there moments earlier, that should be tied up (using FFCaptiveMarker) but they just stand still and dont do the anim of being captive. How will I get this to work? I have a package on each one telling them to sandbox 0 units away from the markers, that should make them 'use' them right? Maybe I should call evp to make sure...

EDIT: I just tried using EVP in the console ingame, they still did not sit down and be tied up... what am I doing wrong here?


In the package do you have 'Furniture (other than beds) clicked? Because FFCaptiveMarker is a furniture marker .
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Sat May 28, 2011 7:08 pm

Bethesda used a travel package with the FFSCaptiveMarker as the target (using it as a linked reference). Then in the NPC script it checks if they are sitting and sets them restrained so that they don't get back up, and ignorecrime. Have a look at FFSupermutantCaptive for the scripting.
User avatar
Elena Alina
 
Posts: 3415
Joined: Sun Apr 01, 2007 7:24 am

Post » Sat May 28, 2011 8:43 pm

In the package do you have 'Furniture (other than beds) clicked? Because FFCaptiveMarker is a furniture marker .


I tried this when the package was sandbox, and it did not work. But now they are travel like the normal captives.

Bethesda used a travel package with the FFSCaptiveMarker as the target (using it as a linked reference). Then in the NPC script it checks if they are sitting and sets them restrained so that they don't get back up, and ignorecrime. Have a look at FFSupermutantCaptive for the scripting.


The problem is not they are getting back up, its that they are not sitting down. They simple stand where I place them in the geck, and dont move. I need to get them to sit down in the first place. I have a travel package for each of them, with the marker as its target, so its even more specific than the general FFSupermutantCaptives package that uses the linked ref, which I tried originally, and which did not work either... :/
User avatar
Jamie Lee
 
Posts: 3415
Joined: Sun Jun 17, 2007 9:15 am

Post » Sat May 28, 2011 4:57 pm

NPC pathing issue, dirty save issue???
User avatar
Gen Daley
 
Posts: 3315
Joined: Sat Jul 08, 2006 3:36 pm

Next

Return to Fallout 3