Can this be done through script?

Post » Tue May 17, 2011 2:39 pm

Recently I discovered that I can flag books so that I can't take them and put them in my inventory. Unfortunately that option is not available for things like Misc Items and cheap clothing. With all the worthless clutter in the game, it doesn't really make any sense that I can still pick up an item that has absolutely no value, or very little. So I'd like to turn off the ability to pick those things up at all, essentially turning some Misc. Items and clothing etc. into Statics. I was wondering if that can be accomplished by adding a script to those items, which would disable the little hand that appears and prevent me from picking the item up.
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Mon May 16, 2011 11:42 pm

I think if you give the items a script with an empty onactivate block, you won't be able to pick them up (but the little hand will still show up).
User avatar
BaNK.RoLL
 
Posts: 3451
Joined: Sun Nov 18, 2007 3:55 pm

Post » Tue May 17, 2011 6:28 am

why not just give the items value instead ?
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Tue May 17, 2011 7:20 am

Perhaps try http://cs.elderscrolls.com/constwiki/index.php/SetDestroyed?
User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm

Post » Mon May 16, 2011 11:42 pm

why not just give the items value instead ?


It's already way too easy to make a bunch of gold, why add to the problem? I don't want to be spending all my time picking up pointless loot and ending up being encumbered within 5 minutes, then spending half an hour unloading all my stuff at some merchant. There's plenty of stuff to be had just by looting corpses and going through containers, I don't need to fill up my inventory with worthless clutter as well.
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Tue May 17, 2011 5:59 am

I think if you give the items a script with an empty onactivate block, you won't be able to pick them up (but the little hand will still show up).


That's not really what I want. I don't even want to see the hand. I want it to look like those items are nothing more than Statics, even though they're actually Misc. Items.

@ SomeWelshGuy

I had a look at that but it seems like it only works for activators, not regular objects. The description was pretty vague though, I wouldn't have a clue how to work with it.
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Tue May 17, 2011 6:53 am

I had a look at that but it seems like it only works for activators, not regular objects. The description was pretty vague though, I wouldn't have a clue how to work with it.

It works for pick-up-able items too.
You don't really want to add a script to every low-value item in the game though, do you?
User avatar
Markie Mark
 
Posts: 3420
Joined: Tue Dec 04, 2007 7:24 am

Post » Tue May 17, 2011 8:08 am

Well, you could script a 'token' that checks your inventory for the low value items and removes them.
Or a quest script that does the same thing.
User avatar
lucile
 
Posts: 3371
Joined: Thu Mar 22, 2007 4:37 pm

Post » Tue May 17, 2011 7:09 am

It works for pick-up-able items too.
You don't really want to add a script to every low-value item in the game though, do you?


Every 0 value item. I don't see the point in being able to pick them up if they're not even worth anything. But I don't have a clue how to work that into a script. The Wiki page didn't leave a lot for me to work with, just a vague description of what it does. I really svck at scripting.

Well, you could script a 'token' that checks your inventory for the low value items and removes them.
Or a quest script that does the same thing.


That would completely defeat the purpose of what I have in mind. I don't want to be able to pick them up in the first place. Basically I want certain Misc. Items to respond just like Statics do in the game. The only difference would be that they can sometimes appear in containers, whereas Statics can't.
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Tue May 17, 2011 9:39 am

If it can show up in a container, then there is no way to 'not' take it without making it invisible in the first place. Like 'not playable' or removing the name.
User avatar
Lavender Brown
 
Posts: 3448
Joined: Tue Jul 25, 2006 9:37 am

Post » Tue May 17, 2011 1:02 pm

SetDestroyed looks like it should work. Here's a really straightforward quest script you can try. (Requires OBSE, and the script needs to be attached to a quest)

scn YourQuestScriptfloat fquestdelaytime  ;set it to 0.01 to make sure this script runs every frameref CrosshairRef       ;what you're looking atbegin gamemodeset fquestdelaytime to 0.01set CrosshairRef to getcrosshairrefif CrosshairRef			  if crosshairref.isactivatable    if crosshairref.isactor == 0      if crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0        crosshairref.setdestroyed 1      endif    endif  endifendifend


Or, instead of using getcrosshairref, you can use a getfirstref/getnextref loop to find all the nearby references.

Or, you can try this complicated mess:
- Record your position and the direction you're facing (getpos, getangle)
- getcrosshairref to get the reference of what you're looking at
- Make appropriate checks: isactivatable, isactor, getgoldvalue
- If it's an object you don't want to be able to take, setnumericgamesetting iactivatepicklength 0 so that you can't pick it up
- Reset your iactivatepicklength if you move or look in a different direction
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Tue May 17, 2011 6:21 am

Thanks, I'll try that script. I'll be sure to let you know how it works out.

PS: I'm getting an error message on line 13:

Missing Parameter Integer

Never mind, for some reason that 1 didn't get copied.

PS: You my friend are a genius. It works! I just tested it on a ball of yarn and the little hand didn't come up. I'm not sure how it will effect stuff in containers but who cares. If it's worthless junk anyway, the container may as well be empty. I'll be sure to give you full credit when I upload it to the Nexus. I'm sure alot of people would appreciate a simple little mod like this. I'm going to be naming it Worthless Junk Be Gone.

Well the Nexus will have to wait. It's gone really, really slow for some reason. I just don't have the patience. Odd because the Fallout side works fine.

Oops, I spoke too soon. It kills the grab hand on all 0 value items, incuding containers. I can't open anything up now. Good thing that the Nexus crapped out on me.

OK fixed. I added exceptions to containers and flora like you did with actors and they're working again. I'll have to play with this awhile to make sure that other things aren't accessable.
User avatar
Beth Belcher
 
Posts: 3393
Joined: Tue Jun 13, 2006 1:39 pm

Post » Tue May 17, 2011 3:40 am

Good catch on the containers and flora. Now I'm wondering if you have to check out other items like doors, keys, lights, etc. Credits to SomeWelshGuy and scruggsy too cause I wouldn't have written that up if they didn't mention setdestroyed.
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Tue May 17, 2011 10:43 am

Now I'm wondering if you have to check out other items like doors, keys, lights, etc.


Yes doors are affected as well. Basically anything that has an activator icons can't be interacted with. Which brings me to a problem I've run into. Here's the exceptions I've added:

scn a2zWorthlessJunkQuestScriptfloat fquestdelaytime  ;set it to 0.01 to make sure this script runs every frameref CrosshairRef       ;what you're looking atbegin gamemodeset fquestdelaytime to 0.01set CrosshairRef to getcrosshairrefif CrosshairRef			  if crosshairref.isactivatable    	if crosshairref.isactor == 0	if crosshairref.iscontainer == 0 	if crosshairref.isflora == 0	if crosshairref.isdoor == 0	if crosshairref.isactivator == 0	if crosshairref.isfurniture == 0	if crosshairref.isquestitem == 0        if crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0        crosshairref.setdestroyed 1endifendifendifendifendifendifendifendifendifendifend


The problem is that the game won't let me add any more exceptions. Apparently I've reached a nesting limit with the script, and there's still at least half a dozen item types that I would like to include. I never even thought about lights either, wouldn't they be covered under activators? Things like keys and books etc. aren't that much of a problem with my own game since I can simply add a value to them. But it's possible it might break some mod if someone else were to use this. Do you know of a way around this limit, like maybe setting up a second nest to include the item types I couldn't fit in? If you could point me to a Wiki page that deals with those exceptions it might be helpful. Maybe I could find a broader category I can use. There's some item types the game just won't recognize. For instance, I tried to set it up so that only Misc. Items were affected by the mod but it doesn't acknowledge that category. Other than all that though, it's working beautifully. Those worthless items are responding just as if they were statics. It's exactly what I was looking for, if I can get around this limitation somehow.

PS: Well lights aren't a big problem for the main game since I can add a value to them, but mods might have an issue.
User avatar
Riky Carrasco
 
Posts: 3429
Joined: Tue Nov 06, 2007 12:17 am

Post » Tue May 17, 2011 8:14 am

For many checks you may want to use combined comparisons (&& in particular for you case).

Try something like this:
if CrosshairRef				if crosshairref.isactivatable    		if crosshairref.isactor == 0 && crosshairref.iscontainer == 0 && crosshairref.isflora == 0 && crosshairref.isdoor == 0			if crosshairref.isactivator == 0 && crosshairref.isfurniture == 0 && crosshairref.isquestitem == 0        			if crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0					crosshairref.setdestroyed 1				endif			endif		endif	endifendif

User avatar
Laura Tempel
 
Posts: 3484
Joined: Wed Oct 04, 2006 4:53 pm

Post » Tue May 17, 2011 1:56 am

Cool. But why have you separated all the variables? Couldn't you just keep going && until you had all the categories included, or is there some sort of limit to the string you can have? I knew I should have waited before I spent a couple of hours adding value to all the keys and books before I could make it back here. :facepalm:

Oh wow, this is working perfectly! Thanks guys. I sometimes get a momentary flash of the grab hand but then the 0 value item behaves just like a static. Quite often I see nothing at all. I'll have to take a good look at that Wiki page to see what types of items I should exempt. Keys most definitely. It could certainly break someone's mod if the player wasn't able to pick up a key that was lying around.

I've decided not to upload this as a standalone mod, I'm going to include it with this item ownership mod I've been working on lately. I think this fits in very well with it. Which brings me to a problem someone might be able to help me with. I've added ownership flags to a bunch of items that normally don't have them. But by doing so, those items will no longer stack when they go into my inventory. If I drop them into another container then they'll stack with each other, but not with items that haven't been altered. Does anyone know of a way around this, like maybe a script that will force those items to stack? It's a pretty minor problem but it can be a bit irritating.
User avatar
NeverStopThe
 
Posts: 3405
Joined: Tue Mar 27, 2007 11:25 pm

Post » Tue May 17, 2011 5:54 am

But why have you separated all the variables?

For read-ability reasons. It's good to have a view for the whole script at once (or at least on most of it). This way you can spot any errors more quickly without any needs of scrolling, etc. It is also a good programming practice to not put too many different comparisons on the same if statement for efficiency.
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Tue May 17, 2011 9:11 am

That makes sense. So this is what I've ended up with. I'm basically trying to kill the grab hand on only the 0 value Misc. Items. I think I have it all pretty much covered, but if anyone can think of something I missed let me know:

scn a2zWorthlessJunkQuestScriptfloat fquestdelaytime  ;set it to 0.01 to make sure this script runs every frameref CrosshairRef       ;what you're looking atbegin gamemodeset fquestdelaytime to 0.01set CrosshairRef to getcrosshairref			if CrosshairRef				if crosshairref.isactivatable    		if crosshairref.isactor == 0 && crosshairref.iscontainer == 0 && crosshairref.isflora == 0 && crosshairref.isdoor == 0 && crosshairref.isammo == 0		if crosshairref.isactivator == 0 && crosshairref.isfurniture == 0 && crosshairref.isquestitem == 0 && crosshairref.isbook == 0        	if crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0 && crosshairref.iskey == 0 && crosshairref.issigilstone == 0 && crosshairref.iscreature == 0		if crosshairref.islight == 0  && crosshairref.ispotion == 0 && crosshairref.isarmor == 0 && crosshairref.isclothing == 0		if crosshairref.isweapon == 0 && crosshairref.isingredient == 0 && crosshairref.issoulgem == 0 && crosshairref.isapparatus == 0	crosshairref.setdestroyed 1endifendifendifendifendifendifendifend

User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Tue May 17, 2011 9:10 am

but if anyone can think of something I missed let me know:


My first thought was that it would be good to ask in OBSE thread for direct implementation of IsMiscItem command ;D

Then you could use something like this:
if CrosshairRef				if crosshairref.isactivatable    		if crosshairref.IsMiscItem == 1 && crosshairref.isquestitem == 0 && crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0			crosshairref.setdestroyed 1		endif	endifendif

User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

Post » Tue May 17, 2011 11:36 am

My first thought was that it would be good to ask in OBSE thread for direct implementation of IsMiscItem command ;D
You can achieve what you want with the versatile GetObjectType command. It returns an integer telling http://obse.silverlock.org/obse_command_doc.html#Form_Type_IDs it is, and the mod can just check for the types of interest:


if CrosshairRef				if crosshairref.isactivatable		let type = crosshairref.GetObjectType    		if type == 27      ; 27 = misc. Just add " || type = ##" for any additional types to check for			if <...add any checks for quest item etc. here>				crosshairref.setdestroyed 1			endif		endif	endifendif

User avatar
Lou
 
Posts: 3518
Joined: Wed Aug 23, 2006 6:56 pm

Post » Tue May 17, 2011 1:52 pm

oh, nice... that info should be definitely useful for Belanos then...

Though I presume that type returns that number for all misc objects, no matter what their value is, and whether its a quest item or not, right?
If that's so, then checks for no value stuff, and quest items need to be added to the script as well.
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Tue May 17, 2011 5:02 am

oh, nice... that info should be definitely useful for Belanos then...

Though I presume that type returns that number for all misc objects, no matter what their value is, and whether its a quest item or not, right?
If that's so, then checks for no value stuff, and quest items need to be added to the script as well.

True.
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Mon May 16, 2011 11:10 pm

You can achieve what you want with the versatile GetObjectType command. It returns an integer telling http://obse.silverlock.org/obse_command_doc.html#Form_Type_IDs it is, and the mod can just check for the types of interest:


if CrosshairRef				if crosshairref.isactivatable		let type = crosshairref.GetObjectType    		if type == 27      ; 27 = misc. Just add " || type = ##" for any additional types to check for			if <...add any checks for quest item etc. here>				crosshairref.setdestroyed 1			endif		endif	endifendif



Well cool. That certainly simplifies things. Thank you.

So I'm getting an error message when trying to save the script regarding the "type = crosshairref.GetObjectType" line: "Expected assignment in Let statement"

This is how I'm using it:

scn a2zWorthlessJunkQuestScriptfloat fquestdelaytime  ;set it to 0.01 to make sure this script runs every frameref CrosshairRef       ;what you're looking atbegin gamemodeset fquestdelaytime to 0.01set CrosshairRef to getcrosshairref			if CrosshairRef				if crosshairref.isactivatable		let type = crosshairref.GetObjectType		if type == 27 			if crosshairref.isquestitem == 0        		if crosshairref.getgoldvalue =http://forums.bethsoft.com/index.php?/topic/1120466-can-this-be-done-through-script/= 0 	crosshairref.setdestroyed 1endifendifendifendifendifend

User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Tue May 17, 2011 1:59 am

I think you need two equals signs on your let line.

let type == crosshairref.getobjectype
User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm

Post » Tue May 17, 2011 10:54 am

You need two equals signs on your let line.

let type == crosshairref.getobjectype

No, it's an assignment, not equality check, so it should be ":="
User avatar
Danny Warner
 
Posts: 3400
Joined: Fri Jun 01, 2007 3:26 am

Next

Return to IV - Oblivion