[SOLVED] Series of lessons help

CheshireTiger
01 Jan 2020, 20:53

So im using an npc to give Player Character skills, but ive hit a snag with it.

Changed my mind: now trying to set and use Attribute "skills" with number value to keep track of what skills i have/get. Never used attribute scripts before though...


XanMag
02 Jan 2020, 05:09

Quick question:

Are you unsetting flags when new ones are set or are you setting flags on top of other flags?


CheshireTiger
02 Jan 2020, 16:01

Here is what I'm looking at:

Npc lessons:

if (Kurota.Skills = 0) {
msg ("Dalia teaches you how to slash while running past enemies. She says its a simple teqnique compared to other things she can teach you...")
PrintCentered ("~NEW SKILL: Dash & Slash~")
set (, "Skills", = 1)
}
else if (.Skills = =1) {
msg ("After telling Dalia how you handled the trapper, she helps you work on that skill until it affects a wider area.")
PrintCentered ("~NEWSKILL: Breeze~")
}


mrangel
02 Jan 2020, 16:33

Is that an actual copy/paste from code view? Because there seem to be a few object names missing, and a couple of extra = operators.

I assume it should be something like:

if (Kurota.Skills = 0) {
  msg ("Dalia teaches you how to slash while running past enemies. She says its a simple technique compared to other things she can teach you…")
  PrintCentered ("~NEW SKILL: Dash & Slash~")
  set (Kurota, "Skills",  1)
}
else if (Kurota.Skills =  1) {
  msg ("After telling Dalia how you handled the trapper, she helps you work on that skill until it affects a wider area.")
  PrintCentered ("~NEWSKILL: Breeze~")
}

I've highlighted where I added or removed in the code (and also corrected a spelling because I'm too pedantic).
I assumed that as you're looking at the Skills attribute of the object Kurota in the first if statement, it should be the same object later on.

It may be useful to know that the line:

set (Kurota, "Skills",  1)

is exactly the same as

Kurota.Skills = 1

Most people will use the latter form, because it's quicker to write. set is more useful if you are getting the name of the attribute from a function or a variable.

Also, when posting code in the forum, it is useful to put a line of 3 backticks above and below it, like this:

```
code goes here
```

That stops the forum messing up the formatting, and makes your post easier to read. On most keyboard layouts the backtick is on the key immediately below the 'Esc' key; or you can find three of them to copy-paste in the instructions to the right of the textbox on the forum.


CheshireTiger
02 Jan 2020, 22:33

IT WORKS
i also learned to replace the = with -/+/</> for those functions
Thanks