Jump to content

Recommended Posts

Posted

Ok, need help. This is part of a larger script but this is the part I am having issues with. The items required are in a Message Form and are conditioned to only show if the player has at least 1 in his inventory. If the player has neither of the required items the message "You don't have required items" appears but the menu to choose (even though there are NO choices because player doesn't have the items so conditions are not met to show the items... menu appears anyway.

How can I stop the menu from appearing if the player does not have any of the required items?

 

 

  Reveal hidden contents

 

  • Replies 49
  • Created
  • Last Reply

Top Posters In This Topic

Posted
Have you thought of this alternative, for multiple combinations of items :

- Create two or three misc items (or how many you might need) that the fire will need for it to lit. The fire's script will need to "getitemcount" just those item you will create.

- Use the tanning rack to create recipes for creating the "misc items" needed.


This way you can create a large amounts of combinations and recipes while dettaching completly the large amount of items from the fire + having a small script, the only downside (not for me though) is that you need to create each misc item (mesh) for the recipes.


Your script :

  Reveal hidden contents


Posted

Thanks.

Line should be OR not AND

 

  Reveal hidden contents

 

 

All respect but I spent all day yesterday on this script, it is much larger than the part I posted and I really don't want to change the method of inventory checking that I am currently using but as said much appreciated.

Now I have to tie this part of the script with the rest... I may be back….

Posted (edited)
The difference between your code and the second is "Order" of things, much easier to read and write + execute script.
- First is saying = If player has less than one of the items show the message.
- The second is saying = If player has more than one of each item execute the functions, otherwise if none is in player's inventory show the message.
You first script corrected (small mistake) :
  Reveal hidden contents

 

Edit : typo...

Edited by maxarturo
Posted

Nearly there - I am doing my best here - 1 issue remaining. I have put notes in the script but basically the player is told to equip a torch, if torch was chosen to light the fire, but regardless of if the player equips it or not the script continues. I'll attach the complete script even though it is only the first part that I think needs fixing - also to show you that I am trying here.

There are a few notifications that is just for testing use and will be removed eventually.

 

 

  Reveal hidden contents

 

Posted
Can you write in order what you want the Script to do when activated :

A)...

B)...

C)...

...

Posted

A: Menu asks "What do you want to use to light the fire?" Based on conditions 1 or 2 options are presented. 'Torch' if player has at least 1 torch or 'Flint' if player has at least 1 piece of flint.

 

B1: If player chooses 'Torch' script checks to see if a torch is equipped. If player has a torch but not equipped then the player is prompted to 'Equip Torch' . This is the part where I need the script to stop/wait of some kind - reset?, quit? so player is aware that to use a torch it has to be equipped.

 

B2: Choosing 'Flint'', this is kind of a default option, if player has a piece of flint (I am aware of other issues arising as I am writing this), then the 'Equip Torch' option should not show and the script proceeds to the next menu. I am now aware that there is no means included to record what choice the player made.

 

C: Next menu presents player with a choice of 'kindlings' and 'accelerants' to use to start the fire. Options presented are based on conditions set in the message form. So far they are, if player has collected them all, Dry Rag, Oil and Bristles. If player has none of these then the script tells player "You don't have...blah, blah". If player has at least 1 of the kindling or accelerants, player chooses that option, 1 of that item is removed and fire is lit.

This 2nd menu appears to work perfectly.

Posted (edited)

I do not want to interrupt your discussion, but next could be helpful to reach your aim.

 

Script code like does not work properly:

    Int iButtonA = FlintOrTorch.Show()

    If iButtonA == 0 && (Game.GetPlayer().GetEquippedItemType(0) != 11)
        EquipTorch.Show()
        
        If iButtonA == 1               ; this condition is always False, notification cannot be shown
            Debug.Notification ("Flint Will Be Used To Light Fire")
        EndIf
    EndIf

this makes sense:

    Int iButtonA = FlintOrTorch.Show()

    If iButtonA == 0 && (Game.GetPlayer().GetEquippedItemType(0) != 11)
        iButtonA = EquipTorch.Show()                  ; edited !!!
        
        If iButtonA == 1
            Debug.Notification ("Flint Will Be Used To Light Fire")
        EndIf
    EndIf

and now I am using functions to group the script code and make them better reading/maintaining hopefully.

xyzSampleScript

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)
By all means ReDragon, do interrupt.


ReDragon post a very good Script example, now you have two scripts to choose and work on. (remember what i said about ORDER).


I didn't test or compile it :

  Reveal hidden contents



Have a happy modding !.

Edited by maxarturo
Posted

I was just in the process of replying so I haven't tried maxarturo newest script yet.

ReDragon scripts both work. The 2nd script I have no idea on how to add to it because items will be added later to the available kindlings and accelerants - but I guess he misunderstood what I wanted. I need that if the player chooses Torch to light fire then the torch MUST be equipped. If torch is not equipped then player needs to exit the script, equip a torch and start over. This video shows what happens if Player chooses Torch, is prompted to equip torch but script doesn't care and continues.

I think my comments in the script confused ReDragon. Player MUST equip torch to use torch.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...