JavaGuy Posted September 24, 2002 Share Posted September 24, 2002 So...I made a simple elevator script (the idea being that once I got it working I could add all the cool cusom features I want rather than be constrained by simple trigger-based 'vators) and threw it into my map with all the appropriate entities. I ripped the basic idea from the elevator tutorial over at massassi.net. My version of the script is below. I fire up my map and push the button. It makes the beeping sound like it's supposed to, but then the elevator just disappears! Where could it have gone? //Generated by BehavEd rem ( "PARM1 - func_static, elevator, script_targetname" ); rem ( "PARM2 - ref_tag, up position, targetname" ); rem ( "PARM3 - ref_tag, down position, targetname" ); rem ( "PARM4 - func_usable, active button, targetname" ); rem ( "PARM5 - func_usable, inactive button, targetname" ); rem ( "PARM6 - Either up or down" ); sound ( CHAN_AUTO, "sound/movers/switches/switch1.mp3" ); rem ( "Start moving, so hide inactive button and show active button" ); affect ( get( STRING, "SET_PARM4"), FLUSH ) { set ( "SET_FUNC_USABLE_VISIBLE", "true" ); } affect ( get( STRING, "SET_PARM5"), FLUSH ) { set ( "SET_FUNC_USABLE_VISIBLE", "false" ); } rem ( "Move the elevator" ); declare ( STRING, "elevator_destination" ); if ( get( STRING, "SET_PARM6") = "up" ) { rem ( "Move elevator up" ); set ( "elevator_destination", get( STRING, "SET_PARM2") ); } else ( ) { rem ( "Move elevator down" ); set ( "elevator_destination", get( STRING, "SET_PARM3") ); } task ( "move_elevator" ) { affect ( get( STRING, "SET_PARM1"), FLUSH ) { move ( tag( get(STRING, "elevator_destination"), ORIGIN), 2000 ); } } dowait ( "move_elevator" ); free ( "elevator_destination" ); rem ( "Stop moving, so show inactive state button and hide active state button" ); affect ( get( STRING, "SET_PARM4"), FLUSH ) { set ( "SET_FUNC_USABLE_VISIBLE", "false" ); } affect ( get( STRING, "SET_PARM5"), FLUSH ) { set ( "SET_FUNC_USABLE_VISIBLE", "true" ); } Link to comment Share on other sites More sharing options...
lassev Posted September 24, 2002 Share Posted September 24, 2002 In the past I have given people some lousy information about elevator scripts. Now, I hope I'm not doing that again. And if you call that a simple elevator script, I wonder what kind are those basic scripts I'm using. Yeah. First of all, I'm wondering, why do you use set_visibles with func_usables. They can easily enough be handled with use<string> when you in the map editor start the other phase in off-state, the other one normally. But that was not the point, anyway. I can't right away say, why you loose your lift, but one thing out of ordinary in your script is the relationship between task and affect. When you move your elevator, the lift is normally first [affected], then a [task] with the [move] command is included, then the [task] (with move command inside) is done with [do] or [dowait], and last the [affect] is terminated. Link to comment Share on other sites More sharing options...
lassev Posted September 24, 2002 Share Posted September 24, 2002 As an after thought, do those buttons of yours work properly? Because, as far as I know, when ever your are using affect command, you should use script_targetname (or NPC_targetname for NPCs). So, basically, if you want to do it the way you posted in your scripts, that may be a thing to change, if it turns out to be a problem. Link to comment Share on other sites More sharing options...
JavaGuy Posted September 25, 2002 Author Share Posted September 25, 2002 Well, I changed the script to do the affect-task relationship as you suggest. It still does precisely the same thing. On the button issue--you're right, that was a problem. The reason I use the script command to set them visible/invisible is that I like my scripts to be completely unambiguous on stuff like that. I don't want to have to think about "well, this one started invisible, use makes it visible, hides the other, but then if this or that unusual situation arises they get reversed so I have to...blah blah blah." I rather just set the startoff flag for the appropriate ones but then explicitly state what I want in the script. On the disappearing elevator thing: I did an r_showtris 1 and watched it that way. Sure enough, I saw the platform sail through the wall and up up away out of sight. Now it was supposed to go up, but it was supposed to go _straight_ up, not move laterally at the same time. I've double- and triple-checked my ref tags, and they look okay to me. I'm still baffled. Link to comment Share on other sites More sharing options...
lassev Posted September 26, 2002 Share Posted September 26, 2002 One guestion: Do you have other scripts controlled elevators in this map that work? Perhaps with more direct, lift-specific scripts? That would directly point the problem to your flexible script. If you don't have, you might try to operate this same lift, as a test, mind you, with an ordinary elevator script to see if it works, and no map editor controlled elements are missing. Link to comment Share on other sites More sharing options...
JavaGuy Posted September 26, 2002 Author Share Posted September 26, 2002 Mystery solved! I made a little one-room test map and threw in a moving brush that just moves back and forth to see if I'm setting up my move command properly. I fired it up, and it worked. I watched the brush move back and forth as expected. Then I realized something: I had forgotten to give my moving brush an origin. I know this can cause nutty behavior, but on such a tiny map it apparently didn't make enough difference to be noticeable. I knew my wacko elevator had an origin brush attached to it, but I became suspicious. I ungrouped the entities and examined it. Sure enough, I had apparently retextured it with something else before I grouped the func_static. No origin brush there. I fixed it, and now it works perfectly. Live 'n' learn. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.