Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Scripting an item so that it drops everytime on...

11 years ago

I need to script an item so that it drops every time on the same page every time you click on that page.

But only if I have 3 or less of the same item in my inventory.

If I have more than 3 of the same item, it stops dropping on the same page.

Anyone know how to do that?

Thanks. 

Scripting an item so that it drops everytime on...

11 years ago

You figure this out yet?

Scripting an item so that it drops everytime on...

11 years ago

No, but I figure out an alternative that let's me drop that item on the same page once it's use up. 

I guess that could work too, but it would be nice, to have an infinite item drop on the same page, without having to make the item an infinite times on my item tab. 

Scripting an item so that it drops everytime on...

11 years ago

When you say 3 of the same Item, do you mean 3 Uses of a Single Entered Item or do you mean 3 Separately Entered Items?

Scripting an item so that it drops everytime on...

11 years ago
I believe he means 3 items, like 3 items with the ITEMSTATES of 1, 2, and 3, but might be rong. I'm trying to think up a script for this right now, but at the same time I'm working on this zombie survival game I've been working on for the last couple of days.

Scripting an item so that it drops everytime on...

11 years ago

With Multiple Item Entries

IF $PAGEID = 100 THEN
BEGIN
%ITEMCHK := $ITEMSTATE1 + $ITEMSTATE2 + $ITEMSTATE3 + $ITEMSTATE4 + $ITEMSTATE5 + $ITEMSTATE6 + $ITEMSTATE7 + $ITEMSTATE8 + $ITEMSTATE9 + $ITEMSTATE10
IF %ITEMCHK = 0 THEN
BEGIN
$ITEMSTATE1 = 1
$ITEMSTATE2 = 0
$ITEMSTATE3 = 0
$ITEMSTATE4 = 0
$ITEMSTATE5 = 0
$ITEMSTATE6 = 0
$ITEMSTATE7 = 0
$ITEMSTATE8 = 0
$ITEMSTATE9 = 0
$ITEMSTATE10 = 0
END
IF %ITEMCHK = 1 THEN
BEGIN
$ITEMSTATE1 = 1
$ITEMSTATE2 = 1
$ITEMSTATE3 = 0
$ITEMSTATE4 = 0
$ITEMSTATE5 = 0
$ITEMSTATE6 = 0
$ITEMSTATE7 = 0
$ITEMSTATE8 = 0
$ITEMSTATE9 = 0
$ITEMSTATE10 = 0
END
IF %ITEMCHK = 2 THEN
BEGIN
$ITEMSTATE1 = 1
$ITEMSTATE2 = 1
$ITEMSTATE3 = 1
$ITEMSTATE4 = 0
$ITEMSTATE5 = 0
$ITEMSTATE6 = 0
$ITEMSTATE7 = 0
$ITEMSTATE8 = 0
$ITEMSTATE9 = 0
$ITEMSTATE10 = 0
END
IF %ITEMCHK = 3 THEN
BEGIN
$ITEMSTATE1 = 1
$ITEMSTATE2 = 1
$ITEMSTATE3 = 1
$ITEMSTATE4 = 1
$ITEMSTATE5 = 0
$ITEMSTATE6 = 0
$ITEMSTATE7 = 0
$ITEMSTATE8 = 0
$ITEMSTATE9 = 0
$ITEMSTATE10 = 0
END
END
 

Scripting an item so that it drops everytime on...

11 years ago

What does that say in English?

When I said I want multiple items of the item item drop on the same page I meant, if say, for instance, a sword is drop on page 1, and I pick it up. If I go back to page 1 for some reason, the sword will still be there, and at the same time, it will be in my inventory, if I had not sell it, or drop it. If I pick it up again, I will have 2 swords in my inventory, and so on. 

It's the same item, just that it drops every time you visit the same page. 

Scripting an item so that it drops everytime on...

11 years ago
I don't believe that's possible.

Scripting an item so that it drops everytime on...

11 years ago

You are correct (mostly)...

For Each Item that you enter into your Item List, you get 1 (and only 1) instance of it in the Inventory. It is either not in the inventory ($ITEMSTATEX = 0) or in the Inventory  ($ITEMSTATEX = 1).

If you want multiple Icons of the "same" Item to show up in the Inventory, then you need to make Multiple clone entries of that same Item in the Item List (1 for each instance of it you want to show in the Inventory).

You could however, make one Item (Say SWORDS) and then set it to record how many of them a Player has - in other words, 1 Icon in the Inventory, that when opened, says "you have X number of Swords".

Using the later would be the easiest, but requires you to create a separate %Variable to keep track of how many Swords the Player has.

Scripting an item so that it drops everytime on...

11 years ago
Yeah, I suppose you could do it that way.

Scripting an item so that it drops everytime on...

11 years ago

IF $ITEMSTATE1= 0 THEN 

BEGIN

$ITEMSTATE1= 0

END

Say if item 1 is drop on page 1. You pick it up, and use it. It then disappears from your inventory. Then you go back to page one.

Will the item be there if I use the above code? 

I'm thinking that it translates to, if item 1 is not in your inventory, then it is on the page that it was drop. 

 

 

Scripting an item so that it drops everytime on...

11 years ago

What the code literally says is that if an item is not in your inventory, then make sure its not in your inventory. 

Scripting an item so that it drops everytime on...

11 years ago

What about

IF %ITEMUSE1 = 1 THEN

BEGIN

$ITEMSTATE1 :=  0

END

Does that translate to, if the item is use 1 time, then the item will not be in the inventory, and reverts back to the page it was drop?

If that is what it translate to, is there another way to write it? 

 

Scripting an item so that it drops everytime on...

11 years ago

You're thinking about it wrong. Dropping an item doesn't store it on the page it was dropped to begin with. It just enables you to be able to go back to the page it was originally on, and pick it up.

Scripting an item so that it drops everytime on...

11 years ago

I mean, the page found on, yeah. 

Scripting an item so that it drops everytime on...

11 years ago
No, I think when you drop an item you can not find it anymore.

Scripting an item so that it drops everytime on...

11 years ago

Sure you can -

Instead of Setting an Item to appear on a certain Page with the Drop Down on the Item Screen - just ignore that (leave it blank) and tell the game which page to leave it on in the Global Page Script.

IF $PAGEID = 100 THEN $ITEMSTATE10 := 1

Scripting an item so that it drops everytime on...

11 years ago

Wouldn't that make it so that if you go to page 100 then item 10 would automatically appear on your inventory? Instead of it just being on the page? 

Scripting an item so that it drops everytime on...

11 years ago

Yep.

What you need is the $ITEMPAGE or whatever it is called (and I don't remember atm) - maybe Killa knows?

Scripting an item so that it drops everytime on...

11 years ago

Yeah, according to Alex's script reference, $ITEMPAGEID exists, which I assume is the page you pick the item on. Unfortunately, it doesn't seem to work though.

Scripting an item so that it drops everytime on...

11 years ago

So it's impossibel then? 

Scripting an item so that it drops everytime on...

11 years ago

So we can't script it so that once you buy something from a store, use it up, and come back to the store for more of the same supplies, it won't show up? 

Scripting an item so that it drops everytime on...

11 years ago
Man, you can just use the global page script or the page script of the shop or whatever to put the item back in your inventory there's no other way!

Scripting an item so that it drops everytime on...

11 years ago
I would so love it if someone created an easier to understand version of that.

Scripting an item so that it drops everytime on...

11 years ago
Actually, we could use a link to do just that, but the item would appear immediately in your inventory, instead of having you pick it up. 
$ITEMSTATE2 := 1
$ITEMUSED2 := 0

Scripting an item so that it drops everytime on...

11 years ago
Nope. $ITEMSTATE no work on links. Use, the, shop's, page, script! That, is, the, only, way! Do you want me to bold it? I might be being too harsh here, but it's the only way as far as I can see and everyones tried to help you and this is the biggest thread I've ever seen in the advanced editor forum.
IF $ITEMSTATE1 := 0 THEN
$ITEMSTATE1 := 1

Scripting an item so that it drops everytime on...

11 years ago

...

Well, it did work for me...

I just set the $ITEMSTATE to 1 and the $ITEMUSED TO 0, and it automatically appears in my inventory...

Scripting an item so that it drops everytime on...

11 years ago

Take a look at Dungeon Stompage! for some Ideas - that game uses auto Inventory Placement, like what you have noted above (using Item Uses, rather than Itemstate to pop Items on and off the game).

Personally, I prefer that to the pick up and drop method anyway.

Scripting an item so that it drops everytime on...

11 years ago

I already played it. 

It was one of the first few games I played since stumbling onto this site. 

It's a good game. I think I gave it 8/8?

Anyway, I only need to use it because the opponents in my games are really tough you if didn't pick the option for training in the woods when you're growing up, so I thought about dropping infinite amounts of health potions if you defeat you opponents, AND if you don't already have it in your inventory. It's working, for now, I guess.