UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: BluntStuffy on May 04, 2015, 01:08:58 am

Title: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: BluntStuffy on May 04, 2015, 01:08:58 am
mega.co.nz

Looks like this: ( Note: only works on zombie_door's that have a script_vector! )

http://www.youtube.com/watch?v=V1dnRCfBf8A#ws (http://www.youtube.com/watch?v=V1dnRCfBf8A#ws)


Radiant:
Keep your normal door-triggers for the first time use, with al their normal KVP's.
For the moon-doors add a trigger_multiple, when a zombie / player is touching that, the doors will open.
Trigger KVP's:

Code Snippet
Plaintext
-Select Spawnflag:  AI_AXIS

targetname - auto_door_trig ( the same for all door_triggers in your map )
script_noteworthy - auto_door# ( give each door a unique nr )
script_flag - ** ( copy from the normal door trigger it 'belongs to' )

make the trigger target every part of the door ( also clips! ). So first select trigger, then door/clip and press 'w' for each part.



Call the script from _zombiemode.gsc, around line 60-70 you'll see similar line's: add this line:

   maps\_blst_auto_doors::auto_doors_init();
   


There are 3 spots in the script to put in sounds, right now they are empty but i left note's where you need to add them in the script.

Download the script, or copy it from the code-box and put it in a new .gsc named _blst_auto_doors.gsc  Place that .gsc in your root\mods\mapname\maps\ folder..



Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

auto_doors_init()
{
triggers = getentarray( "auto_door_trig", "targetname" );
array_thread( triggers,::auto_doors_wait );
array_thread( triggers,::auto_doors );
}

auto_doors_wait()
{
wait 1;
self.active = false;
flag_wait( self.script_flag );
wait 3;
self.active = true;
}

auto_doors()
{
wait 1.5;

doors = getentarray( self.target, "targetname" );
for( i=0;i<doors.size;i++ )
{
doors[i].open = doors[i].origin+doors[i].script_vector;
doors[i].closed = doors[i].origin;
}

self.target = undefined;
self.state = "closed";

while( !self.active )
wait 0.5;

self close_doors( doors );

while(1)
{
self waittill( "trigger" );
playsoundatposition( "", doors[0].origin ); // ADD SOUNDS HERE, when the trigger activate's

switch( self.state )
{
case "closed":
self open_doors( doors );
wait 3;
self close_doors( doors );
break;

case "open":
self close_doors( doors );
break;

default:
break;
}
}
}

open_doors( doors )
{
self.state = "open";
for(i=0;i<doors.size;i++ )
{
doors[i] moveto( doors[i].open, 1, 0.3, 0.3 );
}
playsoundatposition( "", doors[0].origin ); // ADD SOUNDS HERE, opening of the doors
wait 1.5;
}


close_doors( doors )
{
while(1)
{
count = 0;

for(i=0;i<get_players().size;i++ )
{
if( get_players()[i] istouching( self ) )
{
count++;
break;
}
}

if( count == 0 )
{
zombs = getaiarray( "axis");
for(i=0;i<zombs.size;i++ )
{
if( zombs[i] istouching( self ) )
{
count++;
break;
}
}
}

if( count >= 1 )
{
wait 0.5;
continue;
}


self thread move_doors_closed( doors );
self.state = "closed";
break;
}
}

move_doors_closed( doors )
{
for(i=0;i<doors.size;i++ )
{
doors[i] moveto( doors[i].closed, 1, 0.3, 0.3 );
}
playsoundatposition( "", doors[0].origin ); // ADD SOUNDS HERE, closing of the doors
}
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: vinnyz500 on May 04, 2015, 02:16:58 am
(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi59.tinypic.com%2Fepj9t5.jpg&hash=8b8f61861744a386984d8a7b697ac26e469339f6)
well, figures
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: Harry Bo21 on May 04, 2015, 06:30:30 am
lol I log in, see a request for moon doors

I log in again, instant tutorial from Mr Stuffy here lol, good job Stuffy :)
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: MrDunlop4 on May 04, 2015, 06:34:05 am
Nice man. Thanks for sharing :D
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: fiveseven hd on May 05, 2015, 12:52:03 am
wow ...looks good man thanks for sharing..is this from green house .....?
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: ProJimmyRustler on May 05, 2015, 04:47:22 pm
How did you get your color to look like that?
It looks much better than most of the color in other maps!


It it all in the custom texturing, or something else?
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: smasher248 on May 06, 2015, 04:32:24 pm
i have 2 way zombies for every door in my map, http://gyazo.com/14abaf5707ed187a46d4189b73e7ec3b (http://gyazo.com/14abaf5707ed187a46d4189b73e7ec3b) , http://gyazo.com/197386cf8d6d44403ce7ff8cde56886f (http://gyazo.com/197386cf8d6d44403ce7ff8cde56886f) , which means i either have to have 2 trigger(which i do) or a 2 way zones, but neither works properly
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: BluntStuffy on May 06, 2015, 05:23:02 pm
i have 2 way zombies for every door in my map, http://gyazo.com/14abaf5707ed187a46d4189b73e7ec3b (http://gyazo.com/14abaf5707ed187a46d4189b73e7ec3b) , http://gyazo.com/197386cf8d6d44403ce7ff8cde56886f (http://gyazo.com/197386cf8d6d44403ce7ff8cde56886f) , which means i either have to have 2 trigger(which i do) or a 2 way zones, but neither works properly

You mean a door you can acces from both side's? Just make one big trigger covering both side's, i have all of them like that in my map:

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fimgur.com%2FUF7R1NA.png&hash=8514e55ab368ed2c7487c30e540d8243a331b7be)


wow ...looks good man thanks for sharing..is this from green house .....?
Yes, this is GreenHouse. Occasionally i work on it, in between other stuff..


How did you get your color to look like that?
It looks much better than most of the color in other maps!


It it all in the custom texturing, or something else?
There's only some custom texture's on models, all other texture's are stock WaW. The colors are like that because of a custom vision-file

Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: ProJimmyRustler on May 06, 2015, 05:30:30 pm
There's only some custom texture's on models, all other texture's are stock WaW. The colors are like that because of a custom vision-file
Would you be willing to share the file, or even the settings that you are using?
I'm really in the need of this, as I don't want to have the gray flushed colors in my map.
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: smasher248 on May 06, 2015, 05:39:56 pm
but you have zone activation on that trigger, if there is only 1 trigger wont it activate a zone i just came out from?
Title: Re: [Tutorial] Moon style doors ( open and close when you walk through )
Post by: BluntStuffy on May 06, 2015, 05:46:32 pm
but you have zone activation on that trigger, if there is only 1 trigger wont it activate a zone i just came out from?

The flag on the door triggers on both side's is the same isn't it? Since zone's work both ways. Use that flag on the moon_door trigger and that's it..

To make sure: the moon_door-trigger doesn't activate a flag, it just waits for that flag before it become's active