Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Door that asks the player a question

Author
Message
fallen one
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 11th Apr 2007 00:09
The door will ask a multiple choice question. the player will press A,B,C or D to answer, if the player gets it right the door will open and the player is rewarded with extra health, if they get it wrong it will give them a shock and take some heath away from the character.

The questions are picked randomly from a .xml document that has a big list of many questions and the correct answers on the spread sheet.

Is this possible at all? it will perhaps need a custom script, or perhaps there are workarounds, any ideas on this one?
Slayer Simon
18
Years of Service
User Offline
Joined: 11th Oct 2006
Location:
Posted: 11th Apr 2007 00:31
This should be on the scripting board.
FredP
Retired Moderator
18
Years of Service
User Offline
Joined: 27th Feb 2006
Location: Indiana
Posted: 11th Apr 2007 00:59
Moving to the scripts forum.

Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 11th Apr 2007 21:14
fallen one,

Greetings. This should be very possible to script.

I am out of town. When I return to my computer, I'll see if I can put together a script that performs the functions that you are seeking.

Thanks,

Seth Black

"...I'm sorry, could you repeat your question a little louder? I'm a trifle deaf in this ear."

- Willie Wonka
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 12th Apr 2007 01:51
u cant read the questions randomly of an xml file, you would have to generate a random number in the fpi, and once given a certain number, trigger a state, then you show a HUD image with that question on

evil lies within all of us...we just don't know it yet

www.freewebs.com/3dfpsc
fallen one
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 12th Apr 2007 02:02
You would shock me if you did Seth, either your very good at coding or the language that is used in fpsc is very simple to work with.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Apr 2007 02:03 Edited at: 12th Apr 2007 02:09
Here's how you do it...

(1) Save this
as a FPI file.

(2) Place a Remote Door in your map and rename it to something unique.

(3) Place a Trigger Zone in front of the door.

(4) Put the door's unique name in the IFUSED attribute of the Trigger Zone.

(5) Set the FPI (the script above) to the Trigger Zone's AI MAIN.

(6) Create your HUD's image (the question's graphic) and place it in a unique folder. Notice I used the path gamecore\huds\conjured\question.jpg in the above script example. The path is really ... languagebank\english\gamecore\huds\conjured\question.jpg but you don't need to put the languagebank\english part in the path in the script. Just remember to put your image in the right place.

(7) Make sure you edit the script to point to your image's path.

(8) Edit the health values if need be too, before you save the final version of the script.

(9) Try it, and have fun!


P.S.
The script uses the letter 'A' for the correct answer.
You can edit that too in the state=2 part of the code.

:state=2,scancodekeypressed=30:state=3
:state=2,scancodekeypressed=48:state=4
:state=2,scancodekeypressed=46:state=4
:state=2,scancodekeypressed=32:state=4

They are listed in order A,B,C,D so just make the state=3 for the correct one and the rest state=4.

Don't forget to visit Conjured Entertainment
fallen one
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 12th Apr 2007 14:50
That's a really cool example for one question, but what I want to do is have the door choose from a list of questions, like have lots of questions, like at least 50 +, and then for it to randomly choose a question, the questions are in a spread sheet.
It would pick a random question and you have to answer.
Questions are like this below.
An example database saved in MS Excel format.

http://www.freequizzes.co.uk/images/database.xls

If you get it wrong you lose health, get it right and you win health and the door opens, later on you may find another door like this, and it will do the same again, it will randomly pick one of the questions from the list and do as before.

I want to repeat this lots of times and have lots and lots of questions for it to randomly pick an answer from, but be done in an easy way, the best way I think is if it takes its info from like a database like above, you see how its set up, using a database like this it can go through it to pick its questions and the answers etc.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Apr 2007 19:49 Edited at: 12th Apr 2007 19:55
Sorry, I overlooked the random and XML parts of the question.
How about this instead?...

Since there are only 4 possible choices then it's really random to only 4 types of questions.
In other words, out of your 50+ questions, lets just say 60 for this example, not all would be answer A.
If we had 60, then say 15 would be A, 15 of them would be B answers and so on.

So, what does this mean?
It means we can do them all in a script without the database or XML.

My thoughts are this, first lets do a Random=4, Random=3, Random=2, Default to decide which type of question.
If our Random=4 turns up a one then we goto the A's section fo our script. (I'll explain the sections in a minute)
If it wasn't a 1 in the first check then we check again out of the remaining 3 groups.
If our Random=3 turns up a one then we goto the B's section fo our script.
If not then Random=2 would send us to the C section and if not then we goto to D by Default.

Now our first part of the code has reduced your 60 questions to only 15.
Now the second part would be the four different sections that each do a Random=15 and on down like we did before.
Only this time we are randomly choosing which question to display.
Reagrdless of which of the 15 questions that is displayed, the routine to check for the answer would be the same.
Because all 15 of those questions have the same answer.

So, once we have picked the group (answers A, B, C, D) then we pick a random question to display whose answer represents that group, and send them to that one of four key entry checks.


If I lost you do not worry, because I think this Idea warrants exploration.
I had ideas like this 'back in the day', but that was before we had a scancodekeypressed=x
I think I will attempt scripting this too.
However I may start with less questions, say like 4 of each answer for a total of 16.
This method is dynamic because the images names can be numerical, thus changing a question qould be as simple as changing the image in the files. As long as that image's question has an answer that fits into that group. (A,B,C or D)

Don't forget to visit Conjured Entertainment
Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 12th Apr 2007 20:06
fallen one,

Quote: "You would shock me if you did Seth, either your very good at coding or the language that is used in fpsc is very simple to work with. "


I would've probably tried an approach similar to Conjured Entertainment's.

I'm not really a coder. I have never made that claim.

The .fpi scripting isn't exactly rocket science. I've been able to get some desired function out of it, now and again. It is limiting, however.

Thanks,

Seth Black

"...I'm sorry, could you repeat your question a little louder? I'm a trifle deaf in this ear."

- Willie Wonka
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Apr 2007 20:09
Quote: "I would've probably tried an approach similar to Conjured Entertainment's."


What do you mean would have???
You not getting out of this that easy pal.
Let's both do one. Not as a race or anything.
Just to demonstrate that there is more than one way to skin a cat, errr i mean script a door.

Don't forget to visit Conjured Entertainment
Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 12th Apr 2007 20:16
...let it go. I am not trying to equate myself to you...

I was only answering his response. I might have tried an approach similar to yours. Yours is yours...

...chill...

"...I'm sorry, could you repeat your question a little louder? I'm a trifle deaf in this ear."

- Willie Wonka
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Apr 2007 22:33
I'm done.
My script anyways.
As I said before I made 16 questions.
4 questions have answer A, four have B, and so on.
It picks one randomly, and then checks your answer.
It works fine.

I recommend however to change the keys from ABCD to something else.
Why you ask? Because you give an instant answer if you strafe into the trigger.
It's not good having our input keys being shared with player movement controls.

Anyway,
I was chilled Seth, and no I wasn't trying to compete.
You had dibs on this, but I wanted to try it too because I have wanted to for some time.
This thread reminded me of something.

I will zip up the 16 images that I used for questions just because it will make it easier for you to test.
(unless you want to create 16 images from scratch)
Each question is just labeled by Number and the Correct Answer, ie..

Question # 1
Answer A

I did not make up real questions and answers for the test.
I just needed to know which questions it was picking and the answer associated to it.

Once I zip everything with instructions, then I will post it here.

Don't forget to visit Conjured Entertainment
fallen one
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 12th Apr 2007 22:53
That's pretty cool, but what I was thinking was for like huge amounts of questions, like a quiz, too many to do having an image for each question, what I was looking at is combining a quiz game with a 3d action game, you could do it in something like gamemaker, but its 3d side is a bit iffy, fpsc has good 3d, but perhaps its core manipulating ability is less.

The way you come up with is great for questions, but for a quiz it would be lacking as you have like hundreds of questions, it would take forever to make all the images of the questions.

If it could be done it opens up new games ideas for fpsc, you could have a head asking you general knowledge questions and then giving you forfeits or making you play mini games and stuff, it would make something a bit different that what is normally made in fpsc, plus I think it gives it an option that isn't even seen in high end editors.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Apr 2007 23:18 Edited at: 13th Apr 2007 04:33
Quote: "The way you come up with is great for questions, but for a quiz it would be lacking as you have like hundreds of questions, it would take forever to make all the images of the questions.
"


You can whip up an image for each question. (jpg's are very small)
It only takes about 2 minutes each question (if you have the material already) to create the image.

Note also that with modification this script is capable of many questions, because you can have more scripts.
16 scripts with 16 questions each would be a total of 256 questions.
Its just a matter of how many doors you want them to go through.
Then each set you get more difficult, , but anyway you don't care about that.

Here's a download guys, so try it out.
I hope the instructions and the script's simplicity will make for easy installation.
Let me know if I made any mistakes like typos or something.


Edit
Is anybody going to try this thing?

Quote: "Is this possible at all? it will perhaps need a custom script, or perhaps there are workarounds, any ideas on this one? "


You did ask for workarounds, and this is my way of working around XML and external forces.

~ ~

Don't forget to visit Conjured Entertainment

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 13th Apr 2007 19:08
@ fallen one,

The problem is of course the database thing. Very simply put, we have access to the engine through a limited scripting language (fpi script) and not access to the engine or exe itself. There is currently no way for us to create, alter or access files outside the program through this script. That's why it would be a more complicated process than what you would like.

@ Conjured,

You work is inspiring and your little lesson here gives great insight into the "random" aspect of the script, something I always have problems with. Thank you!

Best.

I'm sorry, my answers are limited. You must ask the right question.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 13th Apr 2007 21:16 Edited at: 13th Apr 2007 21:23
YAY!
It actually helped someone!

Thanks for the kind words Xplosys.
I have always had problems with the random thing too (and many others), and I still do.

I'm going to tweak this thing and build on it.
This can be used in so many ways.

Edit
Dude it's Friday the 13th!!!
I need to break out the Jason movies.
Chase Chase Chase Chase, Run Run Run Run

Don't forget to visit Conjured Entertainment
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 14th Apr 2007 01:39
Conjured,many thanks for knocking this up,I wont have time to test it right away but I have downloaded it and will most certainly have a use for it later on.
best rolfy.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 17th Apr 2007 10:28
@ CE

Quote: "Is anybody going to try this thing?"


I'm going to try it. Thanks dude.

As opposed to Highlander.
Nue B
19
Years of Service
User Offline
Joined: 20th Nov 2005
Location: Indy
Posted: 27th Apr 2007 19:40
Fallen One

I haven't read through every reply you've recieved to your question, but if you still need help, I can help you. What you're asking for is what I do with the CuStM HuDz I script. I don't mean to hijack your tread, but I thought you should know that I have an Demo you can freely download. It'll give you an idea of weather I can be of help. I can make the huds and the scripts for you without using trigger zones. shoot me an e-mail if your interested.

MaxxGames
17
Years of Service
User Offline
Joined: 25th Apr 2007
Location: Your backyard!
Posted: 28th Apr 2007 00:48
yea, im with Nue B, his script owns!

Kewl!
fallen one
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 28th Apr 2007 22:16 Edited at: 28th Apr 2007 22:17
Thanks, Ill try this out when I get time from everything, so busy at the moment.

This is something from 2d games creation that I use for games, in 2d programs its easy enough, but I wanted to look at if it can be done in 3d. One of the games markets I'm looking at uses spread sheet documents for questions to be asked in the game, they have access to the spread sheet files, and change the questions when they please, so it has to be able to access the files, I have some programmers finishing off some 2d games and when they are done it will go to the potential client, they have an NDA in place before they talk and are very guarded, so I don't know everything on what kind of set up they are using till I get the 2d games done for that, I looked into it for some 3d games options so I wanted to know if it was possible in fpsc, it needs more looking into and getting the full details from the clients.

I'm a bit busy at the moment with the Definitive skin pack so I havnt had time to look into this, Ive got the first pack underway, it will take me about a week to do, after that Ill see how popular it is, if its good Ill do a second one for a male figure, If that goes well I have lots of spare textures from a game that was over produced for so ill make the spare textures into segments and put them out in a pack as well, that should have things done quite well for fpsc, 2 packs for skins that cover most possible characters and Ill do something similar for segments, so overall I hope that will bolster the community with a lot of content for games creations.

Login to post a reply

Server time is: 2024-11-23 16:35:53
Your offset time is: 2024-11-23 16:35:53