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?
Scripting Imbecile Purgatory
Moderators: marionline, SDHawk
- TheLordThyGod
- Slime Knight
- Posts: 218
- Joined: Thu May 14, 2015 9:18 pm
- Location: Muscle Shoals, AL, USA, Earth, Solar System, Milky Way, Known Universe
- Contact:
Scripting Imbecile Purgatory
...spake The Lord Thy God.
- Bob the Hamster
- Lord of the Slimes
- Posts: 7658
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
- TheLordThyGod
- Slime Knight
- Posts: 218
- Joined: Thu May 14, 2015 9:18 pm
- Location: Muscle Shoals, AL, USA, Earth, Solar System, Milky Way, Known Universe
- Contact:
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).
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.
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 :
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!
Code: Select all
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)
)
)
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!
Last edited by guo on Wed Feb 14, 2018 6:37 am, edited 2 times in total.
vvight.wordpress.com
- SwordPlay
- Chemical Slime
- Posts: 966
- Joined: Sun Jan 22, 2017 9:32 am
- Location: London, England
- Contact:
Break your problem down into steps.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).
- 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
another way is to use 4 switches. you don't need to use scripting.global variable (one, conditionsmet)
plotscript, increase conditionsmet, begin
conditionsmet+=1
IF(conditionsmet==4)THEN(new script. call textbox. whatever)
end
- 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
.
*you could also use slices instead of items. anything really.IF(inventory(item))THEN(your stuff)
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.
Last edited by SwordPlay on Wed Feb 14, 2018 7:44 am, edited 9 times in total.
- TheLordThyGod
- Slime Knight
- Posts: 218
- Joined: Thu May 14, 2015 9:18 pm
- Location: Muscle Shoals, AL, USA, Earth, Solar System, Milky Way, Known Universe
- Contact: