PDA

View Full Version : Problems with Interaction (timing? loop logic?)


maybesomethingdunno
30th Jul 2010, 10:58 PM
I was hesitant to post in the forums because I don't know how to adequately word my problem. But, I really want to make progress with this.

I have a self-interaction that puts the Sim in a loop. The movement through the loop as well as what subroutine the Sim does depends upon the attribute values of several objects working together in a (hopefully) coordinated effort.

To me the code looks okay. In-game, however, the timing is off and/or the Sim does one subroutine when he/she should be doing another. I don't see why or how.

As some people already know, I'm working on a surfing interaction.

Unfortunately, the wave effect is more than just waves and the waves are not regularly timed. So, I've made a default replacement of the wave effect object. It forces a continuous reset of the effect and enables a timed toggle of an attribute value to indicate the start of a new wave. It also adds a routing slot. The dark squares on the ocean floor in the video are just terrain paint to indicate where the placeholder object is. ;)

There is a NPC to handle the routing (Position A: the routing slot; Position B: a location relative to the default replacement wave effect object). Also, there is a cart object that will hold the Sim and eventually a surfboard object. (Right now, I'm using a modified version of joninmobile's emptied bookcase for a cart object since it has a lot of slots for me to play with and it has a tall mesh for greater visibility while testing. The cart will eventually be invisible and not actually be the surfboard itself. I have my reasons for not having the surfboard function as the cart. ;) )

I'm using two slots in the cart for the Sim. One is to be lowered and at an angle for the paddling animation. The other is for riding along the surface. Since the wave effect starts outside the boundaries of the lot, I shifted the slots over a little. This was to make the Sim appear to be a little further out and appear to have more time on the wave. The routing slot is located about the middle of the swimming area, where the wave dissolves into more of a foamy spray (incapable of realistically holding a surfboard and person).

As you can see in the video, the Sim flies over from one slot to another. Obviously I've failed to simply make the Sim look like he/she is paddling further out to sea and surfing to be just back inside the lot boundary. :(

You can also see the main problem I mentioned earlier: the timing on the surfing is off and/or the Sim does one subroutine when he/she should be doing another (one bleeds into another?). Although, it does seem to be in sync at times (e.g. about the 15th second of the video).

In the wave effects object, the main bhav loop toggles the value for the "WaveStart (0=Not Started, 1=Started)" attribute.

In the NPC, there are 3 attributes.
"WaitingForSim? (0=Sim on surfboard, 1=Sim not on surfboard)" to make the NPC wait for the Sim to get on board before it leaves its starting position at the routing slot.
"Direction (0=Facing ocean, 1=Facing shore)" value is toggled whenever the NPC reaches Point A or Point B on its path back and forth. It would make sense to me that whenever this value is 0, the Sim is paddling out to sea to catch a wave.
"WaitingForWave? (0=Wave caught, 1=No waves caught yet)" value is to make the NPC wait until the wave effect object's "WaveStart (0=Not Started, 1=Started)" attribute has a value of 1. Facing the shore, the Sim is just relaxing on the surfboard and is neither surfing nor paddling.

In the self-interaction, the Sim routes to the nearest wave effect object and stores its ID in a Local. The Sim then spawns the NPC and the cart (already snapped into the NPC's slot), storing their IDs in Locals as well. This way, the self-interaction has access to check/edit the attribute values of the objects involved.

This project seems so doable. (There are even animations that seem to work for it!) I'm sure it's just a logic fail on my part. :lol:

Movie Clip (http://yfrog.com/5umoviefvz) (Alternate/Direct Link (http://img210.imageshack.us/img210/9913/moviefv.mp4)) -- since neither my words, screenshots, nor diagrams would adequately show the problem(s).

The files are attached. I realize I have a lot more work to do with this (e.g. adding guardian BHAVs for non-beach lots, lots of polishing, the cart object etc). I want to get at least the basic surfing concept/logic correct. (The surf self-interaction has 2 additional bhavs that are not called which are just variations of the main interaction.)

Echo
31st Jul 2010, 04:14 AM
You're right, the explanation isn't very clear, but the video helps. The box - is this the NPC or the cart? It's, presumably, following the path you *do* want? If so, then I suspect that the sim has been snapped into the wrong slot. The NPC should be using routing slots, but the cart and sim should both be in a container slot. Objects snapped into routing slots don't move with the parent object - that only works for container slots. :)

maybesomethingdunno
31st Jul 2010, 06:34 AM
I'm glad the video helped. It's extra difficult when you don't know how to describe the problem you're facing. At the very least, I knew I should have more than just the files and "waah, it doesn't work!!!11!" :giggler:

The NPC is routing to the routing slot of the wave effect object.

I'm using a modified version of joninmobile's Emptied Base Game Bookshelf (http://www.modthesims.info/download.php?t=386642) as a temporary cart object. (Lots of slots and a big, visible mesh to help me track the NPC through all that foam and spray.) The cart is spawned in the NPC's slot 0x0003 (which should be the Plumb Bob[plumbbob_grip], according to the wiki).

The bookcase has only 1 routing slot and 21 container slots, all which I've changed the SLOT values to that of an OMSP that can hold Sims (I also had to increase the bookcase's support strength). I don't think I'm snapping into the wrong slot, but I suppose anything is possible. I've been staring at this for so long that I honestly wouldn't be surprised if it was simply a "Make MSD Happy" flag that just needed to be set and it would magically work (*sigh* if only it was that easy... :lol: ). In the cart's CRES, 0x5 appears to be the routing slot and I'm snapping the Sim into 0x0B, 0x0C, or 0x0D depending on the "Interaction - Surf V#" bhav used (I rather have different versions than to make changes and have nothing to go back when it doesn't work :) ).

The Sim swims to the grid square between the dark terrain-painted square (where the wave effect place holder is located) and the rear lot boundary to spawn the NPC and the cart. While the NPC routes to the routing slot, the Sim does the spin and "get on" animation (to give the NPC time to route) before snapping into the cart. (I may have the NPC and cart spawn before the Sim actually routes.) Ideally, it would look like he/she never left that same spot. The Sim would appear to paddle their surfboard from that initial position to a distance X (where X is the distance between the initial position and the routing slot) further out to sea and to have more time on the wave. (Moving the wave effect in-land is out since it would also move the foamy froth further in-land.) But, this might not be possible if Sims fly to wherever they're snapped, even if ever so briefly. It seems that even if I were to perfect the slot positions, the NPC turns around before the Sim is instructed to switch slots for the illusion. Of course, if I were to just not bother with the slot translations at all and have the Sim route directly to the cart, it may not be a problem. I don't know.

As I understand it, I would need two slots for the Sim, each of which should be the negative of the other (i.e. X for one direction and -X for the other direction). If I was the NPC and holding the Sim in my hand as I walked forward, keeping my arm always stretch out in front of me would make the Sim appear to fly forward when I spun around to face the other way. So, I would need to have my arm stretched out behind me when going in the opposite direction to keep the Sim's start position in the same general location when I change direction. One direction's end position would be the other direction's start position. If that makes sense or is sound logic?

I suspect that perhaps a problem could be windows of time in the loop in which a "Should I do this?" check is true or false when it shouldn't be (or is remaining true/false for too long or too short amount of time) and that is the cause of the subroutine bleeding (for lack of a better description). If this is the case, I don't know how to correct it though. I was hoping to get the core/heart/essence/whatever of the interaction correct before fine-tuning the exact slot positions and other improvements (e.g. chance of falling off the board based on body skill). But with my luck, the slot positions could also be a factor or cause of the problem(s) :rolleyes:


Added:
Well, this just goes to demonstrate the idea of quadruple checking things you've double checked. I did find an error in the NPC (the last node in the Main bhav should have been an idle for a tick--for some reason, it was changing the visitor type attribute value :wtf: ). But, the correction did not lead to any noticeable improvement; there was still the subroutine bleeding. If run long enough, there are instances where the Sim, NPC, and wave do sync briefly as intended. Every time would be much better, of course.