PDA

View Full Version : Trigger Bug



qwerty
6th February 2013, 21:07
Hey guys,
I guess I need your help. I want to create some breakable windows. Actually I already made them. I made 6 windows with damage trigger. But on 5 windows my experience the following
http://www.xfire.com/video/5e08bc and 1 is working perfectly with the same script. Almost every time other brush is breakable and unbreakable in the same window. I checked triggers, brushes but everything is good.

What should I do?

My script btw(but it's good):


torles(trig,br)
{
trigger=getent(trig,"targetname");
brush=getent(br,"targetname");
for(;;)
{
trigger waittill ("trigger");
brush Delete();
break;
wait 0.05;
}
iprintln("kitört");
}

serthy
6th February 2013, 22:31
maybe add some more failsaves and debugprints to your code:

torles( trig , br )
{
trigger = getEnt( trig , "targetname" );
brush = getEnt( br , "targetname" );

if( isDefined( trigger ) )
{
trigger waittill( "trigger" );

if( isDefined( brush ) )
{
brush delete();

iPrintLn( "delete brush" );
}
else
{
iPrintLn( "brush not defined!" );
}

trigger delete();

iPrintLn( "delete trigger" );
}
else
{
iPrintLn( "trigger not defined!" );
}

iPrintLn( "end of function" );
}

btw your map looks sweet =)

kung foo man
7th February 2013, 02:15
The for-loop is wasted (serthy already edited it out), just do this:



torles(trig,br)
{
trigger=getent(trig,"targetname");
brush=getent(br,"targetname");

trigger waittill ("trigger");
brush Delete();
iprintln("kitört");
}

// mention the "thread"
thread torles("window_0", "window_trigger_0");
thread torles("window_1", "window_trigger_1");
thread torles("window_2", "window_trigger_2");
thread torles("window_3", "window_trigger_3");
thread torles("window_4", "window_trigger_4");
thread torles("window_5", "window_trigger_5");
// and so on...


I guess you just forgot the thread-keyword, but cant be sure, because you just posted this little piece of the whole script.

qwerty
7th February 2013, 08:36
with serthy's code the same problem some pieces of windows is unbreakable.

and i use this

for(i=2;i<10;i++)
{
temp=getent("uveg_06_0"+i,"targetname");
temp Hide();
}
temp=getent("uveg_06_10","targetname");
temp Hide();
torles("uveg_06_01_trigger","uveg_06_01");
for(i=2;i<10;i++)
{
temp=getent("uveg_06_0"+i,"targetname");
temp Show();
}
temp=getent("uveg_06_10","targetname");
temp Show();
thread torles("uveg_06_02_trigger","uveg_06_02");
thread torles("uveg_06_03_trigger","uveg_06_03");
thread torles("uveg_06_04_trigger","uveg_06_04");
thread torles("uveg_06_05_trigger","uveg_06_05");
thread torles("uveg_06_06_trigger","uveg_06_06");
thread torles("uveg_06_07_trigger","uveg_06_07");
thread torles("uveg_06_08_trigger","uveg_06_08");
thread torles("uveg_06_09_trigger","uveg_06_09");
thread torles("uveg_06_10_trigger","uveg_06_10");

kung foo man
7th February 2013, 13:15
Why dont you use uveg_06_00_trigger, uveg_06_01_trigger?

qwerty
7th February 2013, 14:11
i use uveg_06_01_trigger, the uveg_06_01 is the first window, if you break this the others will be visible and breakable

qwerty
7th February 2013, 16:13
I changed the triggers to "use_touch" to detect what's wrong exactly. http://www.xfire.com/video/5e0c79 Seems that some trigger does not work at first just after i used the door next to the window, but i don't know what cause that :( In radiant everything is on the right position.

kung foo man
7th February 2013, 17:15
Can you release the .d3dbsp-file with current scripts, so ppl can try to fix it?

qwerty
7th February 2013, 17:55
course, can u give me ur xf? and i'll give the link

kung foo man
7th February 2013, 18:02
Just add as attachment to your post (so everybody can test) :)

qwerty
7th February 2013, 19:14
a cant upload as attachment coz zip is too large so I uploaded other site, here is the link include the script and the .d3dbsp http://www.speedyshare.com/6r8BN/KF-BioticsLab.zip

randall
7th February 2013, 19:34
Use this windows and scripts:
https://dl.dropbox.com/u/9715219/z_break.iwd

I have made and tried at now, it works fine.

IzNoGoD
7th February 2013, 19:47
Add me on xfire: imbackagainiba

Your mapping shows really great potential. Your scripting doesnt though, but id like to help on such an awesome map!

serthy
7th February 2013, 20:56
you should try this instead of renaming every trigger and its pair on your own:

>new map
>create a trigger_damage > targetname = "trigger_glass"
>create your unbroken window > make it a scrpt_brushmodel
>create your broken window > make it a scrpt_brushmodel
>firstly select your trigger > secondly select your unbroken window > hit [W] to connect them (line poining from the trigger to the window should appear)
>unselect all [i]
>firstly select your unbroken > secondly select your broken window > hit [W] to connect them (again a line poining from the unbroken window to the broken one should be visible)
>save it as a prefab

now you can add this prefab whereever you want and how often you want in your map script (without renaming):


init()
{
glassTriggers = getEntArray( "trigger_glass" , "targetname" );

if( isDefined( glassTriggers ) && glassTriggers.size )
{
for( i = 0 ; i < glassTriggers.size ; i++ )
{
if( isDefined( glassTriggers[i] ) )
glassTriggers[i] thread monitorGlassTrigger();
else
iPrintLn( "undefined glassTrigger found for some reason!" );
}
}
else
{
iPrintLn( "NO glassTriggers FOUND IN MAP!" );
}
}

monitorGlassTrigger()
{
window = undefined;

if( isDefined( self.target ) )
{
window = getEnt( self.target , "targetname" );
}

if( !isDefined( window ) )
{
iPrintLn( "GlassTrigger at " + self.origin + " has no window as target!" );

return;
}

broken = undefined;

if( isDefined( window.target ) )
{
broken = getEnt( window.target , "targetname" );
}

if( !isDefined( window ) )
{
iPrintLn( "window at " + window.origin + " has no broken window as target!" );
}

window show();
broken hide();

trigger waittill( "trigger" );

trigger delete();
window delete();
broken show();
}

i think izno may help you with the scripting abit more^^

anyway, your better with using prefabs instead of naming every trigger / window pair by hand..