Post new topic    
Slime Knight
Send private message
Scripting Imbecile Purgatory 
 PostWed Feb 14, 2018 3:38 am
Send private message Reply with quote
If you’ve played LinearQuest, you might have noticed I avoid scripting. If you’ve had the pleasure of patiently answering my n00b questions, you might have noticed I occasionally ask about certain scripting issues and then never actually implement that feature in my game.

I don’t know at this point whether I am somehow fundamentally incapable of grasping the concept, or if it just hasn’t been explained to me in a way I can comprehend - I have done the HamsterRepublic tutorial as well as the Moogle1 tutorial, but haven't been able to apply any of it in practice.

Now I am at a point where i have created the majority of a game, but cannot (to my knowledge) make a fundamental feature work without scripting. And, rational or no, I’m getting majorly discouraged by this pattern.

Does anyone have any good resources besides the two aforementioned tutorials that might help me wrap my head around how this all works?
...spake The Lord Thy God.
Liquid Metal King Slime
Send private message
 
 PostWed Feb 14, 2018 5:02 am
Send private message Reply with quote
I would be happy to try to help. Can you describe the feature you want?

And don't feel discouraged, learning scripting takes a lot of practice.
Slime Knight
Send private message
 
 PostWed Feb 14, 2018 6:19 am
Send private message Reply with quote
Ok, hopefully I can describe this in a way that makes sense:

There are 4 NPCs standing in a 2x2 square formation; each has its own unique side-quest to offer, which requires returning to the NPC and activating it individually.
When all 4 conditions have been met, a battle is triggered.
When the battle has been won, the 4 NPCs vanish revealing a 2x2 tile trapdoor where they had been standing.
Stepping on any of the 4 trapdoor tiles yields an identical effect (probably a text box, possibly another script).
...spake The Lord Thy God.
Metal Slime
Send private message
 
 PostWed Feb 14, 2018 6:36 am
Send private message Reply with quote
There should be a tag assigned to each NPCs sidequest (lets call them qc1-4, for "quest complete"). When you speak to an NPC they should call a script like :

Code:


if (check tag (tag: qc1) == 1 && check tag (tag: qc2) == 1 && check tag (tag: qc3) == 1 && check tag (tag: qc4) == 1) then
(
  set tag (tag: 4xqc, on)
)
else
(
  if (check tag (tag: qc#) == 0) then
  (
    show text box (x)
  )
  else
  (
    show text box (y)
  )
)


Let me explain:
Each of the 4 NPCs would have their own variation on this script.
First, the script checks if all 4 NPC sidequest tags have been switched on.
If they are, the script switches tag:4xqc on (stands for "4 x quests completed").
You would have the 4 NPCs present on the map if tag:4xqc = off, and at the same locations as the sidequest NPCS, have the trapdoor NPC but it only appears if tag:4xqc = on (I would have the four corners of the trapdoor drawn as the 4 frames of a single walkabout, and set the NPC to "don't change direction" when activated, and set to step on).

If the 4 "qc#" tags are not all switched on, the script then checks if that particular NPCs sidequest switch is on (qc#, with # being specific to the NPC).
If the tag is on already, they can show a message like "you've already done my sidequest, buddy!".
If the tag is off, show something like "go fetch my slippers", or whatever their particular task may be.
You will want to have the tag:qc# turned on when each sidequest is complete.

I'm not great at explaining scripting, but I hope this is helpful. Ask away if you have any questions, or wait for someone more able to explain this better!
vvight.wordpress.com
Chemical Slime
Send private message
 
 PostWed Feb 14, 2018 7:24 am
Send private message Reply with quote
TheLordThyGod wrote:
Ok, hopefully I can describe this in a way that makes sense:

There are 4 NPCs standing in a 2x2 square formation; each has its own unique side-quest to offer, which requires returning to the NPC and activating it individually.
When all 4 conditions have been met, a battle is triggered.
When the battle has been won, the 4 NPCs vanish revealing a 2x2 tile trapdoor where they had been standing.
Stepping on any of the 4 trapdoor tiles yields an identical effect (probably a text box, possibly another script).


Break your problem down into steps.

- all 4 conditions have to be met.
The game has to have some way of tracking this,

for example, each condition that is met adds 1 to a variable and the game checks after each condition whether that variable is 4 (1 for each condition/NPC)

Example. Add this to your script and assign it to each of the 4 NPCs
Quote:
global variable (one, conditionsmet)
plotscript, increase conditionsmet, begin
conditionsmet+=1
IF(conditionsmet==4)THEN(new script. call textbox. whatever)
end


another way is to use 4 switches. you don't need to use scripting.

- after the battle has been won.
The game can check this in a few ways.
But realistically you will ask for a sign (or proof) that the event really happened.

For example, if there is a specific loot drop, you can check for this in the inventory as proof that the fight was completed.

You can do this with item tags and textbox conditionals too.
Using invisible items* is an old-school technique to know and check a players state by looking in their inventory for an item
.
Quote:
IF(inventory(item))THEN(your stuff)


*you could also use slices instead of items. anything really.

Or you might have that battle turn on a switch (at any point during the battle) and then check for it.

- the npcs vanish.
So you could delete them, transform them, make them invisible and passable, teleport them off-screen. Whatever.
Slime Knight
Send private message
 
 PostWed Feb 14, 2018 6:19 pm
Send private message Reply with quote
Thanks, y'all. This advice should get me started, perhaps totally solve my issue. Will report back on how it goes.
...spake The Lord Thy God.
Display posts from previous: