Making a gun rack?

Post » Wed Sep 16, 2009 2:23 am

It's a pretty simple jump of logic to take an NPC and make a mannequin for displaying armor, but I was wondering: Similarly if you built a table or gun rack model with enough bones, could you assign it to an NPC and have it automatically equip say, six shotguns? Making separate NPCs isn't really feasible unless you could give them the same inventory.

Alternatively, is it possible to have a script running on the container that just places/spawns the item in the gameworld at a specific spot relative to the container's position without havoc? If so, would it be possible for the container to keep track of each item to tell if it's been taken or moved?
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Tue Sep 15, 2009 11:41 pm

dont go at it with an npc, you dont need him if its supposed to be a rack and creating an npc with hundreds of bones is for one extremely complicated and also damn annoying, prolly wont even work

you do that instead:

1-place some 1stpersonMyGun (under world objects -> statics) models on your rack (instead of MyGun you would have 10mmSMG for example)
these 1stperson models are statics and have good textures, you might want to give them a textureset if these textures are too demanding (but thats another topic)

2-you double click em and check "initially disabled", give them a distinct reference name (MyGunREF)

3-you create a new container, place it somewhere and give it a reference ID aswell (MyGunCabinetREF)

4-you give that container a script (object):

Begin OnActivateif MyGunCabinetREF.getitemcount MyGun >= 1 ;;checks if there are more than one MyGun in your gun cabinetMyGunREF.enable ;;enables the 1stpersonMyGun you placed in your rack elseif MyGunCabinetREF.getitemcount MyGun < 1 ;;checks if there is less than one MyGun in your gun cabinetMyGunREF.disable ;;disables the 1stpersonMyGun you placed in your rack endif;;(repeat both if blocks for every gun type you want it to be able to display)end


now everytime you open that container the script will check how many of the guns you included in your script are in the container and if there are more than 0 it will show the model in your rack, if not it wont be visible
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Tue Sep 15, 2009 1:00 pm



That is a very limiting method of doing things -> a gun rack should be able to hold any weapon of similar design not just one specific weapon -> this also has the inability to be compatible with other peoples weapon mods, which is most likely why he mentioned going the Mannequin route.

It's a pretty simple jump of logic to take an NPC and make a mannequin for displaying armor, but I was wondering: Similarly if you built a table or gun rack model with enough bones, could you assign it to an NPC and have it automatically equip say, six shotguns? Making separate NPCs isn't really feasible unless you could give them the same inventory.

Alternatively, is it possible to have a script running on the container that just places/spawns the item in the gameworld at a specific spot relative to the container's position without havoc? If so, would it be possible for the container to keep track of each item to tell if it's been taken or moved?


Yes, making a new creature that is nothing more Visually then a Gun Rack is possible, but its absolutely impossible to get that creature to equip more then one weapon without some heavy scripting and going this route skipping over the heavy scripting is the entire point -> well that and compatibility.

So best option would be to create a rack that looks like it only holds one gun then just create all of the anims -> the Equip/Unequip anims need 0 controlled blocks and only have 3 sequence tags "start, Attach/Detach and end" then you create the Idles they are nothing more then a single controlled node the Weapon Node and you use that to move the weapon about the Rack so each weapon type sits visually correct on the rack (it will never be perfect for every weapon created but its considerably better then scripting static weapons

----

Did I mention I did exactly this for both Oblivion and FO3 to go along with NPC Mannequins, its a very simple creature to create since it requires zero animation talent and only the very basic knowledge of how to get a http://sites.google.com/site/saidenstorm/oblivion3dsmaxcustomcreaturestutorial to not make the game crash.
User avatar
Sylvia Luciani
 
Posts: 3380
Joined: Sun Feb 11, 2007 2:31 am

Post » Wed Sep 16, 2009 1:04 am

yup hes right haha...

anyway:

jaysus method:

+ can be done completely in geck
+ is relatively easy to understand and to create
-works only for vanilla weapons or predefined 3rdparty/mod weapons
-works only in predefined locations for each individual weapon

saiden method:

+very flexible
-you need basic skills at least in nifskope, better advanced skills in 3dmax/blender aswell (much easier to place nodes there)
-lost of fiddling in trial and error until you get the correct positions
-you need one creature per weapon displayed, depending on rack design this "can" be a problem
-you still need a script if you want to put the weapons in a container, heavy scripting if its supposed to be one container, less scripting if you can only put one weapon in each container, however you wouldnt need a container, you could add a simple script to the CreatureRack itself so that it works like a container (onactivate -> open container/inventory)

your choice ;)
once youve accomplished saidens method its definately better and you learned more, it just takes longer ro learn from scratch and depending on your goal for that mod this might be a good or a bad thing
User avatar
Cameron Wood
 
Posts: 3384
Joined: Wed Oct 31, 2007 3:01 pm

Post » Tue Sep 15, 2009 3:37 pm

Cool, thanks. I'm not familiar with the terminology, but I do know modeling in general so I'll figure it out ;) I should have figured multiple weapons would be impossible. Some engines are freer about what you attach to bones, but having them count as weapons does seem pretty out there. Alternatively, it should be pretty easy to attach several to the same container and have it dole them out to the racks automatically, any idea what criteria NPCs use to decide which weapon is "best"? I suppose it's probably just damage/dps... I gave Veronica a missile launcher to hold once when she was set to melee and she pulled it out o_0. Each rack will only hold a single type anyway I suppose, so a complicated calculation isn't that important.

I assume since it wasn't mentioned that it's impossible to just dynamically spawn the item in the game world at a specific (marked?) position though? That's kind of disappointing since it'd definitely be the simplist route if it were possible, and the player could pick it up (though I suppose you'd HAVE to pick it up, since it wouldn't be in the container any more. I'd be fine with that though.)

Edit: Another bonus about spawning the item in the world is that it could be used for non-weapon trophy items, which would be neat.
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Tue Sep 15, 2009 3:22 pm

of course you can simply spawn stuff, however thell drop down if these items are the weapons you can use and not statics (Check the geck wiki for all those functions)
you also probably need to wait for the script extender to get released to check which weapon t spawn where and so on... needs some heavy scripting, therefore id say saidens method would be better than that
User avatar
saxon
 
Posts: 3376
Joined: Wed Sep 19, 2007 2:45 am

Post » Tue Sep 15, 2009 1:24 pm

I supppose I'd use PlaceAtMe on some kind of invisible marker to do that? But if you can't disable physics on them there's little point I guess. I assume it's not possible to dynamically create a static object based on a weapon reference either, so yeah, looks like the psuedo-NPC-rack is the way to go.
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Tue Sep 15, 2009 11:47 pm

-you need basic skills at least in nifskope, better advanced skills in 3dmax/blender aswell (much easier to place nodes there)


Not really you can do this with basically no NifSkope but you absolutely need the KFUpdater.

-lost of fiddling in trial and error until you get the correct positions


No need for this as you will be creating the aniamtions in 3DS or Blender you just import the weapon models and position there so its do once only.

-you need one creature per weapon displayed, depending on rack design this "can" be a problem


I only ever use these in interriors and very rarely in combat interriors so the AI slot lost is minimal at best even with 10+ of them in one area as these will not have any AI and are set up to be non-responsive to anything other then activation.

-you still need a script if you want to put the weapons in a container, heavy scripting if its supposed to be one container, less scripting if you can only put one weapon in each container, however you wouldnt need a container, you could add a simple script to the CreatureRack itself so that it works like a container (onactivate -> open container/inventory)


I use this script, it does not take into account other mod added weapons -> I personally added all of those to the creatures allowed equippable weapon Form List, though NVSE should allow you to parse the creatures inventory and add any non existing in its form list weapons with AddFormToFormList.

scn 1SSASWeaponRacksBegin OnActivate Player	OpenTeamMateContainer 1End

User avatar
meghan lock
 
Posts: 3451
Joined: Thu Jan 11, 2007 10:26 pm

Post » Tue Sep 15, 2009 6:53 pm

@nifskope
ya, as i said you can also do it in 3dmax but thats harder for a "noob" to do than in nifskope i assume, not a problem for the OP tho it seems ;)

@needs many creatures
i meant more in the sense of placing stuff, if its a rack that displays more than one you need to cut that into pieces, create a creature for each piece and assemble them in geck so that they fit again, just like tilesets but with creatures, its not a problem if its a simple board for example that only holds one weapon

@container script
thx for writing it down, was too lazy to look up to check if openteammatecontainer was the right one :P, needs you to add the creature to your team/faction tho additionally which isnt a problem of course ;)

@formlist
ya thats a problem, needs an additional esp script modification for every gun you wanna add to be compatible with it but cant be avoided due to creatures only being able to equip items of a certain formlist, dunno if the script extender has the ability to aquire all WEAP objects and use a script on them to add them automaticly or like you mentioned check for nonexisting forms and add them automaticly, i dunno if thats possible or will be, an NPC would be better but you cant give em individual skeletons :/
so we have the same problem as i do with my statics, you need to modify the script again for every mod weapon as of now :( , damn...
why the heck did they do that formlist for creatures anyway? i see no real good reason for that, they could simply have added a flag which prevents em from picking up different weapons instead and hence gained flexibility... beth -.- oh my love...
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Tue Sep 15, 2009 12:48 pm

Looking at the FOSE documentation they seem to have extensive functions for iterating through and editing formlists. I think I've said I've never gotten around to modding this engine before (Though I played Oblivion and FO3 with plenty of mods), but from the looks of it it shouldn't be a problem. There are a number of things I'll probably end up needing NVSE for anyway, so I'm not concerned.

Actually though, I might just use the static method and make it a collector's wall for all the unique weapons. Might be cooler that way than just twenty plasma rifles in a row (or whatever the most common high-damage weapon is)
User avatar
Joey Bel
 
Posts: 3487
Joined: Sun Jan 07, 2007 9:44 am

Post » Tue Sep 15, 2009 11:14 am

@container script
thx for writing it down, was too lazy to look up to check if openteammatecontainer was the right one :P, needs you to add the creature to your team/faction tho additionally which isnt a problem of course ;)


The 1 Flag on the command is specifically for opening containers of non-teammates.

@formlist
ya thats a problem, needs an additional esp script modification for every gun you wanna add to be compatible with it but cant be avoided due to creatures only being able to equip items of a certain formlist, dunno if the script extender has the ability to aquire all WEAP objects and use a script on them to add them automaticly or like you mentioned check for nonexisting forms and add them automaticly, i dunno if thats possible or will be, an NPC would be better but you cant give em individual skeletons :/
so we have the same problem as i do with my statics, you need to modify the script again for every mod weapon as of now :( , damn...
why the heck did they do that formlist for creatures anyway? i see no real good reason for that, they could simply have added a flag which prevents em from picking up different weapons instead and hence gained flexibility... beth -.- oh my love...


Going to have to agree here Usable Weapon Form Lists are a rather large pain to deal with at times, preferred Oblivion in this respect -> though Oblivion did not have weapon specific animations within each animation set either so its was an all or nothing system where this one is not.
User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Post » Tue Sep 15, 2009 11:35 am

The 1 Flag on the command is specifically for opening containers of non-teammates.


right, forgot that haha :P, but well the documentation would tell one right away ;), thx for pointing it out neverthless
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm


Return to Fallout: New Vegas