Jump to content

Pouches and Containers


Natterforme

Recommended Posts

Hey, I have some questions regarding containers and movable objects. I have made a money pouch of sorts and I want to do several things with it simutaniously. I want every npc to carry one with the ability to give one to a companion. I want the pouch to be a container similar to the backpack mod, which would allow items to be put in the pouch and dropped on the ground while still holding the items. I also want to be able to steal away the pouch and influence that theft through the sneak skill and the hand to hand skill. It would also be nice to activate this theft with the grap button instead of just pressing the spacebar. Finally, I want to be able to randomize the amount of gold put in each npcs' pouch so that each theft will be different in reward and will go up with said skills. Any ideas? Comments and useful feedback are all appreciated.
Link to comment
Share on other sites

1. I want every npc to carry one with the ability to give one to a companion.

Easy.

 

2. I want the pouch to be a container similar to the backpack mod, which would allow items to be put in the pouch and dropped on the ground while still holding the items.

Not sure which backpack mod you are referring to, but since the only person who would actually put items in a pouch or drop a pouch would be the player, only the one carried by the player needs to be scripted this way, so it's easy.

 

3. I also want to be able to steal away the pouch and influence that theft through the sneak skill and the hand to hand skill.

I think it's possible to make pickpocketing success chance dependent on hand to hand skill as well, but you can't do it for only 1 specific item.

4. It would also be nice to activate this theft with the grap button instead of just pressing the spacebar.

So going by your answer to my previous post, impossible.

 

5. Finally, I want to be able to randomize the amount of gold put in each npcs' pouch so that each theft will be different in reward and will go up with said skills.

 

Easy.

Link to comment
Share on other sites

1. I want every npc to carry one with the ability to give one to a companion.

Easy.

 

2. I want the pouch to be a container similar to the backpack mod, which would allow items to be put in the pouch and dropped on the ground while still holding the items.

Not sure which backpack mod you are referring to, but since the only person who would actually put items in a pouch or drop a pouch would be the player, only the one carried by the player needs to be scripted this way, so it's easy.

 

3. I also want to be able to steal away the pouch and influence that theft through the sneak skill and the hand to hand skill.

I think it's possible to make pickpocketing success chance dependent on hand to hand skill as well, but you can't do it for only 1 specific item.

4. It would also be nice to activate this theft with the grap button instead of just pressing the spacebar.

So going by your answer to my previous post, impossible.

 

5. Finally, I want to be able to randomize the amount of gold put in each npcs' pouch so that each theft will be different in reward and will go up with said skills.

 

Easy.

 

1.Great!

 

 

2. Great!

 

3. Having it only be affecting the sneak skill is fine. Hand to hand felt like it would add some realism but it would be a little unfair to be able to double dip skill increases this way. I just felt that a ninja type player might be able to take advantage of their martial arts but meh. No big loss here.

 

4. Having the pouch be stolen away by the space bar is fine, I just thought to utilize the updated grap animations more(Everything in its Place mod). Maybe after a working test mod is established, perhaps this feature can be looked into in detail and if it still turns out to be impossible then thats ok too.

 

Now the big question is...how? I dont know where to start though I do have a working model with textures ready. After I get this speedbump worked out, Ill plan on making more intricate models.

Link to comment
Share on other sites

For adding it to every NPC, you can either use the Construction Set and manually add your pouch to every NPC's inventory, or handle it with a script. I'm sure there are advantages to doing it manually, but the disadvantages are that it's really tedious, and it won't affect any mod added NPCs. So you'll want to handle it through a script.

 

Here's a rough idea of how the script should look:

 

 

scn questscript

array_var Victims
array_var TheftTime

float tempfloat

ref tempref

short tempshort
short time

Begin GameMode

if (GetCellChanged)
	let tempref := GetFirstRef 35
	while (tempref)
		if (tempref.GetItemCount moneypouch == 0)
			if eval (ar_Find tempref Victims) < 0
				tempref.AddItem moneypouch 1
				tempref.EquipItem moneypouch
			endif
		endif
	loop
endif

if (Victims == 0)
	let Victims := ar_Construct array
	let TheftTime := ar_Construct array
endif

let tempfloat := (0.6 * (Player.GetAV Sneak) + 0.6 * (Player.GetAV HandtoHand)) / (Player.GetAV Sneak)

SetNumericGameSetting fPickPocketActorSkillMult tempfloat

let tempref := Victims[tempshort]
if tempref == 0
	let time := GameDaysPassed * 24 * 60 + GameHour * 60
	let time -= TheftTime[tempshort]
	if (time >= 4320)
		ar_Erase Victims tempshort
		ar_Erase TheftTime tempshort
		let tempshort := 0
		Return
	endif
else
	ar_Erase Victims tempshort
	ar_Erase TheftTime tempshort
	let tempshort := 0
	Return
endif

let tempshort += 1

End

 

 

Every time you enter a new cell, the script will check all NPCs in the cell. If the NPC doesn't already have a pouch, and you haven't stolen a pouch from the NPC in the past 3 days, a pouch will be added and equipped to the NPC. Also, the script would modify fPickPocketActorSkillMult to a value that's also dependent on the player's hand to hand skill.

 

And this would be a rough idea on how the script for the pouch looks:

 

 

scn pouchscript

ref ownerref
ref tempref

short report
short time
short menu
short choice
short random

Begin OnActivate

if (GetActionRef == Player && GetOwner != Player)
	MessageBox "Take Gold" "Pick Up"
	let menu := 1
endif

End

Begin GameMode

let tempref := GetContainer
let ownerref := GetOwner
if (tempref == Player && ownerref != Player && report == 0)
	let report := 1
	ar_Append questID.Victims npcref
	let time := GameDaysPassed * 24 * 60 + GameHour * 60
	ar_Append questID.TheftTime time
endif

if (menu == 1)
	let choice := GetButtonPressed
	if (choice < 0)
		Return
	elseif (choice == 0)
		let menu := 0
		let random := GetRandomPercent * (Player.GetAV Sneak / 10) + GetRandomPercent * (Player.GetAV HandtoHand / 10) + GetRandomPercent
		Player.AddItem Gold001 random
		Disable
		DeleteReference
	elseif (choice == 1)
		let menu := 0
		Activate Player
	endif
endif

End

 

 

The script will report to the quest script the time that the player steals the pouch. If you activate the pouch while it's on the ground, then you get the choice of either taking the money inside, or picking it up and putting it in your inventory.

Edited by fg109
Link to comment
Share on other sites

@__@ Where do I start? How do I use this new information? Ive never added scripts to the game before so I am lost. Step by step maybe? Also, did you add these new lines this quickly? I know this stuff can get complicated. What are you? A wizard^^?
Link to comment
Share on other sites

It took me almost a whole hour to think of those. Although they'll compile just fine (assuming you have OBSE), like I said, they're rough. No doubt you'd need to change them to fit your mod.

 

And you can check the CS Wiki and TES Alliance to learn how to script.

 

EDIT: I noticed I left out something from the second script so I added it in.

Edited by fg109
Link to comment
Share on other sites

It took me almost a whole hour to think of those. Although they'll compile just fine (assuming you have OBSE), like I said, they're rough. No doubt you'd need to change them to fit your mod.

 

And you can check the CS Wiki and TES Alliance to learn how to script.

 

EDIT: I noticed I left out something from the second script so I added it in.

 

Yes, I have the most recent OBSE version. Thank you very much^^! I will look over them tomorrow and see what I can do to fit it all together. Hopefully something will come of it. Also, is it possible to randomize the item given to the npcs based on a list? I am thinking of expanding this pouch system after I getting a working copy, and it would be nice if the npcs had variety (i.e the rich have a fancier version than the poor or the bandits, nords have fur llined pouches, guards have a special one just for them that varies based on rank, etc.) and it would be nice to give players a bit of choice in their accessories. I dont think that Ill need help getting the items into shops to be sold(crosses fingers) since I am not completely new when it comes to the CS.

Link to comment
Share on other sites

If you want to do that, then you would have to create a couple of chests. Each chest should contain a different leveled list. When you activate the pouch, then based on the pouch's owner it will empty one of the chests into the player's inventory. Afterwards, it should use ResetInterior on the cell than contains the chests in order to refill the chest.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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