Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsJedi Outcast and Jedi Academy Editing Forum → Need some help with scripting
Need some help with scripting
2004-02-15, 3:03 PM #1
Greetings - I'm looking for some help with a trap I'm trying to implement in my JA MP map. The trap should work like thus.....a player "hits a switch" in the hangar control room. This sets off a klaxon in the hangar itself that goes off four times, after which a "forcefield" is deactivated and anyone in the hangar gets sucked out into space and dies. Five seconds later, the forcefield is reactivated, and it's safe to enter the hangar again. I couldn't find an entity combination that did this, so I wrote a custom script using Icarus. This is the script.....

//Generated by BehavEd

rem ( "Custom script written by MoeJoe" );
rem ( "This script allows a player to turn off the magseal at the hangar entrance, making life really suck for anyone inside" );
rem ( "PARM1 = target_speaker to play klaxon" );
rem ( "PARM2 = the forcefield, a func_usable" );
rem ( "PARM3 = target_speaker to play whoosh sound" );
rem ( "PARM4 = the trigger_push entity, throwing players out into space" );

task ( "play_klaxon" )
{
rem ( "This task activates the target_speaker to play the klaxon sound and loops it 4 times" );

affect ( $get( STRING, "SET_PARM1")$, /*@AFFECT_TYPE*/ FLUSH )
{

loop ( 4 )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "false" );
}

set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "true" );
}

}


task ( "this_sucks" )
{
rem ( "This task turns off the forcefield, activates the whoosh target_speaker, and activates the trigger_push" );

affect ( $get( STRING, "SET_PARM2")$, /*@AFFECT_TYPE*/ FLUSH )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "true" );
}


affect ( $get( STRING, "SET_PARM3")$, /*@AFFECT_TYPE*/ FLUSH )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "false" );
}


affect ( $get( STRING, "SET_PARM4")$, /*@AFFECT_TYPE*/ FLUSH )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "false" );
}

}


task ( "much_better" )
{
rem ( "This task resets the forcefield and deactivates the trigger_push" );

affect ( $get( STRING, "SET_PARM4")$, /*@AFFECT_TYPE*/ FLUSH )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "true" );
}


affect ( $get( STRING, "SET_PARM2")$, /*@AFFECT_TYPE*/ FLUSH )
{
set ( /*@SET_TYPES*/ "SET_INACTIVE", /*@BOOL_TYPES*/ "false" );
}

}

dowait ( "play_klaxon" );
dowait ( "this_sucks" );
wait ( 5000.000 );
dowait ( "much_better" );

And here are the entities I'm using and their parameters....

target_speaker #1 - plays klaxon sound (noise = sounds/effects/mpalarm.wav), has no checkboxes checked, script_targetname is klaxon
target_speaker #2 - plays the "whoosh" sound (noise = sounds/effects/air_burst.mp3), has no checkboxes checked, script_targetname is whoosh
func_usable - the "forcefield", separates the hangar from the "space" outside, hangar side is textured with a translucent forcefield shader, has no checkboxes checked, script_targetname is forcefield
trigger_push - fills the hangar completely and it's target is all the way at the back of the "space" area - inactive, relative, and multiple checkboxes are checked, script_targetname is push
target_scriptrunner - uses hangar_death script (shown above) -- parm1 = klaxon, parm2 = forcefield, parm3 = whoosh, parm4 = push, targetname is hangar_runner
trigger_multiple - placed at the "switch" position, is directional and has use button and facing checked, wait time is five minutes (so people can't keep hitting it over and over), target is hangar_runner

*whew*
Anyway, what happens when I run it is this.......as soon as you enter the trigger_push (before it is even triggered), it seems to be trying to push me, over and over, rapidly, but it never throws me - the effect is as if there's a huge earthquake going on. Upon triggering the trigger_multiple, the target_speakers don't go off and the func_usable forcefield doesn't diasappear - however, the trigger_push is now fully active and throws you against the forcefield with enough force to kill you (a neat effect, but not quite what I had in mind.)
I apologize for the HUGE post, but I've been trying to figure out what is wrong here, and I am at my wits end. If anyone here has any idea what might be wrong with my script, if I'm using the wrong type of entities, if I haven't set the right flags, anything at all, I'd really appreciate the help. Thank you

------------------
What do you do when you rear-end someone? Hang up your cell phone...HANG UP AND DRIVE, STUPID
2004-02-15, 4:20 PM #2
Alright.. If ya want one thing to happen.. Do a systems check.. Meaning do one script line at a time, for the door.. etc.. Thats one way to check what may of went wrong..

Other then that.. I dont have the time right now to see what went wrong.. I will check into that later.. And maybe there are some physical map entites ya may of forgotten to add.. Other then that good luck! A screen shot would be usefull.. Can e-mail me on how ya got things setup.. With screens.. Just hit print screen above insert.. if ya know how to use photoshop.. your a god send!

------------------
-- [url="mailto:Jatso_jk@hotmail.com"]mailto:Jatso_jk@hotmail.com[/url]Jatso_jk@hotmail.com</A>--The Bounty Hunters Arc Forum--Firehound Inc.--
-- Jatso_jk1@hotmail.com--The Bounty Hunters Arc Forum--Firehound Inc.--
2004-02-15, 4:26 PM #3
http://www.gamingforums.com/forumdisplay.php?f=465

if ya dont find the right solution.. Try here, here you have much more frequent posters.. Especially more scripters..

------------------
-- [url="mailto:Jatso_jk@hotmail.com"]mailto:Jatso_jk@hotmail.com[/url]Jatso_jk@hotmail.com</A>--The Bounty Hunters Arc Forum--Firehound Inc.--
-- Jatso_jk1@hotmail.com--The Bounty Hunters Arc Forum--Firehound Inc.--
2004-02-15, 9:54 PM #4
Wow, man. That script was a real mess. Sorry to say that, but it was. First of all, get rid of those affect("script_targetname") and SET_INACTIVE lines. You can use it with your trigger_push, but otherwise, they are not what you are looking for. And even with the trigger_push, I suggest you place in Radiant target_activate and target_deactivate, and use them instead.

OK, that being said, get rid of the script_targetnames. For what you doing you need no script_targetnames. Ordinary targetnames will do just fine. So, convert the script_targetnames to targetnames.

After that being done, you can just use("targetname") the speakers. If you wanna some to play four times, then use it four times with enough wait(milliseconds) in between the uses to make it sound four times. To control the func_usable forcefield, you need nothing but use("targetname") it. When you use it once, it disappears, when you use it again, it reappears. You can also place a speaker next to the forcefield, to give it some sound (which you can disable by using the speaker with a targetname, maybe the same as the forcefield itself has).

If you want the sucking sound to play as long as you keep the doors to space open, make it loopin off in Radiant. Then when you use("targetname") it in a scipt, it will turn looping on (that is, playing all the time) until you use("targetname") it again, making it once again silent.

For the trigger_push (haven't ever used) make it inactive in Radiant (in entity properties), and then place a target_activate next to it. Target the target_activate to the trigger_push. Give the target_activate a targetname. Then use("targetname") that targetname in a script to activate the trigger_push. You can also do analogously with target_deactivate to deactivate the trigger_push, when you are done.

For the script, you need nothing but the use("targetname") commands for the different entities, separated with wait(milliseconds).

Yeah. Don't get too excited with parametres (Parm1). They don't help you at all in situations like this. Rather, they just make things harder, because that means correcting the script might not be enough (which is fast), but you might need to compile the whole map (and that's slow) just to correct some little script malfunction. You only need Parms when you use one single script to control multiple separate (but often identical) enties during different times.

[/rant]

------------------
This day we fight
Frozen in the past by ICARUS
2004-02-16, 5:36 AM #5
Well, this is the first time I've ever written a script for GTK, so I expected something to be screwy [http://forums.massassi.net/html/biggrin.gif] Lassev, I'm going to make those changes you suggested and try it out. Silent, if this doesn't work, I'll be emailing ya [http://forums.massassi.net/html/smile.gif]

Thanks to both of you for your help and input on this.


------------------
What do you do when you rear-end someone? Hang up your cell phone...HANG UP AND DRIVE, STUPID
2004-02-16, 6:33 AM #6
Hmm....ok, making those changes definitely improved things - the klaxon sounds, the "whoosh" plays, and the func_usable disappears and reappears....however, some things haven't been solved: for instance, the "earthquake" effect I'm getting inside the trigger_push brush when it's inactive, and the func_usable seems to be working backwards..or, sort of...it's there when I start the level up (I did not set the start_off checkbox.) however, when you trigger the trap the first time, the func_usable doesn't disappear at the first use command in the script, but it <u>does</u> disappear at the second use command, when it should be re-appearing. After that, it stays off until you trigger the trap again - then, it appears when it should be off and disappears when it should turn "on" again; hence, it runs backwards from then on out....Silent, I'm going to send you what I have so far, and if you could look it over and maybe tell me what I might need to do, that would be very helpful [http://forums.massassi.net/html/smile.gif]
Thanks again to both of you.


------------------
What do you do when you rear-end someone? Hang up your cell phone...HANG UP AND DRIVE, STUPID
2004-02-16, 11:45 AM #7
Moejoe.. Its a very overwhelming file.. However I will look into it. I will also go with "your" idea of what you want, Re-make a level. Re-do the scripting so it can be done for you. Only true way I get my scripting done is.. doing one script at a time to check if it works!

------------------
-- [url="mailto:Jatso_jk@hotmail.com"]mailto:Jatso_jk@hotmail.com[/url]Jatso_jk@hotmail.com</A>--The Bounty Hunters Arc Forum--Firehound Inc.--
-- Jatso_jk1@hotmail.com--The Bounty Hunters Arc Forum--Firehound Inc.--
2004-02-16, 1:34 PM #8
Ok, most of these issues have been solved - with the exception of the "earthquake" effect I get when stepping into the inactive trigger_push. I noticed that it only does this when playing multiplayer - it doesn't do it if I load up the BSP in the SP game.....any idea what I could do to stop it from doing this?
Thanks [http://forums.massassi.net/html/smile.gif]

------------------
What do you do when you rear-end someone? Hang up your cell phone...HANG UP AND DRIVE, STUPID
2004-02-16, 1:37 PM #9
BTW - thanks a LOT for helping me out with this, Silent - if you can figure out what is necessary to stop the earthquake, I'd be eternally grateful.... [http://forums.massassi.net/html/biggrin.gif]

------------------
What do you do when you rear-end someone? Hang up your cell phone...HANG UP AND DRIVE, STUPID

↑ Up to the top!