Scripting Questionproblem

Post » Thu May 03, 2012 6:06 pm

So I have finally started getting into scripting for morrowind and have run into a bit of a dead end. I want to make a crossbow that has infinite bolts that replenish after on has been shot. Here is the code as of now.

Begin glass_arrow
if ( player->GetItemCount, "BG_silver_bolt" < 2 )
Player->additem BG_silver_bolt 1
endif
End ;glass_arrow
"yes I named it arrow and not bolt, but it is a bolt"

So whenever I go in game, I can pick it up, but then I am not able to select it in the menu, and it's the same for the bold. Which spans in your menu as soon as you walk into the room, (But I can fix that with another if statement.)

I am able to equip the crossbow and bolts using the F1 hot keys, but as soon as I shoot one bolt, instead of going to the equipped bolt, it just adds one by itself in the menu.

So all I really need fixed with this is
  • The ability to equip the crossbow with out having to use the F1 hot keys
  • Having the bolts self equip automatically, but only when the bow is equipped.

Any help on this is greatly appreciated.
User avatar
IsAiah AkA figgy
 
Posts: 3398
Joined: Tue Oct 09, 2007 7:43 am

Post » Fri May 04, 2012 12:01 am

You'll need Tribunal or Bloodmoon dependency for this work.

Make your script a global startscript and try this one:

Begin glass_arrow	if ( player->HasItemEquipped, "GetItemCount, "BG_silver_bolt" < 2 )			Player->additem BG_silver_bolt 1			Player->equipitem BG_silver_bolt		endif	endifEnd ;glass_arrow

Also, take the script off of the crossbow.
User avatar
Barbequtie
 
Posts: 3410
Joined: Mon Jun 19, 2006 11:34 pm

Post » Thu May 03, 2012 7:39 pm

Ok I will try that out. Thank you
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Fri May 04, 2012 2:33 am

You could also put a script on the crossbow that starts the script whenever the player equips it and tell the script to stop running whenever the player unequips it. I'd go that route if you don't want to bother with Tribunal and/or Bloodmoon. Hopefully my script will work because I haven't tested it. :hehe:
User avatar
Trevor Bostwick
 
Posts: 3393
Joined: Tue Sep 25, 2007 10:51 am

Post » Thu May 03, 2012 2:13 pm

Is the "equipitem" command usable only with Tribunal or Bloodmoon. As when I try to use this code it fails and If I try to implement it the CS crashes.
User avatar
Vicky Keeler
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:03 am

Post » Thu May 03, 2012 3:45 pm

D'oh! It's just equip, not equipitem. :facepalm: You do need Tribunal or Bloodmoon for the function to work properly. HasItemEquipped equipped is not an expansion pack function like I thought it was. :blush2: Hey, it's been awhile since I've done any serious MW scripting. :meh:
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Thu May 03, 2012 6:23 pm

Haha, that's ok. I really only just started so any help is more than appreciated.
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm


Return to III - Morrowind