Undroppable Item Script

Post » Sun Jan 10, 2010 3:09 am

So I'm making a simple quest mod, trying to learn dialogue and all, and i need a script that makes an item undroppable, Is this possible? If so, can someone send me the script? Thanks!
User avatar
Cat
 
Posts: 3451
Joined: Mon Dec 18, 2006 5:10 am

Post » Sat Jan 09, 2010 12:49 pm

So I'm making a simple quest mod, trying to learn dialogue and all, and i need a script that makes an item undroppable, Is this possible? If so, can someone send me the script? Thanks!

My scripting knowledge is only average, but I would suggest using GetItemCount on the player, and if it returns 0 ( the player dropped it ) then disable and delete that one and give the player a new one. Maybe use a MessageBox function to inform the player that they can't drop it. I'm not 100% certain, but I think it should be fine if the script is attached to the item, just make sure the item is given to the player before it gets deleted. Preferably after it is disabled, but before deletion. If that is problematic, you could use a global script, but it's probably best to avoid that unless the player will only have the item for a limited time.

I trust you have read Morrowind Scripting for Dummies?
User avatar
Veronica Flores
 
Posts: 3308
Joined: Mon Sep 11, 2006 5:26 pm

Post » Sat Jan 09, 2010 4:48 pm

My scripting knowledge is only average, but I would suggest using GetItemCount on the player, and if it returns 0 ( the player dropped it ) then disable and delete that one and give the player a new one. Maybe use a MessageBox function to inform the player that they can't drop it. I'm not 100% certain, but I think it should be fine if the script is attached to the item, just make sure the item is given to the player before it gets deleted. Preferably after it is disabled, but before deletion. If that is problematic, you could use a global script, but it's probably best to avoid that unless the player will only have the item for a limited time.

I trust you have read Morrowind Scripting for Dummies?



I started to read it, but realized that it was completly useless as it went though one ear and out the other, Dialogue on the other hand, speaks to me, and i understand it. So while i understand what you mean by getitemcount and all, i don't know how to peice it together, which is why i posted on here. I simply need it for a quest mod that when you equip a ring it adds a rock to your inventory, and the only way to get rid of the rock it to unequip the ring, and you can't drop it. My problem is i don't know how to stop the player from just dropping it. Thanks for the help!
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Sun Jan 10, 2010 12:00 am

Now, this might not work, but I don't see why it wouldn't right now in my sleepy state.

This script will be attached to the ring. You will need to create a global variable first or you will get errors since the script will look for it.

begin rockringshort OnPCEquipshort hasrockif ( OnPCEquip == 1 ) ;player has equipped ring	Player->AddItem, "your rock's ID" 1	set hasrock to 1	set OnPCEquip to 0 ;resets variable for next equipendifif ( Player->GetItemCount "your rock's ID" == 0 )	if ( hasrock == 1 )		MessageBox, "You cannot drop this rock as long as the ring is equipped."		set dropped to 1		Player->AddItem "your rock's ID" 1	endifendifif  ( Player->HasItemEquipped "your ring's ID" == 0 )	if ( Player->GetItemCount, "your rock's ID" == 1 )		Player->RemoveItem, "your rock's ID" 1		set hasrock to 0	endifendifend


This one will be attached to the rock.

begin delete;delete must be before disabling in the script so that it;doesn't get deleted in the same frame, otherwise it;would crash.if ( GetDisabled == 1 )	SetDelete 1endifif ( dropped == 1 )	disableendifend


Name the scripts and variables whatever you want, just make them unique. Tweak the message if you want to keep it, but make sure it's all on the same line. Remove the comments if you wish. Not sure how much they affect performance, but making the script smaller in size is better in my opinion. Commented scripts can be put in a readme, but that is just my method. This would be much easier if you set the rock up as a light that you can't carry, but I don't think you can make it show up in the inventory. Someone correct me if I'm wrong, but I can't get it to.
User avatar
cheryl wright
 
Posts: 3382
Joined: Sat Nov 25, 2006 4:43 am

Post » Sun Jan 10, 2010 3:40 am

Now, this might not work, but I don't see why it wouldn't right now in my sleepy state.

This script will be attached to the ring. You will need to create a global variable first or you will get errors since the script will look for it.

begin rockringshort OnPCEquipshort hasrockif ( OnPCEquip == 1 ) ;player has equipped ring	Player->AddItem, "your rock's ID" 1	set hasrock to 1	set OnPCEquip to 0 ;resets variable for next equipendifif ( Player->GetItemCount "your rock's ID" == 0 )	if ( hasrock == 1 )		MessageBox, "You cannot drop this rock as long as the ring is equipped."		set dropped to 1		Player->AddItem "your rock's ID" 1	endifendifif  ( Player->HasItemEquipped "your ring's ID" == 0 )	if ( Player->GetItemCount, "your rock's ID" == 1 )		Player->RemoveItem, "your rock's ID" 1		set hasrock to 0	endifendifend


This one will be attached to the rock.

begin delete;delete must be before disabling in the script so that it;doesn't get deleted in the same frame, otherwise it;would crash.if ( GetDisabled == 1 )	SetDelete 1endifif ( dropped == 1 )	disableendifend


Name the scripts and variables whatever you want, just make them unique. Tweak the message if you want to keep it, but make sure it's all on the same line. Remove the comments if you wish. Not sure how much they affect performance, but making the script smaller in size is better in my opinion. Commented scripts can be put in a readme, but that is just my method. This would be much easier if you set the rock up as a light that you can't carry, but I don't think you can make it show up in the inventory. Someone correct me if I'm wrong, but I can't get it to.



Wow you wrote it! Thank you extremely much!!! I really appreciate it, now my mod will actually make sense (: Thanks times a hundred!
User avatar
Elizabeth Falvey
 
Posts: 3347
Joined: Fri Oct 26, 2007 1:37 am

Post » Sat Jan 09, 2010 12:41 pm

"Name the scripts and variables whatever you want, just make them unique. Tweak the message if you want to keep it, but make sure it's all on the same line. Remove the comments if you wish. Not sure how much they affect performance, but making the script smaller in size is better in my opinion. Commented scripts can be put in a readme, but that is just my method. This would be much easier if you set the rock up as a light that you can't carry, but I don't think you can make it show up in the inventory. Someone correct me if I'm wrong, but I can't get it to."

So i set everything up in the cs, went in game, and it worked perfect! Thank you sooo much! Here is a link to the mod in the event that you want to see how your work was used! :http://planetelderscrolls.gamespy.com/View.php?view=Mods.Detail&id=9111

AGAIN, THANKS SO MUCH!
User avatar
Invasion's
 
Posts: 3546
Joined: Fri Aug 18, 2006 6:09 pm

Post » Sat Jan 09, 2010 10:16 pm

Wow you wrote it! Thank you extremely much!!! I really appreciate it, now my mod will actually make sense (: Thanks times a hundred!

So i set everything up in the cs, went in game, and it worked perfect! Thank you sooo much! Here is a link to the mod in the event that you want to see how your work was used! :http://planetelderscrolls.gamespy.com/View.php?view=Mods.Detail&id=9111

AGAIN, THANKS SO MUCH!

You're most welcome. It's not up yet, but I will certainly check it out. I'm glad it worked out. Now if only my own scripts would, haha. =/
User avatar
Jon O
 
Posts: 3270
Joined: Wed Nov 28, 2007 9:48 pm

Post » Sun Jan 10, 2010 12:40 am

You're most welcome. It's not up yet, but I will certainly check it out. I'm glad it worked out. Now if only my own scripts would, haha. =/

Yea i uploaded it last night and its not approved yet but it should be some time today (: And thank you again for helping me(: and i know how you feel haha, scripting is pretty confusing to me. But all modder's have their thing they can't do, and scripting is mine. Thank you!
User avatar
Prue
 
Posts: 3425
Joined: Sun Feb 11, 2007 4:27 am


Return to III - Morrowind

cron