Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Checking Weapon Types


JulianSull
 Share

Recommended Posts

I want to create an arena where only melee weapons are allowed. My plan is to make it so that every five seconds, everyone in the arena is silenced so the player cannot use magic. Is there a way that I can check if the player has any arrows or bows in his inventory and put them in a chest that he can retrieve them from later? It would need to be able to catch all types of bows and arrows, including custom ones. OBSE scripts are fine.

EDIT: Could I do this instead? Take everything the player has and put it in a case and then give the player pre-chosen weapons, armor and potions?

Edited by JulianSull
Link to comment
Share on other sites

You can use RemoveAllItems to dump everything the player has in a chest. Quest items are not included, so if a weapon is a quest item you will not catch it. (an easy way to cheat and bring any weapon you want with you)

You can then give the player the weapon you choose. (or pick from a menu)

At the end of the fight, you can use RemoveAllItems from the chest back to the player.

Link to comment
Share on other sites

  • 2 weeks later...

Why not call a getweapontype on the players equiped weapon every so often when in the arena. You would have to start by storing the weapon type in the weapon slot.

GetEquippedObject 16 will return the ID for the currently equipped weapon. You could then check if that is a bow or staff by calling getweapontype. Staves will return 4, Bows 5. If I was going to do it, my script might look something like this.

scn ArenaWeaponCheck

ref weapon

Begin GameMode

set weapon to player.GetEquippedObject 16

if (weapon.getweapontype == 4) || (weapon.getweapontype == 5)

UnequipItem weapon 1

endif

end

Please note that this is an extremely basic, and non-tested script. For instance, the "1" after the UnequipItem call sets the items no equip flag to one, meaning the player will never be able to equip it again. So you would need to make an edit here to let them equip the item again after the match.

scn ArenaWeaponCheck

ref weapon

ref weapon01

Begin GameMode

set weapon to player.GetEquippedObject 16

set weapon01 to weapon

if (weapon.getweapontype == 4) || (weapon.getweapontype == 5)

UnequipItem weapon 1

endif

end

After the match was over you would need a way to call

EquipItem weapon01

Personally I would make it a quest script and design a quest for my arena that updates when the opponent is dead. On the update I would call the above. This would also allow you to set the update timer for the quest to check for weapons every 1, 2, 3, 4 ,5 so on and so fourth seconds. To make it effiect I would duplicate the getweapontype commands but on the first one call does not equal, and under that return, so it doesn't check all the way through the script if they don't have a bow or staff equipped. That would look like this

scn ArenaWeaponCheck

ref weapon

ref weapon01

Begin GameMode

set weapon to player.GetEquippedObject 16

if (weapon.getweapontype != 4) || (weapon.getweapontype != 5)

return

else

UnequipItem weapon 1

set weapon01 to weapon

end

If you were paying attention, I moved the weapon01 to after the Unequip. This is another redundant command if the initial check fails, calling the return, overall making your script more efficient.

So, yes it is possible with OBSE to check if the current equipped weapon is melee. Sorry if my explanation was too in-depth, just trying to be helpful!

Let me know if you need any more help. I am not by any means a master scripter, but I know my way around some of the vague commands.

Good luck!

-Traven73

EDIT1: Clarity

EDIT2: Another plus to this method is it works with any item, including quest items, so there is no way to cheat it.

Edited by Traven73
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...