Magnificent Ornk Aran Posted April 9, 2007 Share Posted April 9, 2007 This script snippet is in a conditional block in the start state. It gets called every tick in the town, as long as it is day - that means, as long as ticks%5000 is between 500 and 4500. Quote: It is day. I'm not at my counter. I'm moving. [repeat ad nauseum] However, the vendor remains rooted to her position. As you can see, I removed the (unlocked) door that might have obstructed her path, but that hasn't changed anything. However, her memory cell #0 is set to 2, meaning she's completely immobile. But that immobility should only extend to her basicnpc AI, since it is explicitly implemented in that script. If she is actually commanded to move with approach_waypoint(), shouldn't that supersede the mobility set in her memory cells? Edit: Yes, I realize this is an extremely fancy thing to want to do. I've already started to implement my fallback plan, which is to just make that vendor sit at her counter 24/7. But it would still be nice to have a little more realism. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 9, 2007 Share Posted April 9, 2007 Giving a character 0 mobility makes a character completely immobile, even if it's called in a town state, even if it's used on PC's and joined NPCs (that's right). They cannot move. End of story. However, you can put a set_mobility() call in the town state so the character can start moving, and then take away her mobility when she gets to the spot. I would handle this by hidden groups, because NPCs can't open doors. Basically you'd have to have either no door, a curtain, or multiple waypoints, one in front of the door, that would flip the terrain open when she gets there (Not fun at all) Edit: Setting the merchant's memory cell to 1 should fix the mobility problem, although the doors will still mess her up. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted April 9, 2007 Share Posted April 9, 2007 You could fix the door with a system of messages between a customized door script and the creature script. Unnecessarily complex, but eh. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 9, 2007 Share Posted April 9, 2007 Yeah, and basically the creature won't know the door is passable, so you'd have to tell it to walk to the door, then walk to the next destination. I think the most likely solution would be to make a fake door that's passable, and ring it in special rectangles so that the party can't cross through it without opening the 'door' first. Or you could just use curtains. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 9, 2007 Author Share Posted April 9, 2007 Well, now I simply have her as part of a hidden group that only activates at day. Same result, a tenth of the effort. But hey, these are the kind of things you have to learn when you get acquainted with scripting. I also now understand how a simple memory cell can actually zap her mobility even outside the basicnpc script. It's because the basicnpc script not only doesn't command her to move when memory cell #0 is 2. It also explicitly orders her never to move at all. Code: if (get_memory_cell(0) == 2) set_mobility(ME,0); break; Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted April 10, 2007 Share Posted April 10, 2007 You know you can use set_creature_memory_cell() to toggle that, right? Couple that with a set_mobility() call and you should be able to unfreeze that NPC and keep her from freezing up again. I've wound up pulling similar strings in SoG with the talknode in memory cell 3. Very effective. EDIT: Clarification... I was eating a wrap when I typed the first version. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 10, 2007 Author Share Posted April 10, 2007 I can imagine it is. I was going to give her a different dialogue if the player tried to enter the shop at night time (along the lines of "get the hell out of my house!"). However, I've had trouble locking and unlocking doors by setting memory cell #0 to different values. Is there something else that needs to be set as well for it to take effect immediately (like set_mobility has to be called explicitly to update the mobility)? Quote Link to comment Share on other sites More sharing options...
Kyshakk Koan Smoo Posted April 10, 2007 Share Posted April 10, 2007 I've never been able to unlock/lock a door by setting the memory cell 0 to different values either. But you can also unlock doors by setting the door's flag (memory cells 2 and 3, assign them in the editor.) to 1. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 10, 2007 Author Share Posted April 10, 2007 Okay, so I have to use an SDF for that. Gotcha. But I guess it also means I can't change the difficulty of a lock on the fly. Shame... I can think of a few nifty tricks one could do with that. Think "this door requires 3 more Living Tools to open", or something like that. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 10, 2007 Author Share Posted April 10, 2007 Quote: Originally written by Ephesos:You could fix the door with a system of messages between a customized door script and the creature script. Unnecessarily complex, but eh. Vendor sends message to door: "Open Sesame" Door sends message to vendor: "Thank you for making a simple door very happy. Buy Sirius Cybernetics Happy People Doorways™!" Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 10, 2007 Share Posted April 10, 2007 You would still need waypoints to tell the creature to approach the door. By the way, you CAN change a door's lock difficulty, but not with the standard door script. You can use messaging calls, and move the lock setting code to the start_state: Code: if(my_curent_message() > 0) { i_am_locked = 1; set_mechanism_difficulty(my_current_message()); set_physical_strength(my_current_message()); if (i_am_open == 1) { flip_terrain(my_loc_x(),my_loc_y()); i_am_open = 0; }}if(my_current_message() == 0){ i_am_locked = 0; set_mechanism_difficulty(0); set_physical_strength(0);} Theoretically that should work. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Swimmin' Salmon Posted April 10, 2007 Share Posted April 10, 2007 To add even more unnecessary complexity, if watching the shopkeeper go sit in her chair is soooo bloody important, why not just set up a cutscene that shows that movement if the party is there at the right time? Then use the hidden group option to actually move the character. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted April 10, 2007 Share Posted April 10, 2007 I did something like this in TV, which just erased the night creature and replaced it with the day one. To clean it up slightly, I added an if call to see if it was day, and then flashed up a message_dialog to explain that the people were waking up, going outside etc. That way, people didn't just appear in front of the party. Your way is better, for sure, but I thought I'd add another way to do this. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted April 10, 2007 Share Posted April 10, 2007 Quote: Originally written by The Gators Win it All....... Again:you CAN change a door's lock difficulty, but not with the standard door script. Yes you can. Well, using door.txt and the town script. set_terrain_memory_cell(which script, which cell, value) in the START_STATE or wherever works. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 11, 2007 Author Share Posted April 11, 2007 Didn't have an effect for me. But perhaps this was back when the entire state didn't execute at all. I'd have to test it again. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 11, 2007 Share Posted April 11, 2007 Ephesos: No, you can't. Mechanism difficulty is set in the init_state, so changing the memory cell won't have an effect. To make it work you have to add code to the start_state that will reset the mechanism difficulty (like the code I posted above) Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody wz. As Posted April 11, 2007 Share Posted April 11, 2007 I've actually thought fairly extensively about NPC's moving through doors, and I've arrived at some possibly workable solutions. One method might look as follows: 1) Duplicate the door terrains to create another set that looks the same but is not blocked for movement. 2) Alter basicnpc.txt (or create a new NPC script) to do the following: At the beginning of the NPC's turn, change all door terrains in the town into the second, non-movement-blocking variety. At the end of the NPC's turn, change them back into regular doors. 3) Change the door.txt script (or create a new door script) to do the following: Every turn, make a note of the placement of all NPCs surrounding the door. In the next turn, if the door was closed and the arrangement of NPCs has changed in the appropriate manner, open the door (and optionally print a message or play a sound). This configuration would not alter doors from the player's perspective, since the doors would be normal while the player moved. Some interesting problems to consider might be locked doors, locked doors to which some NPCs have keys, and so on. Other complexities might be line of sight issues, for instance when to print a message or play a sound. I'm fairly confident that all of these issues could be solved, given enough motivation. I lack that motivation, but hopefully I've provided a blueprint for someone else to work with. I've had more technical ideas than I've posted here (e.g. about how exactly to implement the door/npc scripts), so if anyone has any desire to actually implement this and wants suggestions, let me know. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.