Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
TwoAcross

Items interacting with environment

Recommended Posts

Well. Quoting myself on another forum:

 

So, what I'm about to describe is something I'm pretty sure I saw somewhere, but I can't, for the love of everything, find it anywhere.

 

What I'm looking for is a script that will make using a specific item next to an event produce an effect. You can see this in Chrono Cross, when you press a button, a key item menu opens up and you can choose an item to use. For example, an NPC needs a certain item, and in order to give it to him, you need to approach him, open the menu, choose the item from the list and "use" it.

 

Is there nothing like that floating around? I've been searching for an hour and a half now, but it must be in all the wrong places.

 

That pretty much sums it up. If anyone knows such a script or thinks it could be done, any help would be GREATLY appreciated.

Share this post


Link to post
Share on other sites

That would be the easy way around it. However, it's less doable when you want to do items with multiple purposes. Say I want to have an item like matches, or flint and stone, and with it I can light any of the torches in the game. Gets worse when you have many items with many different effects on various surroundings.

Share this post


Link to post
Share on other sites

I do still think its possible to do with a good event code, and maybe a mix of scripting.

 

THEORY: ok so basically do what our friend suggested, but instead of leaving it at that, just form a script that calls the items window, and handles selecting items as setting a variable.

 

you can then check that variable, and have coding respond to the way you want.

 

 

... I know - easier said than done. But im sure if you look into it, it maybe pretty simple to do for basic scripters.

Share this post


Link to post
Share on other sites

Easiest way to do this:

 

Build a scene that will call the map's spriteset in the background, and have a window pop up with all the items. Set it so when you select one with the scene, it stores that item's ID into a game_varaible. Then, set the event so when you go to it and hit 'Enter', it will pull up the scene, then switch to page 2. On page 2, have a code set with a conditional branch (or set of branches) that, if the ID matches that condition, it triggers, else, give a message saying it's teh wrong item and clear the variable, resetting the page back to 1.

 

I've had to build this code as part of a system I have been developing...

Share this post


Link to post
Share on other sites

It's best to find a scripter to develop a script for you.

I know how it is to be done, you guys are along the right lines, but off the top of my sleep deprived head it was require independent events on each map with key item usage available, 2 common events, and two variable per key item.

Share this post


Link to post
Share on other sites

Okay, what Leon said works rather well, but there's a problem that I can't really build scripts from a scratch. I can edit them and tune them to my wishes pretty successfully, but it's all basic stuff, I'm not sure if I could build the key-item scene.

 

Another this is that, if this menu is doable, I'd like it to be accessed with a different button press (since I'd like the item to react normally when you examine it with a normal C/Enter button press), though this is probably easily done, especially with the keyboard input script.

 

EDIT: Hm, this could work. Make a condition branch with the button A pressed, for example, and when it is, the scene opens, when it isn't, the objects reacts normally. This would, however, make the player have to press A AND C to access the item menu, which is kinda unintuitive.

Edited by TwoAcross

Share this post


Link to post
Share on other sites

^

not really, you can have different events. for instance, you can have the event for the "a button conditional branch" be a "event tile" next to the actual interactive object.

 

so basically when you're on the tile to the west of the object:

 

when facing right

when button: A is pressed

open menu.

 

 

 

and have the ACTION button for the OBJECT itself:

 

show text: "Hmm... I think i can interact with this..."

 

or you can even make use of multiple purposes for the object =D

Share this post


Link to post
Share on other sites

Huh, that's good actually. The sheer amount of events might murder the speed since I'd have to have four events around the object if it's not next to a wall, but I'll just fix it by making maps smaller.

 

By the way, if anyone figures out some easier way or is willing to make a script for the item menu with the map in the background, I'd be incredibly grateful. And yeah, I know gratitude is not much, but hey, I don't know what to offer but credit.

 

EDIT: Actually, I managed to create a window, but 1) I'm not sure how to make items appear in it. I had a look at Window_Item and Scene_Item and did some copy-paste-modify work, but the items don't show up when the player gets them. Also, 2) I don't know how to make the map stay in the background.

Edited by TwoAcross

Share this post


Link to post
Share on other sites

There is no need for you to script anything or get anyone else to, for I am sure I have seen a script that does this.

 

I don't remember what it is called, but I'm sure it exists. So search, and you will find. ;)

Share this post


Link to post
Share on other sites

YES, someone else who did, thank you!

 

But that's the thing, I've been searching for days now and can't find it. I'm not even sure what to search for anymore.

Share this post


Link to post
Share on other sites

I don't know man, but I am positive its out there, so at least you have assurance. :3

Share this post


Link to post
Share on other sites

Alright, thanks, I'll take a harder look.

 

While I'm searching, can anyone just give me a quick idea on how to call a new scene using a button press whenever I'm on the map? As in, make the X button open the item menu directly.

 

EDIT: Also, the multiple event thing doesn't work. If I set the condition for the X key input, and the direction to the right, the thing will only trigger if I'm holding the button while walking over the tile. (assuming it's player touch trigger, nothing else can really work)

Edited by TwoAcross

Share this post


Link to post
Share on other sites

Pretty much. But consider this, the object I want to interact with is surrounded by nothing. I'll have to have eight different conditional branches (X, Y for four spots around the object) and four more (to check if the player is facing the object) just to make the item work on any place around the object. That's a LOT of work in itself, even more if the item can be used on more such objects. I'm willing to bet there's a more simple solution, but if it isn't (please let there be), I'll go with this.

 

Man, there wouldn't be a problem at all if I could just make the object react to an X button press as an alternate action button.

Edited by TwoAcross

Share this post


Link to post
Share on other sites

Hmm.. I didn't think of that.

 

 

I've always liked having the least amount of scripts possible so that I can call something 100 % mine. xD

 

If you end up never finding that script (Which i KNOW is out there) you can perhaps commission Leon.

Share this post


Link to post
Share on other sites

I like doing most of the job too, but some scripts that cut my development time by two thirds are quite welcome. :P

 

Well, it would be nice, if he's willing to. I won't contact him directly yet, but in case you see this, Leon, please see if you can take some time to see what you can do.

 

Off I go to searching again. Dammit I'm breaking my soul apart for this game.

Share this post


Link to post
Share on other sites

Urrrg I'm getting annoyed now. I've been searching for like 30 minutes and haven't gotten close.

 

I think it was on RPG revolutiion, or a site that looks similar. (Bright colors)

Share this post


Link to post
Share on other sites

I'll see what I can whip up. essentially, you want to set it so you hit a certain key, the window pops up, you select an item, it pulls it back into the map, and checks if the event in front of the character is compatible, right?

Seriously... I LITERALLY wrote this as part of my last script... I am just feeling generous... lol. The script is a unique things for my game. ^_~ One only a handful of people know of, I believe.

Share this post


Link to post
Share on other sites

I like doing most of the job too, but some scripts that cut my development time by two thirds are quite welcome. :P

 

Well, it would be nice, if he's willing to. I won't contact him directly yet, but in case you see this, Leon, please see if you can take some time to see what you can do.

 

Off I go to searching again. Dammit I'm breaking my soul apart for this game.

 

 

Here is the script you need. It has a demo of how to set up your events that will use this script. Be sure to use the labels, reset the variable, AND you can even set it so it changes pages after the event is triggered.

 

Project8.zip

 

 

Are you releasing the Item Script from your game? :D

 

Absolutely not. I know you are DYING for it. xD

Share this post


Link to post
Share on other sites

Oh man, you are AWESOME, this is EXACTLY what I wanted, thanks!

 

I'm having trouble, though, there's an undefined method 'visible=' for nil:NilClass error when I try using an item away from an event. Line 280. I'll try to work it out, though, I have an idea what's wrong.

 

EDIT: Yeah, I can make the Window_Failed appear, but not make it disappear. It SHOULD, but I can't figure out why. I figured there you just forgot to put

 

@message_window = Window_Failed.new

 

under def main of Scene_Use, but that can't be it.

 

The second thing is, it seems the item can be used when you're facing any event, and then the use_item variable stays on. So basically, if I use the High Potion on the guy south of the character, and then talk to the guy on the right who wants it, he'll accept it. It's minor, but it bothers me. :sweatdrop:

 

EDIT2: The last thing is easily fixed by a short conditional branch where it just tells you the item doesn't work if the variable isn't 0, and then resets it, so that's okay. The problem above still stays.

 

EDIT3: Alright, fixed the first issue too! I had to change this:

 

    if Input.trigger?(Input::C)
     if @use_window.item != nil
       $game_system.se_play($data_system.decision_se)
       $game_temp.use_item = @use_window.item.id
       $scene = Scene_Map.new <------------
       if $game_player.check_infront == true
         $game_player.check_event_trigger_there([0,1,2])
       else
         @use_window.active = false
         @use_window.visible = false
         @message_window.visible = true
       end
       return
     else
       $game_system.se_play($data_system.buzzer_se)
       return
     end
   end
 end

 

to

 

 

    if Input.trigger?(Input::C)
     if @use_window.item != nil
       $game_system.se_play($data_system.decision_se)
       $game_temp.use_item = @use_window.item.id
       if $game_player.check_infront == true
         $scene = Scene_Map.new <----------
         $game_player.check_event_trigger_there([0,1,2])
       else
         @use_window.active = false
         @use_window.visible = false
         @message_window.visible = true
       end
       return
     else
       $game_system.se_play($data_system.buzzer_se)
       return
     end
   end
 end

 

Cause the update_message wouldn't go off on Scene_Map and it wouldn't react to a button press.

 

Anyway, thanks again, a lot!

Edited by TwoAcross

Share this post


Link to post
Share on other sites

The bugs are minor, but present because this was barely tested... It was ripped from another script of mine that has the fixes with another setup. Sorry about that... :sweatdrop: But, i'm glad it works!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...