Jump to content

Script problems: GetIsItemUsedEquipType


GodofAlcohol

Recommended Posts

I´m making a script, which should react on the player using chems,stims,alcohol or food and play an suitable animation for it.

 

Problem is, it´s always detecting the player using stimpacks, even if he uses nothing ! (Or maybe my script is terribly wrong?)

I´ve got an item (chem) that casts an effect which triggers this script.. It works, but always plays the animation for stimpacks (even when I use the console command it says FALSE for stimpack)

script:

 

scn ItemUseMonitorScript

short UsedItem
int UsedType

begin ScriptEffectUpdate
set UsedItem to 0
set UsedType to 0
if(Player.GetIsUsedItemEquipType  Alcohol == 1)
		set UsedType to 1
	set UsedItem to 1
else if(Player.GetIsUsedItemEquipType Stimpack == 1)
	set UsedType to 2
	set UsedItem to 1
else if(Player.GetIsUsedItemEquipType Chems == 1)
	set UsedType to 3
	set UsedItem to 1
else 
	set UsedType to 0
	set UsedItem to 0
endif

if(UsedItem == 1)
	if(UsedType == 1)
		player.PlayIdle BeerDrinkingStanding
	else if(UsedType  == 2)
		player.PlayIdle DukovDrinkStand01
	else if(UsedType == 3)
		player.PlayIdle LooseSmokingStanding
	endif	
	showmessage ItemUsageMonitorRunning
endif
set UsedItem to 0
set UsedType to 0
end

 

 

 

Please help, I´m going mad !

Link to comment
Share on other sites

i swapped the else if - commands for normal if , now it doesnt return true on any item...

read in the TESwiki the variable is deleted short after being set (as I understand it), so that could be the problem.

Is there a way of referencing used/equipped objects? maybe that could help..

Link to comment
Share on other sites

For one you should be able to switch your int to a short and still have same results.

 

Secondly, there is no need for the Set UsedItem to 0 in two locations in your script. You can simply add those after each of the animations that are played (which would probably result in better stability overall)

 

Finally, what is this script attached to? Quest? Object? If it's an object you could just remove everything and set up a script that looks like this on each of the items you want usable.

 

scn Name

Begin OnEquip

Player.Animationcommandhere

End

 

It'd only run once (when it's first used) and should still play the correct animations properly. That should work better I'd think.

Link to comment
Share on other sites

hey,

thanks for the answer.

 

It´s an effect script, because I don´t want to change the items directly (would cause conflicts with other food/chems mods)

So it´s checking on every update, if an item was used and should play the animation then.

I tried to check the IsItemUsedEquipType function in-game with the console, it says false to every equipType (after I used Stimpack,Beer,Food,NukaCola etc..

So I think this function is either useless or buggy.

 

What I need is a script that is checking constantly which item was used and which can react on the Type of item.

Any clues how to achieve this? ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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