Requesting Scripting help :)

Post » Tue May 17, 2011 2:19 am

I'm trying to set a object to only equip if the target has at or greater than 8 strength, and if not; to Unequip the item. needless to say i'm still pretty green when it comes to scripting

I'm not even sure this is possible via just a script so If Im Wrong just lemme know :)

heres the code of my current non-working script !Please help!


Scn MakEwebStrCheckScriptshort Makstrengthcheck Begin OnEquip	If getav strength >= 8		Set Makstrengthcheck to 1				Elseif  getav strength < 8		Set Makstrengthcheck to 0        	endifendbegin gamemode	if Makstrengthcheck ==1		UnEquipItem MakEweb		ShowWarning "You are not Strong enough to equip this weapon"	endifend

User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am

Post » Tue May 17, 2011 12:29 am

Well I see several things very quickly. First off, i Makstrengthcheck is 1, doesnt that mean they are strong enough to equip it? So that is backwards. Also this will check every single frame, reguardless of whether they have the object equipped or not. Also, is this script on the object or in a quest or what? I suggest doing the following. And making it the script for the item itself.

Begin OnEquip  If GetAv Strength < 8    UnEquipItem MakEweb 0 1    ShowMessage YourMakStrengthMessage  EndIfEnd


This should make it check right when they equip it, show the message once, (Make it a message not a warning) and unequip the item if they are not strong enough.
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Tue May 17, 2011 5:15 am

thx for the quick reply, and the script you sent is Partailly working. it shows the message but wont Unequip the weapon

i have it as a Obj script, and it is attached to the weapon. perhaps having it equip fists instead and will this script work in menu mode as well as Game mode?

-EDIT-

it works if I use the player refs but I want it to work on all NPCs as well

Scn MakEwebStrCheckScript1   begin OnEquip		if player.GetActorValue Strength >= 8			player.EquipItem MakEweb 0 1		else			player.UnEquipItem MakEweb 0 1			 ShowMessage MakEwebStrCheck		endif	endifend

User avatar
Robyn Howlett
 
Posts: 3332
Joined: Wed Aug 23, 2006 9:01 pm

Post » Tue May 17, 2011 2:02 pm

Oh yea I forget about the ref its acting on. Well that works just remember it only will for the player. So make sure no NPCs have it. :P
User avatar
Vickytoria Vasquez
 
Posts: 3456
Joined: Thu Aug 31, 2006 7:06 pm

Post » Tue May 17, 2011 3:53 pm

im trying this atm, but I'm not sure its the correct Ref Variable..


_edit_ GOT IT!! w00t :P
its the getcontainer ref var!

Scn MakEwebStrCheckScript1Ref MakActorRef   begin OnEquip   	set MakActorRef to [b]GetContainer[/b]		if MakActorRef.GetActorValue Strength >= 8			MakActorRef.EquipItem MakEweb 0 1		else			MakActorRef.UnEquipItem MakEweb 0 1			 ShowMessage MakEwebStrCheck		endif	endifend

User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Tue May 17, 2011 8:11 am

Thats what I was thinking would work as well. It would make sense. Just, you dont need to call it to be equipped if its already equipped. Flop it back to the way I had it.

Scn MakEwebStrCheckScript1Ref MakActorRef   begin OnEquip   	set MakActorRef to GetContainer		if MakActorRef.GetActorValue Strength < 8			MakActorRef.UnEquipItem MakEweb 0 1			 ShowMessage MakEwebStrCheck		endifend

User avatar
Mistress trades Melissa
 
Posts: 3464
Joined: Mon Jun 19, 2006 9:28 pm

Post » Tue May 17, 2011 1:21 pm

looks good man
its working well
thx for the help :)
User avatar
Shae Munro
 
Posts: 3443
Joined: Fri Feb 23, 2007 11:32 am

Post » Tue May 17, 2011 12:06 pm

No problem. It was good practice for me. :) All of the work on my mod for the last 2 months has been more making rooms and cluttering, no much scripting. I am loosing my edge. :P Oh and I figured it warned you when you tried to save, but make sure you take out the extra 'endif'. (I edited the posted script)

Gunmaster95
User avatar
Emily abigail Villarreal
 
Posts: 3433
Joined: Mon Aug 27, 2007 9:38 am


Return to Fallout 3