Jump to content

WIP - The Companion friendly Hobbit Home


Pellape

Recommended Posts

The current bugs drives me crazy. No matter what I do to let the loops continue and not adding stuff to an array if it is 000000, it still has objects with that value. I think I take a break for evening, I did made more work around's and the sorter is working but when I now went to the next test stage, to test the 2 containers where we add stuff the sorter should ignore or let the player keep one single item off, new bugs where reported and it is that bloody 000000 object that keep coming up, no matter how many times I do check for it. Well...

 

The scrips are growing in a way I do not like really, as they soon keeps looking for more bugs than actually doing what the meaning was with the in the first place. Now... Should I continue adding checks or wait until xOBSE solves it? Bit if they do? What if the player that will use it refuses to use xOBSE?? Then the problem will still be there, well not for me... One simple solution is to force xOBSE to become a requirement or keep adding these fixes I am currently occupied with since a couple of days back.

 

To clean the whole database, would it be enough to just delete the script and add one single line:

scn PekChestSortingQUSTSCR

Start the game, making a new save and add the bloody script back complete? I mean it should flush all arrays and variables:

scn PekChestSortingQUSTSCR

float fQuestDelayTime

array_var ObjectArr
array_var ChestObjectBelongsToArr
array_var ChestArr
array_var ChestCellArr

Ref Object
Ref Chest
Ref NotAChest
Ref ChestCell

Short InitiateArrays
Short AmmountOfChests   								; Number of chests added to the database
Short State
Short ScanningChest
Short ScanningObjects
Short ObjectType
Short NumberOfItems
Short ChestExist
Short DoOnce
Short TempState
Short Button
Short Debugg
Short ChestRemoved
Short ChestIndex

I will do something different now, I add it to that Daggerfall tree I made... More problems

Edited by Pellape
Link to comment
Share on other sites

  • Replies 406
  • Created
  • Last Reply

Top Posters In This Topic

Reinventing the wheel
I did try to reinvent the wheel 2008 and failed completely. The ideas I had then was cool, but they never turned out to be realistic. Some parts where cool but I made it into a bloody LAG feast and a big mess.

The colors are mid eval inspired. The floor is ugly and would had been remade but I do like the walls, which has both an Victorian feeling and mid eval feeling to them, which was my goal at that point. I do think only 7 objects in this screenie is Oblivion originals. The shelf was made 2006, a few weeks before Oblivion came out so I tested it in Morrowind first, so I then exported it to Oblivion when the tools where available for it.

If you look closely, you will see runes at the shelf. What I wrote? I have forgotten but something smart or dumb I guess. I did the same at the painting frames. Well one frame I do remember

To the Friends of Canadian Ice.

 

She had her own forum, where we where a bunch of modders that hanged out there together, made all kind of odd stuff as well... Me, Qarl, Alien Slof, Elynda, NeilV and his wife, who I forgot the name of but she was extremely active texture maker, and some other oddies... :wink: I do message Slof time to time now as well, She is playing ESO. Such a brilliant artist. :smile: Elynda was brilliant texture maker as well and we did a couple of projects together.

50942681193_c184fb10d1_o.jpg

So what did I do wrong?

  • Everything
  • To many light sources, added soul gems under the jars to light them up and I made custom lanterns as well.
  • To complicated collisions, copied the visible objects and made them into the same complex collisions and that is extremely unvise. Stroti did the same mistakes...
  • To many scripts. Each jar has its own script
  • To big and detailed textures

​There is not much in this room. I planned the bedroom to be on a top floor to this one, with a glass floor, making it possible to see through, from all directions but I never got that far, not with all lag that I already got created. It did felt hard to flush this project as I flushed it and stopped with Oblivion. I got tired of it at this point, not allowing me to fulfill my dreams. I could remade it but then we ad no OBSE and no way to make smarter scripts and I was also locked in Morrowind thinking about how the alchemy sorter should be made. Cool screenie anyway.... Took me a while to trick Photobucket to let me have some back. It is possible to DL them, screw Photobucket, I dislike them.

Some ideas I had was odd, trying to make everything in the shape of 8, making a house called The Octagon, a house for mages and alchemy, a form of tower. The doors was a bit complex to make but also fun.

50943496121_f427eb88d4_o.jpg

Well honestly, The Hobbit Home is much cooler then my old house really. It is not necessary to make everything from scratch with Blender as now I know how to avoid lag, to avoid and prevent my previous disasters.

Edited by Pellape
Link to comment
Share on other sites

Wrong picture

I also want to add this thoughts. Have you ever been in a real renaissance castle or visit a real viking house?

 

In TES, everything is light and also in Disney's films, well in every damn Hollywood production, all rooms are light an roomy and fortunately we do not have smell when we watch it. When Sweden became its own monarchy 1523, they started to build big palaces all over the place. Visiting one is a bit claustrophobic as they are extremely dark and dusty. Just keeping such a place clean, must require a lot of resources. The furniture's where not comfortable at all. Sitting at a window bench in one castle, made my back to hurt fast. It looks cool but it is not.

 

What about the viking house? All houses in Skyrim are based on them and they look roomy and light and so cool. Where they?

 

In reality they where much smaller and very dark, filled with smoke that irritates both your noose and eyes. The smell is heavy from animal furs and this Viking house I did visit, a replica, didn't had real animals, so I can only guess how horrible it must have been. The Windows, Vindögon, was supposed to let the smoke out but I guess this was one reason why many died so young, from smoke poisoning, which is the biggest reason you die in a fire anyway, from the smoke, not the heat. I do smoke myself but not so heavy compared to the constant fog inside those old buildings. It must have been horrible really. :smile:

 

Some modern series do show those houses in a more realistic way, like Vikings and also the series about England during the Dane period, The last Kingdom. Some parts in the Lord of the rings as well, the tavern scenes at least.

 

Would we enjoyed TES and films if they where made more realistic? I guess not really... :wink: These fantasies are made for us to enjoy it. I do.

Edited by Pellape
Link to comment
Share on other sites

I did learn something new, well not really new as I did test some assembler 1998, Motorola though... And this was invented 160 years ago, by a girl named Ada and a mechanical calculation machine. What was invented was logic math: OR, AND, IF and functions

 

Well to the point.

 

I did empty the quest script, except for the scriptname, went in game, saved and added it back and what consequences did that do? What do happen when we compile stuff?

 

Well first of all: A script language is made for us to easy understand what it is we are doing which is nothing a CPU will understand at all as all it understands are simple instructions, sent to it in cycles of 8 bit in a time. A 64-bit CPU should handle 64 each cycle and maybe it does that, what do I know? I can only do it on 8-bit CPU's and we should't bother about this at all. But what did really happen when I did remove the scripts content?

 

In the machine code that every compiler make, no matter which compiler, the instructions are the same as that is the only way the CPU will understand what we really wanna do. The scripts we make, no matter if it is Oblivion, Cobalt, Python, C, basic, Q, pascal or whatever, the machine code will become exactly the same: So I have 4 scripts, no 8 scripts that points at eachothers and mainly to the quest script so when I removed it and added it back, no other script would be able to communicate with it why?

 

The pointers got wrong of course. As the variables looks the same for us, they do get a hard coded hexadeciamal address in memory, a pointer that may differ where in RAM the code ends up but it is there, even if it might be relative. The other scripts tried to call a section of the RAM that now did not exist as when I added the variables and main script back and compiled it, they got new hard coded addresses and pointers in the machine coded version so how in earth did I manage to get it working again?

 

I had to add a space in each script related to the sorter and remove it again so CSE saw something had changed and than recompile every script to get all pointers straight again. Damn... We do not ever need to do that in C as C is very stupid that way but CSE tries to be smart, and that doesn't always work as we expect it too. :D C is written in a bloody simple text editor, nothing else.

 

Well trying assembler 1998 did tought me a lot of stuff about how a CPU works, every single cycle, as when you debug it, running it a cycle in a time, you can see the flow inside the CPU, exactly what it is doing and then you can scream - EUREKA - I got this bloody crap now!!!!!!!!!! :wink: Power on, power off, 0 and 1, so simple but yet so complex but is it really? :wink: Well yes and no. The computer I did assembler was running with 1.7 Mhz and the modern multi core computers run with 3-8 Ghz or what?? Well it doesn't matter. It is impressive anyway.

Edited by Pellape
Link to comment
Share on other sites

Machine code? Watching a CPU each cycle?

When I was support technician at Chalmers University, an old professor asked me if I could make a CPU emulator for Motorola 6800 and I thought, no big deal and it sounded fun and not impossible, much funnier than support so I got started. If I knew then what I later learned, I had said: -Are you nuts??

 

I was most focused at what the real computer emulator looked like, a physical emulator with the 6800 in the middle and you could add and withdraw several modules to it containing different types of chips and gates and draw wires between them so I started Visual Basic and started to create all parts but it took so damn long time to make and suddenly the professor came into my room one day, when I almost had finished all graphics, and he told me that someone else had finished an emulator. :/

 

The hardware had 8 lamps or rather 8 red diods, showing the state of the bus and a 2 digit number display which did show us the RAM address that was currently read - (See the previous post) ;)

 

I took a look at that other emulator that was made and I did not understand how it was supposed to work as it had no graphics at all. Mine would had been more fancier but it did miss one important thing -> the core, the CPU emulation... ;) A bloody good looking empty shell, but completely useless. :D Could I really make a complete emulated Motorola 6800? I do not think so really... If I knew how it worked, I would have told that professor to piss of in the first place.

Link to comment
Share on other sites

Well, the most simple reason for why changing a script in C leaves all internal connections intact and in the CS(E) doesn't is the difference in compilation flow.

In C, when you edit a script, nothing happens immediately. You have to recompile the whole project again first, which does every file.

In the CS(E), when you save a changed script, "then" it's automatically compiled, but only the 1 script you saved, not the others. Unless you at least re-save these, too, they won't update their machine code.

 

Besides, something's giving me doubts that ObScript is really compiled into assembler for use in the game. I'd rather imagine it's another different proprietary language or code only GameBryo uses. But the result is the same. ObScript is source code, like the text files in C, and saving them starts compilation into (game) machine code.

 

Man, that's memories, designing and running primitive CPUs, with RAM and registers and all that stuff, in hardware simulators at university to get the hang of how they work. I kinda miss those times.

Link to comment
Share on other sites

Yes. I did that course after I put that emulator ideas a side, then I realized how complex the code would had become if I completed it and would had taken ages. I did miss one thing, when I think about it as it also had a 2 digit display which did show each instruction. That course was more about handeling logic mathematic, remaking statemants or making them more optimal. The hardware, playing with the real 6800 came in the end of that course that was extremely dry but the funniest part was to make the 6800 to do exactly as it was told to do, every damn cycle, 3-5 cycles for each instruction. Pushing a button to simulate 1 tiny cycle in a time. :D, 5 pushes to make a more complex instruction and 3 for the more simpler.

 

I did also claim that every language will compile the code to be the same machine code and that is not true, well almost true. No language can make the code as optimal and tiny as C and what the others languages do when you compile them? I do not have a bloody clue but they do add something more. All I know is that C only includes tiny fragments of the pre-compiled sentences. An example:

 

Lets make a simple printf and a puts compare. If we use a printf and some string content, the final exe will become 1 kb big but if we use puts instead, the final exe will become 10 kb or was it vice verse? I do not remember. Both puts and printf and every damn function are pre compiled and I guess the simplest first part the compiler are using is made with assembler or machine code, as you cant pull your self up in the air while you drag your self in your own hair. When I think about it, puts is more simple than printf right? Puts only put out a string at the standard output, like the screen, nothing else, no variables or anything else than just a string. puts ("A bloody string");

 

Well anyway, the C compiler never seems to include more than it is needed for the exe to run. I did compare some C examples between my PC, my old 386 and my Atari and the size difference was huge. The final result became much smaller on the Atari and still they produced the same crap. The PC had a 386 without FPU and the Atari a Motorola 16-bit 68000

 

Well I do not know how an esp works really. The game engine is the glue to the OS and the OS talks with the CPU. But the esp should be optimal machine instructions really. But NT will interfear as NT do not allow any programs to deal with the hardware direct as it has a part called HAL that prevents it and it will also be checked by the virus software in the middle of the execution... :/

 

The best part with this thread must be that we can write all bloody types of crap here. :D

 

Well it is time to take a walk out in the snow, visit the sadist dentist. All dentists must be sadists as they love to give the patient pain for sure. the more we scream, the happier the dentist will become.

Edited by Pellape
Link to comment
Share on other sites

I did survive the dentist visit, without any screams at least... No need to scream she told me and smiled. :wink: We will try to avoid the pain but pain is a good way to find where the tooth might be broken she said, both pain and cold.

The old odd door
When I watch my old 8 octagon double door, I do see it has so many layers of details, the one on the left side that is that was the final door version. Well we have the thin golden decorations, that should have been made much thicker and we have the wood. The dark wood parts has relief's in them, which I did find on the web and used transparent 20-50% or similar, making the texture looking more alive, like I did on my frames with the runes. I will later see if I can use that technique at other objects I will make later on. Why not add something like that at the stairs texture or will it just be disturbing? That door in the Octagon house was meant to be the front door to a mages house and the goal was to make it as fantasy like as possible or even make it impossible and unrealistic. The Hobbit Home in the other way do not have such demands. It is not built for crazy mages, well not only...

I will have this in mind for the future though.

The relif's I found, I think I colored them white as they where black, to become lighter then the dark wooden texture by the way.

So how did I make the runes at the shelves and my frames? I made a new font as there where none to be found. I typed the text with an ordinary font to see that I did spell it right and marked the text, changing to my rune font so where is that bloody font today? I do not have a clue. I did published it but at my former ISP so it is gone. I might have it on an old harddrive and if I do, my old paining exchanger might be there as well. The old Blender screenshot up in the left corner, do inform me of the path to the old stuff... :wink:

50943496121_f427eb88d4_o.jpg

 

The blue balls added to the golden parts, do catch the eye, why? Because it do remind some of eyes and that was the main idea, magic eyes.

 

Would I want to live in a house like the Octagon? No way, to claustrophobic and dark for my own taste but I am no mage, not that I am aware of at least. Would I like to have a house like the Hobbit House in RL? Yes for sure.

 

I should cut out the top of this one and add it as a paining in the Hobbit Home. :D I do add so many strange stuff there anyway.

 

50942681193_c184fb10d1_o.jpg

Edited by Pellape
Link to comment
Share on other sites

By the way Drake, i did recompiled every script, pointing the that quest.

 

To be able to compile a script, you must make a change to it, like adding a space, changing a letter, or CS will not recompile it, nor the save flag will not appear either at the top left side where the file name is written, in the bar that is.

Link to comment
Share on other sites

Sorter is complete

The sorter is now complete. It doesn't sort to 100% but it might be none stacked objects really it ignores. 10 chests added in my game and 719 objects, stuff I used to sort by hand every damn game session and no wonder I am sick and tired of doing it as it is tedious and boring.

So how is the performance?

Well it goes fast I guess. Around 3s to scan and add new stuff to the size it has now, 10 chests and 719 objects and 2s for sorting and moving them.

 

The Code?
Well lets peek at the final code. Feel free to add it to your game as you do not need the Hobbit Home to run it as it is so bloody good, that I might release it both separate and in Hobbit Home. I do not know yet. It do require 2 chests, 1 for stop scanning an object and 1 for keeping 1 item in inventory, like a tool as you do not want a stack of tools anyway. What ye gonna do with a stack of shovels, that do not even stack anyway....

First script is the main script you add to a quest and my questname is: PekChestSortingQUST

scn PekChestSortingQUSTSCR

float fQuestDelayTime

array_var ObjectArr
array_var ChestObjectBelongsToArr
array_var ChestArr
array_var ChestCellArr

Ref Object
Ref Chest
Ref NotAChest
Ref ChestCell

Short InitiateArrays
Short AmmountOfChests   								; Number of chests added to the database
Short State
Short ScanningChest
Short ScanningObjects
Short ObjectType
Short NumberOfItems
Short ChestExist
Short DoOnce
Short TempState
Short Button
Short Debugg
Short ChestRemoved
Short ChestIndex

Begin GameMode

	If ( State == 0 )
		Set fQuestDelayTime to 1
		Return
	Else 
		If ( DoOnce == 0 )
			Set TempState to State
			Set State to 100
			Set DoOnce to 1
		EndIf
		Set fQuestDelayTime to 0.005
	EndIf

	
	; Creating the Databases
	If ( InitiateArrays == 0 )
		let ObjectArr := ar_Construct Array				; The object in the chest
		let ChestArr := ar_Construct Array				; All chests
		let ChestObjectBelongsToArr := ar_Construct Array     ; Amount of objects in each chests database
		Let ChestCellArr := ar_Construct Array
		
		Message "Initializing the sorter"
		printc "PEK Sorter: Initializing the sorter"
		
		Set NotAChest to 0
		
		Set InitiateArrays to 1
	EndIf

	; Adding a container to the quest database
	If ( State == 1 )
		If eval ( Chest != NotAChest )
			If ( Chest.IsContainer == 1)
				Let ChestExist := Call PekIsChestInDatabaseFUN Chest AmmountOfChests
			
				If ( ChestExist == 0 )
					Message "Adding the Chest to the Database"
					Set ChestCell to Chest.GetParentCell
					Let ChestArr[AmmountOfChests] := Chest
					Let ChestCellArr[AmmountOfChests] := ChestCell
					Let NumberOfItems := ar_Size ObjectArr
					Let AmmountOfChests := ar_Size ChestArr
					Set ChestIndex to AmmountOfChests - 1
					
					;PrintC "Items = %.0f - Chests = %.0f - ChestIndex = %.0f ", NumberOfItems, AmmountOfChests, ChestIndex
					
					Message "Scanning the Chest"
					Call PekChestScannerFUN Chest NumberOfItems ChestIndex

					Let AmmountOfChests := ar_Size ChestArr

					Message "Chest scanned"

				Else
					Message "That chest is already in the database"
				EndIf
			Else
				Message "That is not a Container where you ussually store your items in, is it?"
			EndIf
		Else
			Message "What did you point at? I bet there is no objects stored there."
		EndIf
		
		Set State to 0
	EndIf
	
	; adding Objects to the sorter
	If ( State == 2 )
		Message "Scanning the chests for new objects"
		
		Set ScanningChest to 0
		
		While ( ScanningChest < AmmountOfChests )
			Let Chest := ChestArr[ScanningChest]
			Let NumberOfItems := ar_Size ObjectArr
			
			;Printc "Chest is %i %n - %.0f of items", Chest, Chest, NumberOfItems
			
			If eval ( Chest != NotAChest )
				If ( Chest.IsContainer == 1)
					Call PekChestScannerFUN Chest NumberOfItems ScanningChest
				EndIf
			EndIf
			
			Set ScanningChest to ScanningChest + 1
		Loop
		
		Message "Scanning is completed"
		Set State to 0
	EndIf
		
	; Sorting the stuff to containers
	If ( State == 3 )
		Message "Sit on your hands. The sorting is initiated"
		Call PekSortingStuffFUN
		Set State to 0
		Message "The Items are sorted"
	EndIf
	
	If ( State == 666 )
		Set ScanningChest to 0
		Set ChestRemoved to 0
		
		While ( ScanningChest < AmmountOfChests )
			Let Chest := ChestArr[ScanningChest]
			Let NumberOfItems := ar_Size ObjectArr
			If eval ( Chest == Object )
				Message "Removing the chest from the Sorter"
				ar_Erase ChestArr ScanningChest
				ar_Erase ChestCellArr ScanningChest
				Let AmmountOfChests := ar_Size ChestArr
			
				Set ScanningObjects to 0
				While ( ScanningObjects < NumberOfItems )
					Let chest := ChestObjectBelongsToArr[ScanningObjects]
					
					If ( Chest == Object ) 
						ar_Erase ObjectArr ScanningObjects
						ar_Erase ChestObjectBelongsToArr ScanningObjects
					EndIf
					
					Set ScanningObjects to ScanningObjects + 1
				Loop 
				
				Set ChestRemoved to 1
				Break
			EndIf

			Set ScanningChest to ScanningChest + 1
		Loop
		
		If ( ChestRemoved == 0 )
			Message "That chest is not added in the Sorter at all"
		ElseIf( ChestRemoved == 1 )
			Message "The Chest is removed from the Sorter"
		EndIf
		
		Set State to 0
	EndIf
	
	
	If ( State == 100 )
		MessageBoxEX "Before you use the sorter, remove all stolen items from your containers as this sorter will clean all items that it sorts to keep database optimal.|Stop Sorting|Continue anyway"
		Set State to 101
	EndIf
	
	If ( State == 101 )
		Set Button to GetButtonPressed
		
		If ( Button == 0 )
			Set State to 0
		ElseIf ( Button == 1 )
			Set State to TempState
		EndIf
		
		If ( Button > -1 )
			MessageBox "A tip: Soul Gems are very special: Open the House settings at the left side of the entrance door or use the House Settings spell to set how you want to handle them with sorting and looting."
		EndIf
		
	EndIf
	
End
[/code]

The Chest Scanner function

Scn PekChestScannerFUN

Ref Chest
Ref ObjectInChest
Ref ObjectInDatabase
Ref EmtpyRef

Short NumberOfObjectsCurrent
Short NumberOfObjectsDatabase
Short ObjectExistInDatabase
Short Index
Short ChestIndex

Begin Function {Chest NumberOfObjectsDatabase ChestIndex}

	Set EmtpyRef to 0
	Set ObjectExistInDatabase to 0
	Let NumberOfObjectsCurrent := Chest.GetNumItems
	
	PrintC "Scanner FUN: Items = %.0f" NumberOfObjectsCurrent
	
	While ( NumberOfObjectsCurrent > -1 )
		Set ObjectInChest to chest.GetInventoryObject NumberOfObjectsCurrent
		Set Index to NumberOfObjectsDatabase - 1
		
		PrintC "Scanner FUN: Index = %.0f" Index
		
		While ( Index > -1 )
			Let ObjectInDatabase := PekChestSortingQUST.ObjectArr[index]
			If eval (ObjectInChest == ObjectInDatabase )
				Set ObjectExistInDatabase to 1
				break
			EndIf
		
			Let Index -= 1
		Loop
		
		If ( ObjectExistInDatabase == 0 )
			If eval ( ObjectInChest != EmtpyRef ) 
				Let NumberOfObjectsDatabase := ar_Size PekChestSortingQUST.ObjectArr
				Let PekChestSortingQUST.ObjectArr[NumberOfObjectsDatabase] := ObjectInChest
				Let PekChestSortingQUST.ChestObjectBelongsToArr[NumberOfObjectsDatabase] := Chest
			EndIf
		EndIf
		
		PrintC "Scanner FUN: Database = %.0f - Object = %i %n" NumberOfObjectsDatabase ObjectInChest ObjectInChest
		
		Let NumberOfObjectsCurrent -= 1
	Loop
	
End

The Sorting function

Scn PekSortingStuffFUN

array_var DoNotSortThisArr
array_var KeepOneOfTheseArr

string_var ItemsStr

Ref Object
Ref Chest
Ref ChestObjectBelongsTo
Ref NotAChest
Ref TempObject
Ref EmptyObject

Short AmmountOfChests
Short StackSize
Short StackSizeChest
Short NumberOfItems
Short NumberOfItemsDont
Short NumberOfItemsKeep
Short Index
Short IndexItems
Short IndexItemCheck
Short SortThisItem
Short ItemType
Short KeepOneItem

Begin Function {}

	let DoNotSortThisArr := ar_Construct Array	
	let KeepOneOfTheseArr := ar_Construct Array	
	Set EmptyObject to 0
	
	Set Index to 0
	Set IndexItems to 0
	
	Set NotAChest to 0
	Let AmmountOfChests := ar_Size PekChestSortingQUST.ChestArr
	
	Let NumberOfItemsDont := PekNoSortingRef.GetNumItems
	
	; Make a databes of the items to not include in the sorting
	While ( Index < NumberOfItemsDont )
		Let Object := PekNoSortingRef.GetInventoryObject Index
		If ( Object != IsContainer )
			If eval ( Object != EmptyObject )
				Let DoNotSortThisArr[IndexItems] := Object
				Let IndexItems += 1
			EndIf
		EndIf
		Let Index += 1
	Loop
	
	Set Index to 0
	Set IndexItems to 0
	Set NumberOfItemsKeep to PekKeepOneItemRef.GetNumItems	
	
	; Make a database of Items to keep at least one of them in the players inventory	
	While ( Index < NumberOfItemsKeep )
		Let Object := PekKeepOneItemRef.GetInventoryObject Index
		If ( Object != IsContainer )
			If eval ( Object != EmptyObject )		
				Let KeepOneOfTheseArr[IndexItems] := Object
				Let IndexItems += 1
			EndIf
		EndIf
		Let Index += 1
	Loop

	Set Index to 0
	
	; Lets scan the player and move the stuff
	While ( Index < AmmountOfChests )
		Let Chest := PekChestSortingQUST.ChestArr[Index]
		Let NumberOfItems := ar_size PekChestSortingQUST.ObjectArr
		Set IndexItems to 0
		
		While ( IndexItems <  NumberOfItems )
			Let Object := PekChestSortingQUST.ObjectArr[IndexItems]
			Let ChestObjectBelongsTo := PekChestSortingQUST.ChestObjectBelongsToArr[IndexItems]
			Set KeepOneItem to 0
			;Printc "Object = %i %n - Chest = %i %n" object object ChestObjectBelongsTo ChestObjectBelongsTo
			
			;Check if the object belongs to that chest at all?
			If eval ( Chest == ChestObjectBelongsTo )
				Let NumberOfItemsDont := PekNoSortingRef.GetNumItems
				Set IndexItemCheck to 0			
				
				;Printc "NumberOfItemsDont = %.0f" NumberOfItemsDont
				
				; Check if the object is in the Do not include this chest?
				While ( IndexItemCheck < NumberOfItemsDont )
					Let TempObject := DoNotSortThisArr[IndexItemCheck]
					;Printc "Temp Object = ", TempObject, TempObject
					
					If eval ( Object == TempObject )
						Set SortThisItem to 0
						Break
					Else
						Set SortThisItem to 1
					EndIf
					
					Let IndexItemCheck += 1
				Loop
				
				Let ItemType := GetObjectType Object
				
				If ( ItemType == 38 ) 
					If ( PekHobbitHomeSettingsQST.SoulGems == 0 )
						Set SortThisItem to 0
					EndIf
				EndIf
				
				;Printc "Sort the item? %.0f" SortThisItem
				
				
				If ( SortThisItem == 1 )
					Set IndexItemCheck to 0
					Let NumberOfItemsKeep := PekKeepOneItemRef.GetNumItems
					Let StackSizeChest := Chest.GetItemCount Object
					
					Let TempObject := PekKeepOneItemRef.GetInventoryObject NumberOfItemsKeep

					;Printc "NumberOfItems = %.0f - NotIncludeObject = %i %n" NumberOfItemsKeep TempObject TempObject

					If eval ( TempObject == EmptyObject )
						Let NumberOfItemsKeep -= 1
					EndIf
					
					Let StackSize := player.GetItemCount Object
					
					While ( IndexItemCheck < NumberOfItemsKeep )
						Let TempObject := KeepOneOfTheseArr[IndexItemCheck]
						
						;Printc "Temp Object = %i %n", TempObject, TempObject
						
						If eval ( Object == TempObject )
							Set StackSize to StackSize - 1
							Set KeepOneItem to 1
							Break
						EndIf
						
						Let IndexItemCheck += 1
					Loop
					
					;Printc "StackSize = %.0f" StackSize
					
					If ( StackSize > 0 && Object.IsContainer == 0 )
						Set ItemsStr to sv_Construct "%z%n have %.0f of %n - " ItemsStr, Chest, StackSizeChest, Object
						If ( ItemType == 38 ) 
							If ( PekHobbitHomeSettingsQST.SoulGems == 2 )
								Chest.AddItemNS SoulGem5Grand5GrandSoul StackSize
							ElseIf ( PekHobbitHomeSettingsQST.SoulGems == 1 )
								Chest.AddItemNS Object StackSize
							EndIf
						Else
							Chest.AddItemNS Object StackSize
						EndIf

						Set ItemsStr to sv_Construct "%z%.0f of %n added - " ItemsStr, StackSize, Object
						
						While ( stacksize > 0 )
							Player.RemoveItemNS Object StackSize
							Let StackSize := Player.GetItemCount Object
						Loop
						
						If ( KeepOneItem == 1 )
							Player.AddItemNS Object 1
							Set KeepOneItem to 0
						EndIf
						
						
						Let StackSizeChest := Chest.GetItemCount Object
						Set ItemsStr to sv_Construct "%z%n now have %.0f of %n%r" ItemsStr, Chest, StackSizeChest, Object						
					EndIf
			
				EndIf
			EndIf
			Let IndexItems += 1
		Loop
		
		Let Index += 1
	Loop
	
	Printc $ItemsStr
	Message "See the console or Messagelogger logs for details of what has been moved to where"
	
End

A function that scrolls the database and see if the chest is already added or not and returns 1 if it is already in it.

Scn PekIsChestInDatabaseFUN

Ref Chest
Ref CompareChest

Short ChestInDatabase
Short Index
Short ChestExist

Begin Function {Chest ChestInDatabase}

	Set Index to 0
	Set ChestExist to 0
	
	While ( Index < ChestInDatabase )
		Let CompareChest := PekChestSortingQUST.ChestArr[Index]
		
		If eval ( Chest == CompareChest )
			Set ChestExist to 1
			Break
		EndIf
		
		Set Index to Index + 1
	Loop
	
	SetFunctionValue ChestExist
End

The spell script for adding chests and it should be Target or Touch and alteration 1s

Scn PekAddChestToSortingDatabaseSPLSCR

Ref Chest

Begin ScriptEffectStart

	Set Chest to GetSelf
	Chest.pms effectOpen 4
End

Begin ScriptEffectFinish

    Set PekChestSortingQUST.chest to Chest
	Set PekChestSortingQUST.State to 1

	Dispel PekAddChestToSortingDatabaseSPL
End

The spell that removes a chest from the sorter is destruction and set to 1s and is Target or Touch. It looks so damn cool when that spell effect gets the chest to have red smoke :)

Scn PekRemoveChestToSortingDatabaseSPLSCR

Ref Chest

Begin ScriptEffectStart

	Set Chest to GetSelf
	
	Chest.pms effectDisintegrateArmor 3

End

Begin ScriptEffectFinish

	Set PekChestSortingQUST.Object to Chest

	Set PekChestSortingQUST.State to 666

	Dispel PekRemoveChestToSortingDatabaseSPL
End

The spell that scan all chests. 1s on Self alteration

Scn PekAddItemsToSortingDatabaseSPLSCR

Begin ScriptEffectFinish

	Set PekChestSortingQUST.State to 2

	Dispel PekAddItemsToSortingDatabaseSPL
End

And finally the spell that starts the sorter and it is also a Self spell, 1s on Self, alteration

Scn PekSortStuffToContainersSPLSCR

Begin ScriptEffectFinish

	Set PekChestSortingQUST.State to 3

	Dispel PekSortStuffToContainersSPL
End

Took 3 days to make and a week to test and add all those bloody fixes and play some games in between as well of course. I only do this a couple of hours, to not go completely bananas and crazy...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...