Trouble with a script

Post » Sat May 28, 2011 11:04 am

I’ve been having a little trouble with a script using the GetIsUsedItem command. I set it up as a quest script with the syntax being:

Begin Gamemode/Menumode (I’ve tried it both ways)

If Player.Getisuseditem Stimpak == 1
Set stimpackineffectglobal to 1
Set numberofstimpacksusedglobal to numberofstimpacksusedglobal + 1
Set stimpackeffecttimerglobal to 600
elseIf Player.Getisuseditem Jet == 1
Set Jetineffectglobal to 1
Set numberofjetsusedglobal to numberofjestsusedglobal + 1
Set Jeteffecttimerglobal to 600

I then have a separate quest script that that makes use of all those globals. If I use the console to set my globals as if I had taken 3 stimpaks and a jet then awesome stuff happens, but if I actually open the pipboy and use the items that way then nothing happens. I even checked the globals via console after using the items and they are all at the default value of zero. Any ideas/suggestions?
User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Sat May 28, 2011 10:34 am

How often do you have the quest running? It may be missing the event which I would guess is a very 'quick' event for game reporting purposes.
Also, it would have to be a menumode since your in the pip-boy menus. But I am not sure about if quests run when you are in the pip-boy :shrug:
User avatar
Suzy Santana
 
Posts: 3572
Joined: Fri Aug 10, 2007 12:02 am

Post » Sat May 28, 2011 10:51 pm

How often do you have the quest running? It may be missing the event which I would guess is a very 'quick' event for game reporting purposes.
Also, it would have to be a menumode since your in the pip-boy menus. But I am not sure about if quests run when you are in the pip-boy :shrug:


I'm not sure either about quest scripts running in Pip-boy mode, if they aren't running, you could use a script like this (taken from cipsis.com)

ref rCurrentItemint iIndexBegin GameMode	set iIndex to player.GetNumItems - 1	Label 10	set rCurrentItem to player.GetInventoryObject iIndex	if rCurrentItem		; Do stuff		set iIndex to iIndex - 1		Goto 10	endifEnd


This script loops through the object in an actor's inventory so you could run it in gamemode for the player and detect if stimpaks/jets have been subtracted in e.g. 1 second intervals.
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Sat May 28, 2011 7:03 pm

The issue of quest scripts running in pipboy mode is one I was worried about.

That gamemode loop looks very interesting, I'll play with it and see what happens. It would help assuage my other fear about compatability with mods that auto use items or players using items from hotkeys. I wonder how well it would work for players spamming thier jet?
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

Post » Sat May 28, 2011 1:13 pm

That would not work. What happens when I drop a stimpak instead of using it?
User avatar
saxon
 
Posts: 3376
Joined: Wed Sep 19, 2007 2:45 am

Post » Sat May 28, 2011 7:31 am

Oh yeah, also when selling jet/stimpaks/whatever else I decide to include.
User avatar
Albert Wesker
 
Posts: 3499
Joined: Fri May 11, 2007 11:17 pm

Post » Sat May 28, 2011 8:15 pm

A GameMode will certainly not run when in the Pip-boy menus. Just remember that. ;)

Check out the available menumode's you can choose from:
http://geck.gamesas.com/index.php/MenuMode
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Sat May 28, 2011 7:31 pm

That would not work. What happens when I drop a stimpak instead of using it?


Oh yeah, also when selling jet/stimpaks/whatever else I decide to include.


You could put in a check for relevant changes in the player's corresponding attributes. It you are missing stimpaks and your health is up by more than 5-15 Hp (which usually means not food), chances are you used them. Same with other chems.

You could also check how they track food consumption in mods like Primary Needs. Moreover, since there is a stimpak counter in your pip-boy, there must be a variable that tracks stimpaks.
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm

Post » Sat May 28, 2011 10:39 am

You could use http://geck.gamesas.com/index.php/GetPCMiscStat and look at how many stimpaks have been used.

set myStims to (GetPCMiscStat "Stimpaks Taken")

User avatar
sarah simon-rogaume
 
Posts: 3383
Joined: Thu Mar 15, 2007 4:41 am

Post » Sat May 28, 2011 4:49 pm

How often do you have the quest running? It may be missing the event which I would guess is a very 'quick' event for game reporting purposes.
Also, it would have to be a menumode since your in the pip-boy menus. But I am not sure about if quests run when you are in the pip-boy :shrug:


Menumode blocks run when you have your pipboy up.
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Sat May 28, 2011 5:20 pm

Maybe put a duration of 1 second on the stimpak and then have your quest delay of .01 and try using

if Player.IsSpellTarget Stimpak


to capture it
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Sat May 28, 2011 4:57 pm

GetPCMiscStat should work fine. It is a game engine count of the stimpaks used. If the number goes up, you know how many stimpaks were used since the last time you checked the count.

Used in a MenuMode and GameMode, you could capture this if the player is in the menu, or out of the menu and now in general game play.
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am

Post » Sat May 28, 2011 10:09 am

GetPCMiscStat should work fine. It is a game engine count of the stimpaks used. If the number goes up, you know how many stimpaks were used since the last time you checked the count.

Used in a MenuMode and GameMode, you could capture this if the player is in the menu, or out of the menu and now in general game play.


This does sound like the best way to do it :)
User avatar
jessica breen
 
Posts: 3524
Joined: Thu Aug 03, 2006 1:04 am

Post » Sat May 28, 2011 1:58 pm

I’m going to have to rethink this a bit. I have several ingestibles in my mod and they don’t all fall under the heading of Stimpak. As a matter of fact I don’t even touch the Stimpack in this mod. I was hoping to use a quest script to ensure compatibility, which means I need to use either and object or effect script. Does anyone know if a merged patch combines the effects placed on items? I could make a series of effect scripts that sets my globals, but I don’t want to overwrite the added effects from other mods.
User avatar
ANaIs GRelot
 
Posts: 3401
Joined: Tue Dec 12, 2006 6:19 pm


Return to Fallout 3