WatchNon-threaded

Forums » Advanced Editor Forum » Read Message

Talk about it. Ask for help on it. Compliment it.

Random Item Drops Influenced By Stat

29 days ago
Not sure why this isn't working. Basically, I want one of two items to appear with a variable (LUCK) to influence the drop. Anyone see where I went wrong? I tried it as both a link script and global.

IF %LUCK = 1 THEN
BEGIN
%RAND := 1D100
IF %RAND > 0 THEN
IF %RAND < 50 THEN
$ITEMSTATE1 := 1 ELSE
$ITEMSTATE2 := 1
END

Random Item Drops Influenced By Stat

29 days ago
Do you really want something that sets %RAND to something different every time you click? Not sure what the exact issue is before I test it but I imagine you'll also need that to reset %LUCK.

Random Item Drops Influenced By Stat

29 days ago
I do. In the previous pages, %LUCK is defined a number (1-4) and I wanted it to have a direct influence on the %RAND item drop, so resetting it would kind of ruin my idea unless that's the only way to make it work. I planned on stacking the script with each point of %LUCK increasing the chances for the better of two items. The number "50" was just a test number.

Random Item Drops Influenced By Stat

29 days ago
I can't see anything wrong with that at a glance, except according to October's article, $ITEMSTATE can't be set in a link script, so I suppose you can rule those out. By setting Item #2 specifically to a number above 50 I can get that to show up in my inventory, but the same doesn't work for Item #1 when it's less than that. I'll keep messing with it but I imagine someone else who's actually good at this stuff will be able to see the issue immediately.

Random Item Drops Influenced By Stat

29 days ago
To begin with, you don't need the if > 0 line at all. It's going to be greater than 0 every time because that's how it works.

Random Item Drops Influenced By Stat

29 days ago
Makes sense. I feel like redundancy wouldn't break the whole link though... but this is my first experience with scripting.

Random Item Drops Influenced By Stat

29 days ago
That's what I thought too, but when testing it at least I had to add the > 0 back in because unset variables are treated like they're at zero by default.

An at any rate there's something else I can't figure out causing this not to work, even when removing it from global and breaking it down into sections of link and page scripts.

ITEMSTATE2 is always fine but ITEMSTATE1 ignored any scripting as far as I can tell. But then again there's a reason I hate using the default inventory system at all.

Random Item Drops Influenced By Stat

29 days ago
Moving it to the global page makes it work. Now I'm running into issues with the items themselves, but I suppose progress has been made lol. Thanks. Time to go read up on the item articles. Hope you enjoyed my working title.

Random Item Drops Influenced By Stat

29 days ago
Oh, Duh, it's the logic. If LUCK isn't 1 then all the code is completely skipped!

Random Item Drops Influenced By Stat

29 days ago
I had LUCK set to 1 by the first link in my test game. Sounds like Ninja's got it working now though, sort of.

Random Item Drops Influenced By Stat

28 days ago
IF %LUCK = 1 THEN
BEGIN
%RAND := 1D100
IF %RAND > 0 THEN
BEGIN
IF %RAND < 50 THEN
BEGIN
$ITEMSTATE1 := 1
END
END
ELSE
$ITEMSTATE2 := 1
END

Try that maybe?

Random Item Drops Influenced By Stat

28 days ago
Thanks. It works!

Random Item Drops Influenced By Stat

28 days ago
This makes me mad. All those BEGINS and ENDS might as well be completely random, there'd be about the same chance of figuring out how to do this *eventually*.

Random Item Drops Influenced By Stat

25 days ago
There, there Mizal. There, there.