Jump to content

Revolutionary ammo mod (scripting and mesh creation)


Reaper67

Recommended Posts

I've posted a similar topic before, but nothing has come of it (I did get some advice but I'm still not getting anywhere).

 

This issue will be structured in two tiers. Tier one (most important) is the script function. Tier two (less important, but still something I'd like to fix) is the creation of new meshes.

 

Tier one: The script is quite tricky, but I've begun to crack it. The complete function will be constructed of two parts: the script on the bow and a quest script. The bow script is simple, check when equipped/unequipped and add/remove arrows accoordingly. The quest script is the trick of it. Firstly, I have never made quests before so I'm a bit lost. I need to work out how to make it start and remain active before I even think about the script. That said, I need to make the script verify that the bow is equipped and continuously keep track of the number of arrows in the inventory. When the number depletes to a certain point, this script will have to add arrows to keep the number at a specific count. It sounds easy enough, but papyrus likes to make things....interesting.

 

Tier two: I would like this bow (and several things from other mods I've been working on) to have a unique mesh. I know my way around the basics of nifscope (please refrain from suggesting I use another program), but there is an issue to be hashed out. I decided to copy existing meshes and simply change their textures before saving them under a different name, in the same folder as the originals. When this process is done with objects which only have one Trishape, the CK loads them without any problems. The headache is with complex nifs (NIF objects which have two or more Trishapes). For some reason, when the same process is completed with a complex nif, the CK gives an error that says the mesh model cannot be found (this error is seen when creating a new object and loading the new mesh). If you know a solution, or where to find the solution please let me know.

 

I am greatful for any input, but please don't tell me to look up the answeres myself. Been there, done that and went in far too many circles.

Also, when you respond to this topic please start by posting whether you are focusing on Tier one, Tier two or both.

Link to comment
Share on other sites

That's exactly what I want. I don't see how it's obscure. If you are experienced in using the CK, then you can figure it out. That was my plan, and it seems as though you are familiar with modding, because you figured it out. I just didn't want anyone replying with "I saw this video somewhere that is about something vaguely similar that might help" and then find out that the video is a waste of my time.
Link to comment
Share on other sites

I thought this sounded familiar...

http://forums.nexusmods.com/index.php?/topic/944389-auto-refresh-arrows/

 

I should just go ahead and see if I can do the script with stock objects.

 

But... If all you are lacking is a constant running script to maintain the quantity of the arrows, you should apply a script to the player alias on a dummy quest. At this point tho, I suppose it is easier said than done.

 

I'll look at it because I am curious if it is possible but don't wait around for me. Feel free to try to get something working.

Link to comment
Share on other sites

Something for you to try... A mix of basic & specific CK instructions, I'm hoping that you can fill in any necessary blanks

 

1. Open Creation Kit

2. Edit & give new ID name to a bow -- confirm creation of new record

3. Edit & give new ID name to an arrow -- confirm creation of new record

4. Navigate to Character > Quest

5. Right click and select New

-- give the quest a name

-- ensure Start Game Enabled is checked

-- ensure Run Once is not checked

-- press ok to save record <-- do not skip, if you do alias data may not save

6. Locate and reopen your new quest

-- go to Quest Aliases tab

-- in large Aliases pane, right click and select New Reference Alias

7. Enter the following <-- note the Alias form may be too large for your screen, do not worry, nothing important is out of view.

-- Alias Name: Player

-- Fill Type: Specific Reference

---- Cell: any

---- Ref: PlayerRef

-- Papyrus Script section

---- click Add, select [New Script]

---- give script a name

---- extend Reference Alias

---- enter any comments/description that you wish

---- confirm & ok

-- Locate new script in Papyrus Script section

-- right click and select edit source

-- copy & paste the code from the spoilered code box

-- Compile the script

-- Save the script

-- Assign the properties <-- you may rename the property variables throughout the script to match the ID names you gave to the custom items so that they may auto-fill

---- UniqueBow gets the custom bow

---- UnlimitedArrow gets the custom ammo

---- PlayerRef will auto fill

---- arrowNum gets the amount of ammo that is initially given and maintained <-- player could retrieve the ammo and count be higher than this limit but no new given till count gets below said limit

-- If you have access to the ok button, use it. Else put cursor in Alias name and press enter to save.

8. Save plugin & test in game

 

 

 

Weapon Property UniqueBow Auto
Ammo Property UnlimitedArrow Auto
Actor Property PlayerRef Auto
Int Property arrowNum Auto
Int count
Int add

Event OnInit()
    RegisterForSingleUpdate(0.25)
EndEvent

Event OnUpdate()
    If (PlayerRef.IsEquipped(UniqueBow))
        If !(PlayerRef.IsEquipped(UnlimitedArrow))
            PlayerRef.AddItem(UnlimitedArrow,arrowNum,true)
            PlayerRef.EquipItem(UnlimitedArrow,true,true)
        Else
            add = PlayerRef.GetItemCount(UnlimitedArrow)
            While (add < arrowNum)
                PlayerRef.AddItem(UnlimitedArrow,1,true)
                add += 1
            EndWhile
        EndIf
    Else
        If (PlayerRef.IsEquipped(UnlimitedArrow))
            PlayerRef.UnequipItem(UnlimitedArrow,true,true)
            count = PlayerRef.GetItemCount(UnlimitedArrow)
            PlayerRef.RemoveItem(UnlimitedArrow,count,true,None)
        EndIf
    EndIf

    RegisterForSingleUpdate(0.25)
EndEvent

What does the script do?

When player has bow equipped:

---- if the ammo is not equipped, add some & equip

---- otherwise add ammo till predetermined amount is reached.

When player no longer has bow equipped:

---- find out how much ammo is present & get rid of it.

 

Doing it this way prevents the player from using the ammo with other weapons.

Link to comment
Share on other sites

You know, I had a feeling you would make an appearance in this topic. I greatly appreciate your thourough walk through and will be sure to give you credit when I get this beast working. It's funny, I was able to get the same effect in Oblivion with just a couple lines of code.
Link to comment
Share on other sites

Not really. I've done some dabbling with NifSkope and haven't really had issues. My biggest issues were in trying to create something new with Blender. I gave up on that.

 

If all you are wanting to do is change the texture of an existing mesh, you've got two options.

 

Option #1

Create new textures and assign it to the texture entries on the nif file itself.

 

Option #2

Create new textures

Create a texture set in the Creation Kit

Apply the texture set to the specific mesh nodes when you select the mesh on your item form.

 

I've not ran across the problem that you mentioned when changing the texture sets on existing meshes that have multiple NiTriShapes. Are you doing anything else other than changing the texture entries?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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