Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Trapped Chest...


Xinimator
 Share

Recommended Posts

I'm trying to script a chest to post a question when activated. if the player gets it wrong, they get zapped by lightning and the must find the spare key elsewhere. Problem is, I don't know scripting, so I don't know what's wrong with the script:

ScriptName RiddleChestScripta


Short doonce

Short button


Begin OnActivate

  If ( doonce == 0 )

    MessageBox "Blah Blah Blah...No peaking!", "Answer1", "Answer2", "Answer3", "Answer4"

    Set doonce to 1

  ElseIf ( doonce > 1 )

    Activate

  EndIf

End


Begin GameMode

  If ( doonce == 1 )

    Set button to GetButtonPressed

    If ( button == -1 )

      Return

    ElseIf ( button == 2)

      MessageBox "Your answer was correct."

      Set doonce to 2

    Else

      MessageBox "Your answer was wrong."

      Cast Mg05FingerSpell15 Player

      Set doonce to -1

    EndIf

  ElseIf ( doonce == 2 )

    Activate

    Set doonce to 3

  EndIf

End

By the way, I was following the tutorial on CS Wiki. Or at least trying to. :) I hate scripting...

So...help me? :please:

Link to comment
Share on other sites

*gasp* you hate scripting?!? :)

Anyways...... It would have helped if you would have explained what went wrong. I'm not exactly sure what is wrong because it's all different from the normal way I do messageboxes.

Since that it isn't working for you, maybe you can try this to see if it works:

scn RiddleChestScripta


Short Choosing

Short Choice




Begin OnActivate

 Set Choosing to -1

End




Begin Gamemode

 if (Choosing == -1) ;Display your menu

 Messagebox "Which option?" "First Option" "Second Option" ... "Fourth Option"

 Set Choosing to 1

 Set Choice to -1

 Elseif (Choosing == 1) ;Catch the player's decision

 If (Choice == -1) ;No choice yet

 Set Choice to GetButtonPressed

 Elseif (Choice == 2) ;your right answer

 activate

 message "Your answer was correct."

 Set Choosing to 0 ;to finish up

 Else ;all other options

 Message "Your answer was wrong."

 Cast Mg05FingerSpell15 Player

 Set Choosing to 0 ;to finish up

 Endif

 Endif

End

Link to comment
Share on other sites

My problem is that none of the scripts are saving for some reason. There's no errors as far as I'm aware of, but it just won't save.

How do you 'know' they are not saving?

Or do you really mean they are not working when playing in the game?

Please be descriptive of what is and is not happening.

Scholar note:

Did you want absolutely nothing to happen if the player chooses the wrong answer the first time? I usually put a message (without the box) saying the box cannot be used now. At the minimum. Otherwise a player may wonder why he/she cannot activate the chest at a later date.

Link to comment
Share on other sites

How do you 'know' they are not saving?

Or do you really mean they are not working when playing in the game?

I think he means that the when he saves, no errors pop-up, but when he goes to exit the script window a prompt comes up asking you to save the script. If you say yes, save, and try to exit then it pops-up again, endless loop. And if you click no, the script doesn't save. It's happened to me a few times, and that's what I assumed his problem was...

Please be descriptive of what is and is not happening.

Yes, please, we can't do much with your description...

Link to comment
Share on other sites

I think he means that the when he saves, no errors pop-up, but when he goes to exit the script window a prompt comes up asking you to save the script.

In the many years of helping people with scripts, I try not to assume anything. It usually just leads to confusion from not understanding the issue that is 'really' happening. :unsure:

So, I try to start back at the beginning with the basic questions and ask what is really happening. :thumbup:

Link to comment
Share on other sites

I create the script like normal and when I click save, no pop-up errors occur. The only problem is I know it's not saving because it is not prompting me to create a unique ID for the script. I did get one script to work sometime in the past (that was to activate a journal entry for a tiny quest) and I remember how it prompted me for a unique ID before I could completely save the script.

Since CS did not prompt me for a unique ID, the script is not saving for some reason. Dunno why, but that's what's going on. :thumbup:

Link to comment
Share on other sites

I create the script like normal and when I click save, no pop-up errors occur. The only problem is I know it's not saving because it is not prompting me to create a unique ID for the script. I did get one script to work sometime in the past (that was to activate a journal entry for a tiny quest) and I remember how it prompted me for a unique ID before I could completely save the script.

Since CS did not prompt me for a unique ID, the script is not saving for some reason. Dunno why, but that's what's going on. :thumbup:

I'm not sure if this is the problem but try to click the pencil symbol for the script window then file>new and then write your script there and save.

If you start creating a new script off of an existing script the script editor will not recognize it as a new script, even if you change the text after the "scn" or "scriptname". You must make a new, blank script, just ctrl+c to copy the contents from one script to the other if you need it.

If that's not the problem then I'm not sure whats going on aa_mellow.gif

Link to comment
Share on other sites

I have never been prompted when I create a 'new' script.

The fact that you give is a new 'scn' name is all you need.

The only time I am prompted for anything is when I already have a script with the same name. It then makes a 'copy' of that script.

Only 'objects' prompt you for a new object, and only when you are copying one object to a new object.

You need to try it out in game to see if its working or not. And, if you can attach the script to an activator, then you also know its been saved.

Link to comment
Share on other sites

I think I know whats wrong, are you making the new script via the object you are attaching the script to? [via clicking the 3 dots and going new at the top?], because that does not work when you try to save, when you make a new script you want to click the pencil on the tab, then make your script and save, then open up the objects menu and give it the script.

Am I correct?

Link to comment
Share on other sites

I tried that. It's still not saving. :P

Eh, if it's this much trouble to create a script for a trapped chest, then I'll worry about it later after I get some more scripting under my belt. :P Maybe I'll find out the answer in the near future.

But other than that, I'm not going to worry about it. Skeletons will do the job just as well. ;)

Link to comment
Share on other sites

:) Boy, I don't know how many times I'm going to kick myself in the butt tonight....

I was looking in the wrong place. Oh my god... :doh:

Well, everything's back to normal. I learned a thing or two over the past several days: Look everywhere. Turns out it was saving after all. :doh: Oh my god....

I am so sorry I put you guys through this whole mess. :blush: Me and my very short attention span...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...