Quick Questions -- Quick Answers, The 21st

Post » Fri May 20, 2011 5:17 am

GetParentCell - returns the objectID of the parent cell of the calling reference
Then use GetName.
Will work probably - let us know :)

btw interior or exterior cell ? what is the return value in exteriors ? http://obse.silverlock.org/obse_command_doc.html

Interior cell. :)

I wasn't sure if GetName would work with cells too, but it's worth a try.
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Fri May 20, 2011 6:11 am

Is there a way to add an item to a players inventory via a script, for example player.additem XYZ, but have it have the stolen flag? I looked around a couple places but I couldn't find any functions or flags related to the object being stolen....

Thanks!
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Fri May 20, 2011 5:30 am

Create a persistent container. Set its ownership to some NPC. Add your item to the container. Remove it by calling rContRef.removeAllItems player 1
User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Fri May 20, 2011 2:42 am

Have a small problem. I have a misc inventory item which is works on a sort of charge basis. When the player activates the item, they cast a spell on themselves and the item gets swapped out with an empty version of the item. When the player goes to recharge said item, the empty is removed and they have a version which can cast a spell again. The problem is this... Since the player may be having scripted items added and removed from their inventory it would create bloat because the item scripts would remain. As the item is equipped from the inventory, it has to be scripted. Removeitem doesn't allow you to specify a container so I can't just rotate out one version at a time.

What I need is a non-OBSE solution to swapping out one scripted inventory item for another scripted inventory item within a gamemode block that doesn't create bloat. Dropme or drop would both create a new instance of that item, and I can't use the ingredient workaround.

Any ideas? Maybe some way to hide the item in the player's inventory (misc items don't have a playable flag, and you need OBSE to change that setting)? Maybe some way to visually indicate that the item needs to be recharged within the inventory screen without swapping out the item (or using OBSE)? I don't have much wiggle room here.
User avatar
Marguerite Dabrin
 
Posts: 3546
Joined: Tue Mar 20, 2007 11:33 am

Post » Fri May 20, 2011 5:36 am

Create a persistent container. Set its ownership to some NPC. Add your item to the container. Remove it by calling rContRef.removeAllItems player 1


Thanks shadeMe :)
User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Thu May 19, 2011 9:00 pm

The problem is this... Since the player may be having scripted items added and removed from their inventory it would create bloat because the item scripts would remain. As the item is equipped from the inventory, it has to be scripted. Removeitem doesn't allow you to specify a container so I can't just rotate out one version at a time.
Tried using removeMe instead ? Could you expand on the save bloat issue please - I've never noticed such bloat from just adding and removing items (duplicating, yes, but otherwise no) ?
User avatar
RAww DInsaww
 
Posts: 3439
Joined: Sun Feb 25, 2007 5:47 pm

Post » Fri May 20, 2011 1:24 am

Tried using removeMe instead ? Could you expand on the save bloat issue please - I've never noticed such bloat from just adding and removing items (duplicating, yes, but otherwise no) ?

The bloat is not caused by the item, but instead the scripts on the item which doesn't get completely removed. I havn't tested thoroughly, but as it is possible that the player might initiate this itemswap a few hundred times in the course of their playing, even a small amount of bloat would likely be bad. Unfortunately QQix's documentation on the wiki seems to be missing information related to bloat from item scripts.
http://cs.elderscrolls.com/constwiki/index.php/User:QQuix/On_Dynamic_Items_and_Savegame_Bloating
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am

Post » Fri May 20, 2011 1:35 am

Made a test mod. http://www.tesnexus.com/downloads/file.php?id=30643
Wasn't able to create any noticeable bloat, so either there isn't any, or there's a problem with my methods. I'm going ahead with that I planned to see if some sort of bloat comes out that way, but it'll be hard to tell.

Was under the impression that scripted inventory items which were added to a character would cause bloat because even if the scripted items are removed later, the script that was attached to that item still remains in memory detached from the item and can never be cleared. Was this only applying to cases when an NPC with that scripted item is removed without clearing their inventory first, or is there something I'm missing here?
User avatar
Stefanny Cardona
 
Posts: 3352
Joined: Tue Dec 19, 2006 8:08 pm

Post » Fri May 20, 2011 5:24 am

Was under the impression that scripted inventory items which were added to a character would cause bloat because even if the scripted items are removed later, the script that was attached to that item still remains in memory detached from the item and can never be cleared. Was this only applying to cases when an NPC with that scripted item is removed without clearing their inventory first, or is there something I'm missing here?
To my knowledge, the game loads bytecode (for all scripts) from each loaded mod on game start. When an object requires its script to be run, the appropriate script is added to the script processing queue.
User avatar
Carlos Vazquez
 
Posts: 3407
Joined: Sat Aug 25, 2007 10:19 am

Post » Thu May 19, 2011 7:37 pm

To my knowledge, the game loads bytecode (for all scripts) from each loaded mod on game start. When an object requires its script to be run, the appropriate script is added to the script processing queue.

Yes, but in the case of scripts on items which have variables, is everything about that particular instance of the script cleared when the item is removed? What about if the item is flagged as a quest item?
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Thu May 19, 2011 8:46 pm

. . . Unfortunately QQix's documentation on the wiki seems to be missing information related to bloat from item scripts.


Testing scripted items was my next step on the bloating tests.
I did start it, testing scripts with few variables and lots of code and scripts with lots of variables and not much code.
I did not finish the planed series of tests, but if memory serves, from the partial results, I could not detect anything different from the previous tests with unscripted items.

Anyway, I was trying to devise something to suggest to you and could not come out with any good idea.
So, I did some tests this afternoon and could not detect any bloat either.

My tests were with an Item A, scripted to, when dropped, PlaceAtMe Item B and delete itself.
Item B was scripted to, when activated, add Item A to the player inventory and delete itself.

I dropped 1.000 items and picked them up again (by script, of course) and the difference in savegame size was about 15K. This level of variance is kind of normal from savegame to savegame, so it is likely not related tp the 2000 items created in the world and deleted. But even if it were, it would be about 8 bytes per item, too small to be related to leftover scripts.

Later this week I will try moving the items to an NPC and delete the NPC, as you said.
User avatar
Blaine
 
Posts: 3456
Joined: Wed May 16, 2007 4:24 pm

Post » Thu May 19, 2011 3:37 pm

Anyway, I was trying to devise something to suggest to you and could not come out with any good idea.

Thanks for looking into it.

The only other way of doing it beyond multiple scripted items which are swapped out was to have just a single version of the item which both recorded and indicated its charged/discharged state by changing the item value of the base. As it would have been a single quest flagged item, item cost would have no particular use. The problem however is that this meaning of cost is not immediately clear and can't really be explained away as a part of plot as well as swapping out one item for a differently named item.

The mod I uploaded and linked earlier was what I would have thought to be a reasonable test despite the small cycle size. The reason is because it gives each instance of the item that is created enough time to have the scripts on the items run and record some garbage information within the script before removing the item for another group that does the same thing. When compared against a save made with a version of the same mod except without scripts attached to the items (same items and quest script) there was very little difference in save game size once both had run through roughly the same amount of time. I didn't check it with quest flagged items, or when the items were added to NPCs instead of the player, so not sure how either would affect the results. The scripting on the items however is rather small and the functions rather useless since I really didn't put much thought into it. A longer script with more variables which are being used (floats and refs) might yield more clear results.
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Fri May 20, 2011 4:40 am

I'm wondering about some math functions in scripts. What I want to do is create an Ayleid mine and refinery. Basically, what you would do is gather welkynd shards from the mine (the way you would gather gold or silver nuggets) and take them to the refinery. You would put them in a chest, press a wall switch, a spell is cast on the chest and you would have 1 blue Welkynd Stone for every 4 blue welkynd shards you put in or 1 Varla Stone for evey 10 white welkynd shards you put in. If you put in 10 blue welkynd shards, you would find 2 Welkynd Stones and 2 welkynd shards in the chest after you press the wall switch. So I'd need to store four variables in the script:

ShardBCount ; for the blue shards
ShardWCount ; for the white shards
WelkyndCount ; for the welkynd stones
VarlaCount ; for the Varla Stones

I would then need a way to set WelkyndCount to ShardBCount/4 and VarlaCount to ShardWCount/10 and make sure that any excess shards remain in the chest but I don't know how to set this up in a script, or even if that type of math is supported without OBSE.
User avatar
Sudah mati ini Keparat
 
Posts: 3605
Joined: Mon Jul 23, 2007 6:14 pm

Post » Fri May 20, 2011 2:04 am

I'm wondering about some math functions in scripts. What I want to do is create an Ayleid mine and refinery. Basically, what you would do is gather welkynd shards from the mine (the way you would gather gold or silver nuggets) and take them to the refinery. You would put them in a chest, press a wall switch, a spell is cast on the chest and you would have 1 blue Welkynd Stone for every 4 blue welkynd shards you put in or 1 Varla Stone for evey 10 white welkynd shards you put in. If you put in 10 blue welkynd shards, you would find 2 Welkynd Stones and 2 welkynd shards in the chest after you press the wall switch. So I'd need to store four variables in the script:

ShardBCount ; for the blue shards
ShardWCount ; for the white shards
WelkyndCount ; for the welkynd stones
VarlaCount ; for the Varla Stones

I would then need a way to set WelkyndCount to ShardBCount/4 and VarlaCount to ShardWCount/10 and make sure that any excess shards remain in the chest but I don't know how to set this up in a script, or even if that type of math is supported without OBSE.

Of course math is supported without OBSE. You just can't do all those nifty trig functions. It would probably look something like this.

begin gamemodeif docheck == 3    set docheck to 0elseif docheck == 2  set welkyndcount to shardbcount / 4  set varlacount to shardwcount / 10  if welkyndcount >= 1    set bremovect to welkyndcount * 4    self.removeitem  bremovect    self.additem  welkyndcount  endif  if varlacount >= 1    set wremovect to varlacount * 10    self.remove item  wremovect    self.additem  varlacount  endif  set docheck to 3elseif docheck == 1  set self to getcontainerref  set shardbcount to getitemcount   set shardwcount to getitemcount   set docheck to 2endifendbegin onactivateset wasopened == 1endbegin menumode 1008if wasopened == 1   set docheck to 1   set wasopened to 0endifend

User avatar
Soraya Davy
 
Posts: 3377
Joined: Sat Aug 05, 2006 10:53 pm

Post » Thu May 19, 2011 3:37 pm

Hi,

i am building a town and added some citywalls ("SkingradCastleWall01" and "SkingradCastleTower01"). The collision view made me see that the walkway on top is tilted. Causing myself and NPC's to float in the air while walking on the wall. Because of the collision geometry this also means that when a door marker has been placed under the tilted collision geometry, on the same height as the visual walkway, the NPC or PC will fall down into the walls and get "trapped".

I've looked around and it seems that only the Kvatch citywalls (e.g. "KvatchCitywallBend04") have a flat top on which walking is possible, but that would mean an entire new layout for my town due to the form of the Kvatch walls.

Is there any possibility to adjust the collision and make it flat for this specific piece of citywall? And if so, what program do i need to accomplish this?

Kind regards,

Wouter

Edit: If this doesn't belong here, let me know and i will create a thread for it. (It's kind of long for a quick question on second thought)
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Fri May 20, 2011 6:08 am

Hi,

i am building a town and added some citywalls ("SkingradCastleWall01" and "SkingradCastleTower01"). The collision view made me see that the walkway on top is tilted. Causing myself and NPC's to float in the air while walking on the wall. Because of the collision geometry this also means that when a door marker has been placed under the tilted collision geometry, on the same height as the visual walkway, the NPC or PC will fall down into the walls and get "trapped".

I've looked around and it seems that only the Kvatch citywalls (e.g. "KvatchCitywallBend04") have a flat top on which walking is possible, but that would mean an entire new layout for my town due to the form of the Kvatch walls.

Is there any possibility to adjust the collision and make it flat for this specific piece of citywall? And if so, what program do i need to accomplish this?

Kind regards,

Wouter

Edit: If this doesn't belong here, let me know and i will create a thread for it. (It's kind of long for a quick question on second thought)

Unfortunately, you would need to edit the collision mesh within a 3dmodeling program to adjust the positions of those sections. However, as the tileset has no corners for the walls, you may want to forgo putting any NPCs on the walls at all. The reason being that NPCs won't be able to transition from one section to another particularly easily as explained in this thread.
http://www.gamesas.com/index.php?/topic/1081107-npcs-and-door-behaviour/

You can edit the collision mesh within nifscope by changing the vertex locations of the packedtristripsshape, but you would need to manually place a collision box to block off the front of each walls as this method removes the collision face from the paraqet.
User avatar
Mimi BC
 
Posts: 3282
Joined: Sat Oct 07, 2006 10:30 pm

Post » Fri May 20, 2011 3:25 am

I'm currently trying to add items from another mod to my current house mod. (trying to fill up a 'treasury' with stuff from the Gold Coin Bagger mod.) I have the House mod set as the active since I'm editing the contents of it's cells. However, for some reason, after I save, the things I placed in the CES don't show up in game, and also do not show up after reloading the mod in the CES. Both mods are enabled in game. Am I doing something wrong?
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Thu May 19, 2011 11:39 pm

. . .
The mod I uploaded and linked earlier was what I would have thought to be a reasonable test despite the small cycle size. The reason is because it gives each instance of the item that is created enough time to have the scripts on the items run and record some garbage information within the script before removing the item for another group that does the same thing. When compared against a save made with a version of the same mod except without scripts attached to the items (same items and quest script) there was very little difference in save game size once both had run through roughly the same amount of time. I didn't check it with quest flagged items, or when the items were added to NPCs instead of the player, so not sure how either would affect the results. The scripting on the items however is rather small and the functions rather useless since I really didn't put much thought into it. A longer script with more variables which are being used (floats and refs) might yield more clear results.


I did a lot of tests (or tried to) and still cant say there is any bloat. I experienced a lot of weird behaviors from the game.

The main difficulty was that the game crashes on save when there is more than about 100 scripted items in inventories. Since the test items goes in pairs, I ended up testing with 50 items, which is not enough to change the savegame size significantly if there was any bloat.

I did test dropping 50 x Item A from inventory, PlaceAtMe 50 x ItemB, move 50 x Item A to a chest, save
The savegame size inreased
Deleted the chest with the items inside and saved
The savegame size was reduced

Tomorrow I will try with a constant flow of creation and deletion to see if there is any bloat over time.

I did check you esp and it seems to me that the test was designed OK, that is pretty much what I will try tomorrow.

I do have 5xFloats, 5xShots and 5xRefs with different contents in each object. I will also test with more variables. One of the weird things I saw today was that the game lost the variables if the number of objects went above a certain quantity.
User avatar
chloe hampson
 
Posts: 3493
Joined: Sun Jun 25, 2006 12:15 pm

Post » Fri May 20, 2011 2:36 am

*snip*

Thanks! :D I'll try that out and see how it works.
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Thu May 19, 2011 7:07 pm

Unfortunately, you would need to edit the collision mesh within a 3dmodeling program to adjust the positions of those sections. However, as the tileset has no corners for the walls, you may want to forgo putting any NPCs on the walls at all. The reason being that NPCs won't be able to transition from one section to another particularly easily as explained in this thread.
http://www.gamesas.com/index.php?/topic/1081107-npcs-and-door-behaviour/

You can edit the collision mesh within nifscope by changing the vertex locations of the packedtristripsshape, but you would need to manually place a collision box to block off the front of each walls as this method removes the collision face from the paraqet.


I have read the posts in the suggested thread. Too bad what i had in mind isn't possible. It does explain why there aren't any citywall guards in Oblivion. Thanks anyway.

Kind regards,

Wouter
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Fri May 20, 2011 1:39 am

Back with another of my "is it possible" questions.

Are there any commands that would allow you to create a mod that would change horse steering in this way: If you start a horse travelling along a preferred path grid, and then you stop using the left/right keys and instead just push forward, the horse will naturally follow that preferred grid until you alter it's course manually? This would cause the horse to follow a road while the player looks around and keeps an eye out for creatures/NPCs, or even to fight them with spells (or weapons using the upcoming DR6).
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Fri May 20, 2011 5:02 am

What is the maximum number of npc's that can be placed inside a city before the framerate drops? The npc's are scripted. (I have a fairly high-end pc.) Edit: And what is the maximum number of item one cell can hold before they are occluded from sight?
User avatar
J.P loves
 
Posts: 3487
Joined: Thu Jun 21, 2007 9:03 am

Post » Thu May 19, 2011 8:25 pm

What is the maximum number of npc's that can be placed inside a city before the framerate drops? The npc's are scripted. (I have a fairly high-end pc.)

Usually somewhere around 10 within any given scene. You may be able to do more for brief moments of time if their packages are simple (leave one interior to enter another). The problem in this case is not framerate as much as it is processing. Even with a good computer, things can get bogged down if too many things are being handled at once. Most of it is just the engine. But 10 is the general guideline for most cases.
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Thu May 19, 2011 3:55 pm

Only 10? (Or a bit more). Guess i should have asked that earlier :S. Thanks for your reply.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Thu May 19, 2011 11:22 pm

Only 10? (Or a bit more). Guess i should have asked that earlier :S. Thanks for your reply.

Depending on the complexity of the scene, what kinds of NPCs you have, and how well you need them to respond to anything, you could probably get as many as 15 within a single scene, but more than that can be pushing things into the realm of noticeable reaction/package delay.

You may have a slower framerate as well, but that's usually variable between what hardware people have, and what visual mods they have installed, so this is usually a poor measure. If people are going to complain about their framerate, they probably shouldn't be using QTP, AEVWD, Graphics pushed beyond "high" and have 15 igridstoload. Slow NPC processing however seems to be universal and non particularly dependent on hardware.
User avatar
CSar L
 
Posts: 3404
Joined: Fri Nov 09, 2007 9:36 pm

PreviousNext

Return to IV - Oblivion