Is there a command for this?

Post » Sun May 01, 2011 11:28 pm

Can you set the condition of armor or a weapon? like if i wanted to add an item to a npc then set it's condition. is this possible? or a no go?
User avatar
Alexandra Louise Taylor
 
Posts: 3449
Joined: Mon Aug 07, 2006 1:48 pm

Post » Mon May 02, 2011 12:07 am

As far as I know, no you can't. You can only add health data to armor or weapons placed in the game world. Even MWSE can't do health related stuff on items in an npc or container's inventory.
User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Post » Sun May 01, 2011 7:00 pm

Yea i ended up creating new items with unique id's. I'm trying to put togther this script where it will check the players inventory if they have certain items. The only thing in MSFD's is this little block with no explanation.

Checking for presence of items in inventoryGetItemCount, "ObjectID" (returnsShort objectcountSet objectcount to ( "Mob_ID"->GetItemCount,If ( GetItemCount, "Object_ID" >= 1 )


I'm gong to be checking for multiple items at once. Is this a good way of doing it? I set up a global variable "glass"

Begin GlassArmorScriptshort objectcount	If ( glass == 0 )		set objectcount to ( player->getitemcount, "SM_glass_cuirass" )			if ( getitemcount, "SM_glass_cuirass" >= 2 ) 				Set glass to 1			endif 	elseif ( glass == 1 )		       set objectcount to ( player->getitemcount, "SM_glass_boots" )			If ( getitemcount, "SM_glass_boots" >= 2 )				set glass to 2			endif	elseif ( glass == 2 )						    set objectcount to ( player->getitemcount, "SM_glass_helm" )				If ( getitemcount, "SM_glass_helm" >= 2 )				set glass to 3				endif	elseif ( glass == 3 )		Journal "SM_glass2" 50		stopscript Glassarmorscript	endifend


Is this how its normally done? I was going start this script as a targeted script via dialogue so the player won't be able to take items out of his/her iventory when this script runs.
User avatar
Silencio
 
Posts: 3442
Joined: Sun Mar 18, 2007 11:30 pm

Post » Mon May 02, 2011 12:16 am

Could be done simpler. The example in MSFD shows two different ways to use GetItemCount, it doesn't mean you should use both at the same time, only the one more convenient.
Begin GlassArmorScriptshort glassset glass to 0if ( player->getitemcount, "SM_glass_cuirass" >= 2 )	Set glass to  glass + 1endifIf ( player->getitemcount, "SM_glass_boots" >= 2 )	Set glass to  glass + 1endifIf ( player->getitemcount, "SM_glass_helm" >= 2 )	Set glass to  glass + 1endif; No greaves? Pauldrons? Gauntlets?if ( glass == 3 )		; All three checks matched	Journal "SM_glass2" 50	stopscript Glassarmorscriptendifend

But it doesn't prevent player from taking out items from inventory (whatever the hell you meant by that), only signals that there's more than one of each of three items. Also, as soon as it happens, the script stops checking. Whether it is what you intend it to do, I have no idea.
User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am

Post » Sun May 01, 2011 2:25 pm

@Gforcebond
A bit off topic, but it makes your scripts easier to read it they have proper (e.g. Consistent) indentation. http://webpages.charter.net/manauser/morrowind/indenter.htm can indent scripts for you.
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Sun May 01, 2011 10:13 pm

But it doesn't prevent player from taking out items from inventory (whatever the hell you meant by that), only signals that there's more than one of each of three items. Also, as soon as it happens, the script stops checking. Whether it is what you intend it to do, I have no idea.



I was planning on just starting the script via dialogue then stopping the script via dialogue so when the player talks to the npc it checks the players inventory each time.


Hey thanks with the above script! That seems a lot simplier. This is what I got but for whatever reason it's not checking the players inventory. I have it set up for dialogue to when the npcs ask the player if they have the items "yes" and "no" if you select "yes" there is a global variable check for < 10 and >= 10. This is what I have thanks to you, but it doesn't seem to check the players inventory. If i select "yes" it thinks i don't have the items when i do. What is up with that?

Begin GlassArmorScript        short glass        set glass to 0                    if ( player->getitemcount, "SM_glass_cuirass" >= 2 )        Set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_boots" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_helm" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_pauldron_left" >= 2 )        set glass to glass + 1    endif            If ( player->getitemcount, "SM_glass_pauldron_right" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_bracer_left" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_bracer_right" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_greaves" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_shield" >= 2 )        set glass to glass + 1    endif                If ( player->getitemcount, "SM_glass_towershield" >= 2 )        set glass to glass + 1    endif    If ( glass >= 10 )                stopscript Glassarmorscript    endif    end


@Gforcebond
A bit off topic, but it makes your scripts easier to read it they have proper (e.g. Consistent) indentation. This can indent scripts for you.


thanks that helps
User avatar
Brittany Abner
 
Posts: 3401
Joined: Wed Oct 24, 2007 10:48 pm

Post » Sun May 01, 2011 10:11 pm

As I said, it checks your inventory to have more than 2 of each item. If you want to know whether you have glass armor at all, you should replace all ">=2" for ">=1". Also I see nothing in your script that *uses* gathered data. The variable "glass", declared as local in a targeted script, won't be visible in dialogue either. If you want to use "glass" as a dialogue condition, declare it as a global and remove its declaration from the script. Though I'd recommend you use the journal, as you did previously.
User avatar
Schel[Anne]FTL
 
Posts: 3384
Joined: Thu Nov 16, 2006 6:53 pm

Post » Sun May 01, 2011 1:47 pm

Thanks for the help!
User avatar
Katy Hogben
 
Posts: 3457
Joined: Mon Oct 30, 2006 12:20 am

Post » Sun May 01, 2011 9:30 pm

You can change the health of weapons and armour with MWSE but they can't be equipped at the time. I used to do it by unequipping them and dropping them to the ground via a script, changing the values and then re-equipping them.
User avatar
Mel E
 
Posts: 3354
Joined: Mon Apr 09, 2007 11:23 pm

Post » Mon May 02, 2011 4:08 am

You can change the health of weapons and armour with MWSE but they can't be equipped at the time. I used to do it by unequipping them and dropping them to the ground via a script, changing the values and then re-equipping them.



I really need to look into MWSE. I'll take that into consideration.
User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm


Return to III - Morrowind