Jump to content

Get equipped grenade - script help?


Recommended Posts

Im trying to get a script to find if the player has grenades equipped, and if so - which type of grenade.

But i cant really figure it out.

Â

im testing this bit of script at the moment but it isnt recognising when grenades are equipped...

Scriptname Grenade_SM_Equip extends ObjectReference

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()

     if (akActor.GetEquippedItemType(0) == 11)
	debug.notification("grenades equipped 0")
     elseif (akActor.GetEquippedItemType(1) == 11)
	debug.notification("grenades equipped 1")
     else
	debug.notification("cant find grenades slot")
     endif

  endif
endevent
Right now in game I equip grenades but I only get the last debug notification.

 

Can anyone help with this one?

Edited by SandMouseAnarchy
Link to comment
Share on other sites

Use string concatenation to get the values:

Event OnEquipped(Actor akActor)
	If akActor == Game.GetPlayer()
		Int i = 0
		Int last = 15
		String ResultMessage = ""
		While i <= last
			ResultMessage += "akActor.GetEquippedItemType(" + i + ") == " + akActor.GetEquippedItemType(i) + "\n"
			i += 1
		EndWhile
		Debug.MessageBox(ResultMessage)
	EndIf
Endevent

Link to comment
Share on other sites

Ah I see, thanks mate :) I think I read on a wiki that there are just 2 slots (0 and 1) but I've just ran your script and it turns out frag grenades atleast are in slot 2, that same wiki said grenades were type 11, but after running your script it turns out that grenades are type 10. So who knows ^.^

 

Thanks again DieFeM

Link to comment
Share on other sites

I guess 0 and 1 are for left and right hand respectively (or vice versa) and 2 is for both. Note that the engine has the ability to equip 2 weapons at the same time, but that's only used in TES, not in Fallout. But there are weapons that use both hands, so you can know in what hand you equipped the weapon, or if it needs both hands to equip it.

 

About the index for the weapon type, maybe it was borrowed directly from TES wiki, who knows...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...