Jump to content

Checking if player has items with keyword.


Recommended Posts

  • Replies 49
  • Created
  • Last Reply

Top Posters In This Topic

Not to worry, was in fact some typos 'Esle' instead of 'Else'. Brackets were not required after fixing the typos.

Still with issues though.

When choosing Flint, Equip Torch appears.

When choosing Torch, no message appears. Everything else seems fine.

 

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

Link to comment
Share on other sites

Creating script on the go or during lunch break can easily produce typos...
..................................................................................................
I got a little confused with all those "Messages" and probably you have assigned wrongly your messages.
I made a few changes to the script for better understanding, I also change the :
iButtonA = EquipTorch.Show()
TO
EquipTorch.Show()
Because i dont really know what you have actually done with all those messages, see it and change it according to your settings and needs.
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())
 
          if (Game.GetPlayer().GetItemCount(MyTorch) > 0) && (Game.GetPlayer().GetItemCount(Flint) > 0)
              MyTorchIgnitesFire()    ; If all items (more than one of each) are in the inventory will go to execute the FUNCTION "Function MyTorchIgnitesFire()"    
      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)
               MyRagIgnitesFire()     ; If all items (more than one of each) are in the inventory will go to execute the FUNCTION "MyRagIgnitesFire()"
        else
              NeedKindAcc.Show()
    EndIf
  EndIf
EndEvent
EndState
 
 
State Busy
Event OnActivate(ObjectReference akActionRef)
;Do nothing.
EndEvent
EndState
 
 
Function MyTorchIgnitesFire()
              GoToState("Busy")
              Int iButtonA = FlintOrTorch.Show()    
         If iButtonA == 0
            If (Game.GetPlayer().GetEquippedItemType(0) != 11)
                LitFire()  ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
       else
              EquipTorch.Show()  ; 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
         If iButtonA == 1
              Debug.Notification ("Flint Will Be Used To Light Fire")
              LitFire()  ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
     EndIf
EndFunction
 
 
Function MyRagIgnitesFire()
              GoToState("Busy")
              Int iButtonB = MyMenu.Show()
           If iButtonB == 0
             Game.GetPlayer().RemoveItem(Rag, 1)
             Debug.Notification ("Option 0, 1 Dry Rag remove")
    ElseIf iButtonB == 1
              Game.GetPlayer().RemoveItem(Oil, 1)
              debug.notification("Option 1, 1 Oil Remove")
    ElseIf iButtonB == 2
              Game.GetPlayer().RemoveItem(Bristle, 1)
              debug.notification("Option 2, 1 Bristles Remove")
     EndIf
              LitFire()  ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
EndFunction
 
 
Function LitFire()
 
   ; Do Stuff Here, ONE FUNCTION FOR ALL - enable/disable - play - delete - etc...
 
EndFunction

 

* This is a strip down version of one of my scripts, just like your "Torch Explosion" script which was also a strip down version of my three co-operating - communicating "Explosion" Scripts , so it should be working fine if your messages are correctly done.

 

* I was also having issues with my messages in my Exchange Dragon Souls Lv 1, Lv 2, Lv 3 > Perks Lv 1, Lv 2, Lv 3 > Advance Skill Lv 1, Lv 2, Lv 3 > Gain Health Lv 1, Lv 2, Lv 3 > Gain Stamina Lv 1, Lv 2, Lv 3 > Gain Magicka Lv 1, Lv 2, Lv 3 > Remove Gold > Remove Filled Black Soul Gems Script, and all of that vice versa and mixed.
And at the end it was just the messages assign wrongly... although simple, it can get very confusing...

 

Edit : Typo...

Edited by maxarturo
Link to comment
Share on other sites

Right then, I made a few changes to the script because some things were not happening and I think I made a little progress.

Still though the script does not make the player equip a torch. Also functions are repeated but for now just want to get the player to equip a torch or fire will not light. The script changes are minimal and I will work on them more once this Equip A Torch can be solved. Thank you for your time and patience.

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

 

 

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 KindAccOptions Auto
Message Property NeedKindAcc Auto
Message Property NeedIgnite Auto
Message Property FlintOrTorch Auto
ObjectReference Property MyMarker Auto

; ignite refers to source of ignition (torch, flint), KindAcc refers to kindling and accelerant needed to start a fire

Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())

if (Game.GetPlayer().GetItemCount(MyTorch) > 0) || (Game.GetPlayer().GetItemCount(Flint) > 0)
MyTorchIgnitesFire() ; If more than one of either are in the inventory will go to execute the FUNCTION "Function MyTorchIgnitesFire()"
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)
MyRagIgnitesFire() ; If all items (more than one of each) are in the inventory will go to execute the FUNCTION "MyRagIgnitesFire()"
else
NeedKindAcc.Show()
EndIf
EndIf
EndEvent
EndState


State Busy
Event OnActivate(ObjectReference akActionRef)
;Do nothing.
EndEvent
EndState


Function MyTorchIgnitesFire()
GoToState("Busy")
Int iButtonA = FlintOrTorch.Show()
If iButtonA == 0
If (Game.GetPlayer().GetEquippedItemType(0) == 11)
MyRagIgnitesFire() ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
endif
If (Game.GetPlayer().GetEquippedItemType(0) != 11)
EquipTorch.Show() ; 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
If iButtonA == 1
Debug.Notification ("Flint Will Be Used To Light Fire")
MyRagIgnitesFire() ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
EndIf
EndFunction


Function MyRagIgnitesFire()
GoToState("Busy")
Int iButtonB = KindAccOptions.Show()
If iButtonB == 0
Game.GetPlayer().RemoveItem(Rag, 1)
Debug.Notification ("Option 0, 1 Dry Rag remove")
ElseIf iButtonB == 1
Game.GetPlayer().RemoveItem(Oil, 1)
debug.notification("Option 1, 1 Oil Remove")
ElseIf iButtonB == 2
Game.GetPlayer().RemoveItem(Bristle, 1)
debug.notification("Option 2, 1 Bristles Remove")
EndIf
LitFire() ; Now will go to execute the enable/disable - play - delete - etc.. "Function LitFire()"
EndFunction


Function LitFire()

; Do Stuff Here, ONE FUNCTION FOR ALL - enable/disable - play - delete - etc...

EndFunction

 

Link to comment
Share on other sites

I didn't make the script to force "Equip Torch" on player, but instead, if is not equiped when activated will show the "No Torch Message" and exit the SCRIPT > to be RE - ACTIVATED.

I did not understand you wanted something like that....

Link to comment
Share on other sites

The "(Game.GetPlayer().GetEquippedItemType(0) != 11)" can not be use to force the player to equip the torch, this is just for CHECKING if the Player has a Torch equipped.


Instead you have to try to use this instead to "force equip torch" on the Player :



Function EquipItem(Form akItem, bool abPreventRemoval = false, bool abSilent = false) native


Should look something like this, example :




If iButtonA == 0
Game.GetPlayer().EquipItem(MyTorch) ; Force to equip the Toch when Button 0 is press
LitFire() ; Run "Function LitFire()"




Check "creationkit.com" for it and read the NOTES, because if i remember correctly there is a warning of some kind for the use of it.


Edit : Add-on...

Edited by maxarturo
Link to comment
Share on other sites

A little offended, I guess you just high-lighted the fact that I was never any good at this to begin with.

These people don't know of you and your history with modding though. I remember you from the old beth forums, if I'm not mistaken(maybe I am, since I been here at the nexus forever too, you wont know me though, but I was Terra Nova over there) and I remember you were pretty good with scripting, but you took that looooong break and it's only natural for you to forget everything, so keep at it, and it will all come back to you.

Edited by Rasikko
Link to comment
Share on other sites

 

A little offended, I guess you just high-lighted the fact that I was never any good at this to begin with.

These people don't know of you and your history with modding though. I remember you from the old beth forums, if I'm not mistaken(maybe I am, since I been here at the nexus forever too, you wont know me though, but I was Terra Nova over there) and I remember you were pretty good with scripting, but you took that looooong break and it's only natural for you to forget everything, so keep at it, and it will all come back to you.

 

History sometimes can just be an obstacle to progression, and we all need from time to time a little friendly push to get us unstuck...

 

This actually pushed antstubell to try to create his first more complicated script all by himself !.

 

* There is a saying :
If you want to evolve, you need to forget the past...
Well, it loses something in the translation.
Edited by maxarturo
Link to comment
Share on other sites

 

A little offended, I guess you just high-lighted the fact that I was never any good at this to begin with.

These people don't know of you and your history with modding though. I remember you from the old beth forums, if I'm not mistaken(maybe I am, since I been here at the nexus forever too, you wont know me though, but I was Terra Nova over there) and I remember you were pretty good with scripting, but you took that looooong break and it's only natural for you to forget everything, so keep at it, and it will all come back to you.

 

 

I remember you. I was in the process of making a mod called Little Elsweyr. Videos of that mod are still on my toob channel. I stopped doing that mod because of more pressing life events. I did consider going back to it a few times but I didn't have rnough 'proper' time to devote to it and also because other modders where taking and making bigger strides than myself into Elsweyr related mods Beyond Skyrim for example - can't compete with those huys. So now I find I have time to start afresh and it is frustrating that things I used to know are now foreign language to me.

As usual the guys and gals here are doing a wonderful thing by helping me. Who knows, this time I may actually finish a mod.

 

"The past is a record of evolution. If we don't remember what our teachers taught us, how can we teach?"

Quite Me.

 

@maxarturo - Issues with forcing an item to equip are basically user-made items may f**k up and if player doesn't have the item then the player will be given one. First issue is a non-issue for me and the condition set in the choices presented should nullify this. Saying that I haven't tried altering the script yet.

Isn't there a way for the script at the point where player is told "You must equip a torch" (a torch that the player has) to simply 'bug out'/stop/end so player has to go to inventory equip a torch and start over?

Edited by antstubell
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...