How do I create a mission system?

Get help using Construct 2

Post » Fri Jul 18, 2014 6:39 pm

I didn't know what to write as topic name...

I want to implement a mission/task system into my game. Let's say 50 missions/task that the player must complete in order to receive exp or money or whatever.

Player will have to kill n number of enemies, explode things, collect n numer of items, etc.

With that said, I've been cracking my head trying to define if I should use JSON, XML, CSV (Rex's Plugin)... As I don't really know how they work. I've used ajax before on webpages but, only to save info to a database, and that was using JQuery, so I'm don't really get what is going on with the examples provided in the tutorials.

I'm leaning towards CSV, making a table where I have Text info for the mission, reward, task to complete, etc

So here's how I think I could do it:
Load the csv file as a String using ajax.
Do all Construct stuff to present the first mission to player... player kills 50 monsters and completes that mission.
Set the "completed" row in the csv string to 1 and continue to the following mission using another variable which stores current mission.

Now, this is where everything gets messy.
How do I save all that? I can use webstorage but, won't my info be overwritten by the On start ---> Load from csv file?

I don't know if what I'm writing makes sense. I can load, modify and set new values to the json string loaded from my csv project file. But how to save that info, so when the game is loaded again, player can check missions that are already completed?

I want it to be offline as I don't like that the game needs access to internet to be "fully played", and I don't know if I can alter my project file during runtime to save the new info. Can I alter a JSON, XML or CSV file during runtime?

Sorry for my english, hope you guys can help me or share some light on the subject.

Thanks.
B
21
S
5
G
3
Posts: 53
Reputation: 3,335

Post » Fri Jul 18, 2014 6:51 pm

With savegame and webstorage you can save all the changes you want.
Loading the CSV (If you decide on that) should therefor only be necessary the first time you play..

Load the savegame and set a variable to check before loading the CSV..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 19, 2014 2:37 am

Thanks @LittleStain

I think I was looking for confirmation, as I had doubts about the way I wanted to do things. I read a lot of stuff about xml, csv, and json so my head wasn't working properly. That means the file is only used once, am I right? Maybe I should just save to webstorage the mission number and its state "completed", "not completed" and keep loading al the text from the file. Guess I'll make some tests to see perfomance.

So, I still have one doubt, is it possible to save to a file during runtime on mobile devices? I won't be needing it but, just to clarify that point.
B
21
S
5
G
3
Posts: 53
Reputation: 3,335

Post » Sat Jul 19, 2014 8:01 am

Yes there is an action to save the game..
Saving automatically after a mission is completed or when certain goals are reached, should be no problem..
Just make sure it's a triggered event, I guess..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Kin, mickclarke, tinhofiel, TRMG, Yahoo [Bot] and 45 guests