UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

how to make more doors with same funtion

broken avatar :(
Created 7 years ago
by kitos
0 Members and 1 Guest are viewing this topic.
1,422 views
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 25 May 2016
Last active: 4 years ago
Posts
98
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
kitos's Groups
kitos's Contact & Social Links
Code Snippet
Plaintext
soul_tracker_init();

Code Snippet
Plaintext
soul_tracker_init()
{
soul_door = getentarray( "soul_door", "targetname" );

for( i=0 ; i<soul_door.size ; i++ )
{
if( isDefined(soul_door[i].script_flag) && !IsDefined( level.flag[soul_door[i].script_flag] ) )
flag_init( soul_door[i].script_flag );
}

level thread zombie_soul_start();
}
zombie_soul_start()
{
trig = getent( "soul_trig", "targetname" );

while(isdefined(trig))
{
zombies = getaiarray( "axis" );
for( i=0 ; i<zombies.size ; i++ )
{
if( !isdefined( zombies[i].soul_zombie ) )
{
zombies[i].soul_zombie = true;
zombies[i] thread soul_watch( trig );
}
}

wait 0.5;
}
}
soul_watch(trig)
{
self waittill( "death", attacker );

if( !isdefined( trig ) )
return;

if( isdefined(attacker) && !isplayer( attacker ) )
return;

if( self istouching( trig ) )
trig thread add_soul_to_door(self.origin);
}
add_soul_to_door(death_origin)
{
if( !isdefined( self.souls ) )
self.souls = 0;

self.souls++;
fx_pos = getstruct( "soul_fx_pos", "targetname" );
fx_tag = spawn( "script_model", death_origin+(0,0,30) );
fx_tag setmodel( "tag_origin" );
playfxontag( level._effect[ "YOUR_SOUL_FX" ], fx_tag, "tag_origin" ); // SOUL FX
fx_tag moveto( fx_pos.origin, 2, 1, 0 );
wait 2;
fx_tag delete();
playsoundatposition( "SOUL_ADDING_SOUND", fx_pos.origin ); // SOUND WHEN A SOUL GETS ADDED

if( self.souls == 25 )
{
level thread open_special_door();
self delete();
}
}
open_special_door()
{
soul_door = getentarray( "soul_door", "targetname" );

for( i=0 ; i<soul_door.size ; i++ )
{
soul_door[i] notsolid();
soul_door[i] connectpaths();
soul_door[i] moveto( (soul_door[i].origin+soul_door[i].script_vector), 2, 0.5, 0.5 );

if( isdefined( soul_door[i].script_flag ) )
flag_set( soul_door[i].script_flag );
}
}


hi guys how can I make more  doors with same funtion? I try but dont know :(
Last Edit: August 09, 2017, 08:53:50 am by kitos
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
this should work.

Just use the same targetnames, but give each set a unique script_noteworthy. So for example:

Soul Door 1:
trigger:                 targetname            -   soul_trig
                            script_noteworthy   -   soul_door_1
brushes/models:  targetname            -   soul_door
                            script_noteworthy   -   soul_door_1
                            (script_flag)

Soul Door 2:
trigger:                 targetname            -   soul_trig
                            script_noteworthy   -   soul_door_2
brushes/models:  targetname            -   soul_door
                            script_noteworthy   -   soul_door_2
                            (script_flag)


etc. etc.



Code Snippet
Plaintext
soul_tracker_init()
{
soul_door = getentarray( "soul_door", "targetname" );

for( i=0 ; i<soul_door.size ; i++ )
{
if( isDefined(soul_door[i].script_flag) && !IsDefined( level.flag[soul_door[i].script_flag] ) )
flag_init( soul_door[i].script_flag );
}

level thread zombie_soul_start();
}
zombie_soul_start()
{
trigs = getentarray( "soul_trig", "targetname" );

while(isdefined(trigs) && trigs.size>=1 )
{
zombies = getaiarray( "axis" );
for( i=0 ; i<zombies.size ; i++ )
{
if( !isdefined( zombies[i].soul_zombie ) )
{
zombies[i].soul_zombie = true;
zombies[i] thread soul_watch( trigs );
}
}

wait 0.5;
trigs = getentarray( "soul_trig", "targetname" );
}
}
soul_watch(trigs)
{
self waittill( "death", attacker );

if( !isdefined( trigs ) || trigs.size == 0 )
return;

if( isdefined(attacker) && !isplayer( attacker ) )
return;

for( i=0 ; i<trigs.size ; i++ )
{
if( isdefined( trigs[i] ) && self istouching( trigs[i] ) )
trigs[i] thread add_soul_to_door(self.origin);
}
}
add_soul_to_door(death_origin)
{
if( !isdefined( self.souls ) )
self.souls = 0;

self.souls++;
fx_pos = getstruct( "soul_fx_pos", "targetname" );
fx_tag = spawn( "script_model", death_origin+(0,0,30) );
fx_tag setmodel( "tag_origin" );
playfxontag( level._effect[ "YOUR_SOUL_FX" ], fx_tag, "tag_origin" ); // SOUL FX
fx_tag moveto( fx_pos.origin, 2, 1, 0 );
wait 2;
fx_tag delete();
playsoundatposition( "SOUL_ADDING_SOUND", fx_pos.origin ); // SOUND WHEN A SOUL GETS ADDED

if( self.souls == 25 )
{
level thread open_special_door(self.script_noteworthy);
self delete();
}
}
open_special_door(noteworthy)
{
soul_door = getentarray( "soul_door", "targetname" );

for( i=0 ; i<soul_door.size ; i++ )
{
if( soul_door[i].script_noteworthy == noteworthy )
{
soul_door[i] notsolid();
soul_door[i] connectpaths();
soul_door[i] moveto( (soul_door[i].origin+soul_door[i].script_vector), 2, 0.5, 0.5 );

if( isdefined( soul_door[i].script_flag ) )
flag_set( soul_door[i].script_flag );
}
}
}
Last Edit: August 09, 2017, 06:54:34 pm by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 25 May 2016
Last active: 4 years ago
Posts
98
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
kitos's Groups
kitos's Contact & Social Links
Error bad token "¡" when I start the map and one  think I do it copy and paste the other scripts only tjat I do is change the mames of the funnctions and variables it works 100%^^

 
Loading ...