Jump to content

Checking if player has items with keyword.


Recommended Posts

This is exactly what this line does. The message needs to be a stand alone and not a part of a menu, this is common logic.
         If iButtonA == 0
            If (Game.GetPlayer().GetEquippedItemType(0) != 11)
                LitFire()    ; If Torch is equip, Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
       else
              EquipTorch.Show()    ; If Torch is not equip, Player should Equip the Torch Message will show
              GoToState("Waiting")    ; After the Message and If the torch is not eqipped will RETURN to be activated again
      EndIf
     EndIf

 

Don't you read the descriptions beside them ?,

Link to comment
Share on other sites

  • Replies 49
  • Created
  • Last Reply

Top Posters In This Topic

Ok, made a few changes. I didn't explain something. Whichever source of ignition the player chooses, torch or flint, the script, in both cases, should go to the combustible items menu - Rage, Oil and Bristles. Logs won't spontaneously ignite by holding a torch to them (well they could but would take forever). I believe I fixed this by 'sending' the script to the correct function...

MyRagIgnitesFire()

instead of

LitFire()

See attached script

Still the fire lights if the player doesn't equip a torch.

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2134445&parId=B60C11D037429D8E%21191&o=OneUp

 

 

If iButtonA == 0
If (Game.GetPlayer().GetEquippedItemType(0) != 11)
EquipTorch.Show() ; If Torch is not equip, Player should Equip the Torch Message will show
GoToState("Waiting") ; After the Message and If the torch is not equipped will RETURN to be activated
Else
MyRagIgnitesFire() ; If Torch is equipped, now will show the combustible items (KindAccOptions) menu

EndIf
EndIf

 

Link to comment
Share on other sites

All this could be avoided if you were more detailed from the beginning...
When asking for assistance always keep in mind that only you are standing in front of your PC and only you actually knows what exactly your idea is suppose to do.
I think this is what you wanted the script to do from the start.
Changes has been made.
READ THE NOTES BESIDE THEM

GlobalVariable Property FlintUseCount Auto
GlobalVariable Property FireULock Auto
Light Property MyTorch Auto
Sound Property MySFX Auto
MiscObject Property Oil Auto
MiscObject Property Rag Auto
MiscObject Property Bristle Auto
MiscObject Property Flint Auto
Message Property EquipTorch Auto
Message Property MyMenu Auto
Message Property NeedKindAcc Auto
Message Property NeedIgnite Auto
Message Property FlintOrTorch Auto
ObjectReference Property MyMarker Auto
 
Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
      if (akActionRef == Game.GetPlayer())
 
          if (Game.GetPlayer().GetItemCount(MyTorch) > 0) && (Game.GetPlayer().GetItemCount(Flint) > 0)
              MyIgnitesItem()    ; If all items (more than one of each) are in the inventory will go to the CHOOSE item to lit fire "MyIgnitesItem()"
      else
              NeedIgnite.Show(); player has no ignite source
     EndIf
 
           If (Game.GetPlayer().GetItemCount(Rag) > 0) || (Game.GetPlayer().GetItemCount(Oil) > 0) || (Game.GetPlayer().GetItemCount(Bristle) > 0)
               MyIgnitesItem()     ; If all items (more than one of each) are in the inventory will go to the CHOOSE item to lit fire "MyIgnitesItem()"
        else
              NeedKindAcc.Show()
    EndIf
  EndIf
EndEvent
EndState
 
 
State Busy
Event OnActivate(ObjectReference akActionRef)
;Do nothing.
EndEvent
EndState
 
 
Function MyIgnitesItem()
              GoToState("Busy")
              Int iButtonA = FlintOrTorch.Show()    
         If iButtonA == 0
            If (Game.GetPlayer().GetEquippedItemType(0) != 11)
                MyCombustibleMenu()  ; Goes to the choose combastion items MENU "MyCombustibleMenu()"
       else
              EquipTorch.Show()  ; Player should Equip the Torch Message will show
              GoToState("Waiting")  ; After the Message and If the torch is not eqipped will EXIT to be activated again
      EndIf
     EndIf
         If iButtonA == 1
              Debug.Notification ("Flint Will Be Used To Light Fire")
              MyCombustibleMenu()  ; Goes to the choose combastion items MENU "MyCombustibleMenu()"
     EndIf
EndFunction
 
 
Function MyCombustibleMenu()
              Int iButtonB = MyMenu.Show()
           If iButtonB == 0
             Game.GetPlayer().RemoveItem(Rag, 1)
             Debug.Notification ("Option 0, 1 Dry Rag remove")
             LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
    ElseIf iButtonB == 1
              Game.GetPlayer().RemoveItem(Oil, 1)
              debug.notification("Option 1, 1 Oil Remove")
              LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
    ElseIf iButtonB == 2
              Game.GetPlayer().RemoveItem(Bristle, 1)
              debug.notification("Option 2, 1 Bristles Remove")
              LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
     EndIf 
EndFunction
 
 
Function LitFire()
 
   ; Do Stuff Here, ONE FUNCTION FOR ALL - enable/disable - play - delete - etc...
 
 
      GoToState("Waiting")  ; This is only needed if multiple uses of the activator is meant to. If activator is disable > delete do not use it.
EndFunction

 

 

 

Edit : Typo...

Edited by maxarturo
Link to comment
Share on other sites

I removed...

GoToState("Waiting")

.. as this is a single use activator. Haven't changed anything in the script and still no joy.

Plus script repeats sections. Honest - I haven't changed anything.

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2134447&parId=B60C11D037429D8E%21191&o=OneUp

 

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2134446&parId=B60C11D037429D8E%21191&o=OneUp

Edited by antstubell
Link to comment
Share on other sites

Now that i had some free time and watch your videos, i understood.

Should be working now how you want it to...

READ THE NOTES BESIDE, IMPORTANT !.

 

 

GlobalVariable Property FlintUseCount Auto
GlobalVariable Property FireULock Auto
Light Property MyTorch Auto
Sound Property MySFX Auto
MiscObject Property Oil Auto
MiscObject Property Rag Auto
MiscObject Property Bristle Auto
MiscObject Property Flint Auto
Message Property EquipTorch Auto
Message Property MyMenu Auto
Message Property NeedKindAcc Auto
Message Property NeedIgnite Auto
Message Property FlintOrTorch Auto
ObjectReference Property MyMarker Auto
 
Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
      if (akActionRef == Game.GetPlayer())
 
          if (Game.GetPlayer().GetItemCount(MyTorch) > 0) && (Game.GetPlayer().GetItemCount(Flint) > 0)
              MyIgnitesItem()    ; If all items (more than one of each) are in the inventory will go to the CHOOSE item to lit fire "MyIgnitesItem()"
 
     ElseIf (Game.GetPlayer().GetItemCount(Rag) > 0) && (Game.GetPlayer().GetItemCount(Oil) > 0) && (Game.GetPlayer().GetItemCount(Bristle) > 0)
               MyIgnitesItem()     ; If all items (more than one of each) are in the inventory will go to the CHOOSE item to lit fire "MyIgnitesItem()"
 
        else
              NoRequiredIgniteItems.Show()   ; ONE Message to show for both of the above, if NONE of them are in Player's inventory.
    EndIf
  EndIf
EndEvent
EndState
 
 
 
State Busy
Event OnActivate(ObjectReference akActionRef)
;Do nothing.
EndEvent
EndState
 
 
Function MyIgnitesItem()
              GoToState("Busy")
              Int iButtonA = FlintOrTorch.Show()    
         If iButtonA == 0
            If (Game.GetPlayer().GetEquippedItemType(0) != 11)
                MyCombustibleMenu()  ; Goes to the choose combastion items MENU if TORCH is equiped "MyCombustibleMenu()"
       else
              EquipTorch.Show()  ; Player should "Equip the Torch" Message will show
              GoToState("Waiting")  ; After the Message Above and If the torch is not eqipped will EXIT to be activated again
      EndIf
     EndIf
         If iButtonA == 1
           If (Game.GetPlayer().GetItemCount(Rag) > 0) && (Game.GetPlayer().GetItemCount(Oil) > 0) && (Game.GetPlayer().GetItemCount(Bristle) > 0)
              Debug.Notification ("Flint Will Be Used To Light Fire")
              MyCombustibleMenu()  ; Goes to the choose combastion items MENU ONLY IF all of the above items are in the inventory "MyCombustibleMenu()"
      else
              Debug.Notification ("No Items")  ; If none of the items (or at least ONE is missing) from the inventory will show a "NO ITEMS Message".
              GoToState("Waiting")  ; After the Message Above will EXIT to be activated again
     EndIf
   EndIf
EndFunction
 
 
Function MyCombustibleMenu()
              Int iButtonB = MyMenu.Show()
           If iButtonB == 0
             Game.GetPlayer().RemoveItem(Rag, 1)
             Debug.Notification ("Option 0, 1 Dry Rag remove")
             LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
    ElseIf iButtonB == 1
              Game.GetPlayer().RemoveItem(Oil, 1)
              debug.notification("Option 1, 1 Oil Remove")
              LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
    ElseIf iButtonB == 2
              Game.GetPlayer().RemoveItem(Bristle, 1)
              debug.notification("Option 2, 1 Bristles Remove")
              LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
     EndIf 
EndFunction
 
 
Function LitFire()
 
   ; Do Stuff Here, ONE FUNCTION FOR ALL - enable/disable - play - delete - etc...
 
 
      GoToState("Waiting")  ; This is only need if multiple uses of the activator is meant to. If activator is disable > delete do not use it.
EndFunction

 

 

 

EDIT : Forgot to change something ! Check it !.

Change || to &&

Edited by maxarturo
Link to comment
Share on other sites

Just got a lot of errors until I noticed that there was a : instead or ; so compiler tried to compile a comment. Fixed that but still getting...

 

(63,0): mismatched input 'EndFunction' expecting ENDIF

I attempted to fix this but cause more errors so I changed it back to the script you posted.

 

 

Link to comment
Share on other sites

I'm making this in my tablet while looking at the beach and bitches.... difficult to concentrate with all those A**ES all around...


Put in "Function MyIgnitesItem()"

One moe "EndIf" at the end before "EndFunction"


* Also i edit it a little after i posted it. It's been rectify. (don't put "EndIf" now if you will copy it from above).

Edited by maxarturo
Link to comment
Share on other sites

After having sex and clearing my head i Looked your videos once more and i realize that your idea has a problem from the beginning.
The problem is ORDER OF HOW THINGS SHOULD TAKE PLACE, think carefully your idea before creating a Script.
1) OPTIONAL = On Activate the Player should be informed with message about the items required, otherwise will be a constant ENTER MENU - EXIT MENU if player dosen't have all items or takes the wrong options corresponding with what he has in his inventory.
2) On Activate the Script should check if at least ONE OF EACH (Ingnite Item + Combusible Item) are in the inventory:
Torch & Flint & Rag & Oil & Bristle, otherwise will SHOW NO ITEMS Message and EXIT if NONE of them are in the inventory.
3) If the requirements above are meet will go to OPEN THE CHOOSE ITEMS MENU.
* Having the option to fire the "Choose Item Menu" with at least ONLY ONE object will result in EXITING THE MENU if the item chosen is not in the inventory.
(This is how i made the final script).


GlobalVariable Property FlintUseCount Auto
GlobalVariable Property FireULock Auto
Light Property MyTorch Auto
Sound Property MySFX Auto
MiscObject Property Oil Auto
MiscObject Property Rag Auto
MiscObject Property Bristle Auto
MiscObject Property Flint Auto
Message Property EquipTorch Auto
Message Property MyMenu Auto
Message Property NeedKindAcc Auto
Message Property NeedIgnite Auto
Message Property FlintOrTorch Auto
ObjectReference Property MyMarker Auto
 
 
Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
      if (akActionRef == Game.GetPlayer())
          RequiredItemsMESSAGE.Show()  ; OPTIONAL - but Neccesary MESSAGE
 
          if (Game.GetPlayer().GetItemCount(MyTorch) > 0) || (Game.GetPlayer().GetItemCount(Flint) > 0)
 
          If (Game.GetPlayer().GetItemCount(Rag) > 0) || (Game.GetPlayer().GetItemCount(Oil) > 0) || (Game.GetPlayer().GetItemCount(Bristle) > 0)
               MyIgnitesItem()     ; If at least ONE of all items of the two upper "IF" are in the inventory will go to the CHOOSE item to lit fire "MyIgnitesItem()"
 
        else
              NoRequiredIgniteItems.Show()   ; ONE Message to show for both of the above, if the requirements are not meet.
    EndIf
  EndIf
EndIF
EndEvent
EndState
 
 
State Busy
Event OnActivate(ObjectReference akActionRef)
       ;Do nothing.
EndEvent
EndState
 
 
Function MyIgnitesItem()
              GoToState("Busy")
              Int iButtonA = FlintOrTorch.Show()    
         If iButtonA == 0
            If  Game.GetPlayer().GetEquippedItemType(0) != 11
                MyCombustibleMenu()  ; Goes to the choose combastion items MENU if TORCH is equiped "MyCombustibleMenu()"
       else
              EquipTorch.Show()  ; If Torch is NOT ALREADY EQUIPED, Player should "Equip the Torch" Message will show
              GoToState("Waiting")  ; After the Message Above will EXIT to be activated again
      EndIf
     EndIf
         If iButtonA == 1
           If Game.GetPlayer().GetItemCount(Flint) > 0
              Debug.Notification ("Flint Will Be Used To Light Fire")
              MyCombustibleMenu()  ; Goes to the choose combastion items MENU ONLY IF FLINT is in the inventory "MyCombustibleMenu()"
      else
              Debug.Notification ("No Flint Message")  ; If NO FLINT is in the inventory will show a "NO FLINT Message".
              GoToState("Waiting")  ; After the Message Above will EXIT to be activated again
     EndIf
   EndIf
EndFunction
 
 
Function MyCombustibleMenu()
              Int iButtonB = MyMenu.Show()
           If iButtonB == 0
              If  Game.GetPlayer().GetItemCount(Rag) > 0
                  Game.GetPlayer().RemoveItem(Rag, 1)
                  Debug.Notification ("Option 0, 1 Dry Rag remove")
                  LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
          Else
                 Debug.Notification ("You don't have Rag")
                 GoToState("Waiting")
         EndIf
     EndIf
           If iButtonB == 1
              If  Game.GetPlayer().GetItemCount(Oil) > 0
                  Game.GetPlayer().RemoveItem(Oil, 1)
                  debug.notification("Option 1, 1 Oil Remove")
                  LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
          Else
                 Debug.Notification ("You don't have Oil")
                 GoToState("Waiting")
         EndIf
     EndIf
           If iButtonB == 2
              If  Game.GetPlayer().GetItemCount(Bristle) > 0
                  Game.GetPlayer().RemoveItem(Bristle, 1)
                  debug.notification("Option 2, 1 Bristles Remove")
                  LitFire()  ; If this option is choose will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
          Else
                 Debug.Notification ("You don't have Bristle")
                 GoToState("Waiting")
         EndIf
     EndIf 
EndFunction
 
 
Function LitFire()
 
   ; Do Stuff Here, ONE FUNCTION FOR ALL - enable/disable - play - delete - etc...
 
 
      GoToState("Waiting")  ; This is only need if multiple uses of the activator is meant to. If activator is disable > delete do not use it.
EndFunction

 

 

 

EDIT : I was creating the Script based on yours and trying to understand what you want it to do through it.

I tested this and compare it with one of mine and it's working flawlessly.
Edited by maxarturo
Link to comment
Share on other sites

Spent all morning on this and cracked it. Couldn't have done it without your help.

 

GlobalVariable Property FlintUseCount Auto
GlobalVariable Property FlintInUse Auto
GlobalVariable Property FireULock Auto
Light Property MyTorch Auto
Sound Property MySFX Auto
MiscObject Property EmptyBottle Auto
MiscObject Property Oil Auto
MiscObject Property Rag Auto
MiscObject Property Bristle Auto
MiscObject Property Flint Auto
Message Property EquipTorch Auto
Message Property KindAccList Auto
Message Property NeedKindAcc Auto
Message Property NeedIgnite Auto
Message Property FlintOrTorch Auto
ObjectReference Property MyMarker Auto

Function CombustibleList()
; inventory check to see if player has NONE of the required items – add to as needed
if (Game.GetPlayer().GetItemCount(Rag) < 1) && (Game.GetPlayer().GetItemCount(Oil) < 1) && (Game.GetPlayer().GetItemCount(Bristle) < 1)
NeedKindAcc.Show()
; inventory check to see if player has at least 1 of any combustible item
elseIf (Game.GetPlayer().GetItemCount(Rag) >= 1) || (Game.GetPlayer().GetItemCount(Oil) >= 1) || (Game.GetPlayer().GetItemCount(Bristle) >= 1)
Int iButtonB = KindAccList.Show(); show combustible items menu
If iButtonB == 0
Game.GetPlayer().RemoveItem(Rag, 1) ; remove 1 dry rag
EndIf
If iButtonB == 1
Game.GetPlayer().RemoveItem(Oil, 1, TRUE) ; silently remove 1 oil
Game.GetPlayer().AddItem(EmptyBottle, 1, TRUE) ; silently add empty bottle
debug.notification("Oil Removed")
EndIf
If iButtonB == 2
Game.GetPlayer().RemoveItem(Bristle, 1) ; remove 1 bristle
EndIf
Endif
EndFunction

Function LightFire()
If FlintInUse.GetValue() == 1
MySFX.Play(Self) ; if player chose flint then play flint ignition sound
FlintInUse.SetValue(0); resets variable for future use
Endif
FireULock.SetValue(1); sets value for next part of the puzzle i.e. “the fire is lit, what is next?”
Utility.Wait(1.5); allow time for sfx to finish
MyMarker.Disable() ; actually show fire light
Self.Disable()
Utility.Wait(0.5)
Self.Delete()
EndFunction

Event OnActivate(ObjectReference akActionRef)
if (Game.GetPlayer().GetItemCount(MyTorch) < 1) && (Game.GetPlayer().GetItemCount(Flint) < 1)
NeedIgnite.Show(); player has no ignite source
else
Int iButtonA = FlintOrTorch.Show(); show ignition source menu
; menu is shown with available ignite sources based on conditions set in message form
If iButtonA == 0 && (Game.GetPlayer().GetEquippedItemType(0) != 11)
iButtonA = EquipTorch.Show(); show equip torch message
elseIf iButtonA == 0 && (Game.GetPlayer().GetEquippedItemType(0) == 11)
CombustibleList()
LightFire()
elseIf iButtonA == 1 && (Game.GetPlayer().GetItemCount(Flint) > 0)
FlintUseCount.Mod(1); counts how many times this piece of flint has been used
FlintInUse.SetValue(1); flint is GOING TO BE USED – needed for condition later on
CombustibleList()
LightFire()
EndIf
EndIf

EndEvent

 

Now, I am at peace... for a while.

EDIT: Just noticed...

iButtonA = EquipTorch.Show(); show equip torch message

can be changed to...

EquipTorch.Show(); show equip torch message

 

EDIT, EDIT: I think.

Edited by antstubell
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...