Yeah, sure, but items don't have passive effects if you don't create them.
Another option is just increase %ATTACK by 2 on the page you get the first sword, then increase it again by whatever the difference is when you get the improved one (so if the second sword is 4, increase it by another 2). This stops your code being reliant on items, and so it is easier to do.
If you have some puzzle where they need to drop the sword early, then I think you could use a global script.
Global scripts can be ran before every page/link (or was it on every page/link?), so you can check the state of items and modify variables based on that. I'm a little iffy on the timing for this stuff, so beware undesired defects!
Here is an article on items: https://chooseyourstory.com/help/articles/article.aspx?ArticleId=66
Of note is:'The $ITEMSTATE variable can only be set to 0 or 1.
- 0 means that the item is not in your inventory.
- 1 means that the item is in your inventory.'
There are more articles under the Help & Info section.
Anyway, what I'd do is:
GLOBAL SCRIPT: IF %FOUNDSWORD = 1 THEN IF $ITEMSTATE1 = 1 THEN %ATTACK := %ATTACK + 2
IF $ITEMSTATE1 = 1 THEN %FOUNDSWORD := 2
%FOUNDSWORD starts as 1, so when you find the ITEM with id 1 AND have it in inventory it's state ($ITEMSTATE1) will be 1. This means I modify the attack based on the sword.
The second line also changes %FOUNDSWORD to 2, so that I don't keep increasing attack every page (and this is also done if the item state is 1).
GLOBAL SCRIPT IF %FOUNDSWORD = 2 THEN IF $ITEMSTATE1 = 0 THEN %ATTACK := %ATTACK - 2
Here IF you have found the sword already, and the sword is NOT in your inventory (the $ITEMSTATE1 = 0), then the attack needs to be reduced. If there is a way to get this sword again, you might want to reset the %FOUNDSWORD variable (so that attack can be increased again).
The issue with this system is that you'd need a extra variable for each sword, which could get annoying.
I'd just create these variables in scripts so their names can be longer than 10 letters (or so I hear), and have them be %FOUNDSWORD1 %FOUNDSWORD2 etc. This is kinda a bad implementation, but assuming it doesn't somehow cause lag, I wouldn't care.
The above seems to work for me, but I will note the timing for creating the variable in a script and having that noticed by global scripts is iffy, so I don't suggest having %FOUNDSWORD = 0 for the check (which is why I have it as %FOUNDSWORD = 1, since it stops my implementation from counting the attack boost twice).
ANYHOW, others might have a better way. I haven't really messed around with items much, so hopefully this gives you some ideas.
P.S. I don't recommend making an RPG, they tend to suck since just clicking a button to whittle down HP can be boring, but if you're determined, I won't stop you (as good storygame RPGs can exist, but it does seem to be a lot of work). This isn't what this thread is about tho, so I'll leave it at that. Good luck!
For context, this is the private message I've been trying to send RPGStar. I'm only posting it on a public forum so they can read it despite being banned. Otherwise, you don't need to pay any attention to this post.
Here's a copy-paste of the message:
If you're not Craynsford, ignore this message, and sorry for wasting your time.
If you are, I recommend just dropping the subject of the bans. I don't know if you ever received my response to your message last week, as I sent it after the Craynsford account was banned, but here it is copy-pasted:
"I see you were banned shortly after posting this, so I'm not sure whether or not you will receive this message. But I'll try and explain what's going on.
1) The culture of this site's forum is very different than most other places on the internet. People have no problem being rude and insulting to each other, and you need to have very thick skin about your questions and creative works when posting on the forum; that's just how things are done here. It's not meant in a personal way, it's just the culture of this site. However, as someone who is new to the site, I can see where this would be very confusing for you, especially given how many other internet forums have strict rules about politeness.
2) I'm a little confused by your thread later on where you said your account was a joke and were rude to mizal, as you seemed in earnest earlier about wanting to learn how to code. However, since you've been banned, I probably will never learn what was going on."
A couple points:
1) Admins can tell when the same person makes multiple accounts with the same computer, which is how mizal knew you were the same person. This kind of behavior is usually highly frowned on on this site, but is sometimes allowed.
2) You can't report these people, because nothing anybody is doing is against site rules. Many other internet sites have rules against this kind of behavior, but this one doesn't. There's nothing wrong with that, it's just a different website culture than you're probably used to.
3) You're almost certainly going to get banned again. I recommend coming back and making an alt account in a couple weeks after all this has died down. The admins will know it's you, but will probably give you a second chance. In the meantime, spend some time reading through the forums to get a good feel for what is considered acceptable behavior on this site.
Anyways, that's all I can think of for now. I'm rushing to send this before you get banned, so there may be typos.
Admins can tell when the same person makes multiple accounts with the same computer, which is how mizal knew you were the same person.