Hi,
Do you know any map with moving lasers which are killing people? Or maybe u now script than it would be nice if you will share of it, coz i need it to my map :D
Printable View
Hi,
Do you know any map with moving lasers which are killing people? Or maybe u now script than it would be nice if you will share of it, coz i need it to my map :D
Just make an laser texture and put an trigger to it > done
Moving lasers = just move the lasers itself, for the trigger i think its trigger linkTo(laser.origin);
Do this:
Make triggers -> hurt over all the lasers you have. Once made them , select all and give them these values (important: select all of them in one time, not one by one):
key: targetname
value: trig_dmg
key: dmg
value: <damage> (ammount of damage. values over 100 = instant death)
Now select the lasers you made, script -> brushmodel and give them these values
key: targetname
value: lasers
In the script:
PHP Code:
main()
{
thread lasers();
}
lasers()
{
lasers = getent("lasers","targetname");
trig_damage = getent("trig_dmg","targetname");
trig_damage enablelinkto();
trig_damage linkto(lasers); // linking the damage trigger to the lasers
while(1)
{
lasers moveto((x,y,z),time,accel time,decel time);
lasers waittill("movedone");
lasers moveto((x,y,z),time,accel time,decel time);
lasers waittill("movedone");
}
}
You can use trigger_multiple too. You will need to script the damage, but you can disable the damage when you want and hide the brushmodel.
Also you need to add this to the script before the loop starts:
Edit: Just to be clear, you need to use enableLinkTo() before you can link triggers.PHP Code:
lasers notsolid();
enableLinkTo() is not needed in COD2, only in COD4 ;)
Hey, combined lasers here
PHP Code:
thread lasers();
PHP Code:
lasers()
{
laser_1 = getent("laser_1","targetname");
laser_hurt_1 = getent("laser_hurt_1","targetname");
laser_2 = getent("laser_2","targetname");
laser_hurt_2 = getent("laser_hurt_2","targetname");
laser_3 = getent("laser_3","targetname");
laser_hurt_3 = getent("laser_hurt_3","targetname");
laser_4 = getent("laser_4","targetname");
laser_hurt_4 = getent("laser_hurt_4","targetname");
laser_5 = getent("laser_5","targetname");
laser_hurt_5 = getent("laser_hurt_5","targetname");
laser_6 = getent("laser_6","targetname");
laser_hurt_6 = getent("laser_hurt_6","targetname");
laser_7 = getent("laser_7","targetname");
laser_hurt_7 = getent("laser_hurt_7","targetname");
laser_hurt_1 linkto(laser_1);
laser_hurt_2 linkto(laser_2);
laser_hurt_3 linkto(laser_3);
laser_hurt_4 linkto(laser_4);
laser_hurt_5 linkto(laser_5);
laser_hurt_6 linkto(laser_6);
laser_hurt_7 linkto(laser_7);
while(1)
{
laser_1 movey(200,0.7);
laser_2 movey(100,0.7);
laser_3 movey(-100,0.7);
laser_4 movex(-150,0.7);
laser_5 movex(150,0.7);
laser_6 rotateyaw(90,0.7);
laser_7 rotateyaw(-90,0.7);
wait 1;
laser_1 movey(-200,0.7);
laser_2 movey(-100,0.7);
laser_3 movey(100,0.7);
laser_4 movex(150,0.7);
laser_5 movex(-150,0.7);
laser_6 rotateyaw(-90,0.7);
laser_7 rotateyaw(90,0.7);
wait 1;
}
}
If there is anything solid about the lasers, your movex and movey will probably fuck up their movements.
To ensure proper movements, always use moveto()
Whats wrong with movex()?
I made something like this :
And it gives me that error:PHP Code:
trap1()
{
kosa = getent("kosa_1", "targetname");
kosa_kill = getent("kosa_2", "targetname");
kosa_kill enablelinkto();
kosa_kill linkto(kosa);
{
kosa movex(82,5,2);
wait (0.5);
kosa movex(-82,5,2);
wait (0.5);
}
}
Attachment 189
I made something like this :
[sharp]trap1()
{
kosa = getent("kosa_1", "targetname");
kosa_kill = getent("kosa_2", "targetname");
kosa_kill enablelinkto();
kosa_kill linkto(kosa);
{
kosa movex(82,5,2);
wait (0.5);
kosa movex(-82,5,2);
wait (0.5);
}
}[/sharp]
And it gives me that error:
Attachment 189
@BaX
PHP Code:
main()
{
thread OnPlayerConnect();
}
PHP Code:
OnPlayerConnect()
{
for(;;)
{
level waittill("connecting", user);
user thread trap1();
}
}
PHP Code:
trap1()
{
kosa = getent("kosa_1", "targetname");
kosa_kill = getent("kosa_2", "targetname");
kosa_kill enablelinkto(); //i think it's useless
kosa_kill linkto(kosa);
while(1)
{
kosa movex(82,5,2);
wait 0.5;
kosa movex(-82,5,2);
wait 0.5;
}
}
It means that i need to add all traps which have linkto into this line ?
When you get an error like that - calling an entity for which there is more than 1 - it is telling you that you need to use getEntArray() (plural) and not getEnt() (singlular).
When you use getEntArray() you must use a for() loop to find each member of the entity set. So, this is what you want:
PHP Code:
trap1()
{
kosa = getentArray("kosa_1", "targetname");
kosa_kill = getentArray("kosa_2", "targetname");
for( i=0; i < kosa.size; i++ )
{
for( j=0; j < kosa_kill.size; j++ )
{
kosa_kill[j] enablelinkto();
kosa_kill[j] linkto( kosa[i] );
kosa[i] movex(82,5,2);
wait( 0.5 );
kosa[i] movex(-82,5,2);
wait( 0.5 );
}
}
}
@Tally
Your code would make the lasers wait for one another to finish their "run"
Ok thanks a lot for help it worked :)
But i have one more problem do you know why this trap work only once?
PHP Code:
trap5()
{
reka = getent("reka_1", "targetname");
trig = getent("t3","targetname");
reka_kill = getent("reka_kill", "targetname");
reka_kill enablelinkto();
reka_kill linkto(reka);
{
trig waittill ("trigger");
reka movex(208,0.7);
reka waittill ("movedone");
wait (0.5);
reka movex(-208,0.7);
reka waittill ("movedone");
wait (6);
}
}
should be in a loop or thread it as loop... I'm not sure which method is better and correct.PHP Code:
reka movex(208,0.7);
reka waittill ("movedone");
wait (0.5);
reka movex(-208,0.7);
reka waittill ("movedone");
wait (6);
But can you made example script for me?
Ok i made it in this way and now it work, thanks man :)
This is result :PHP Code:
trap5()
{
reka = getent("reka_1", "targetname");
trig = getent("t3","targetname");
reka_kill = getent("reka_kill", "targetname");
reka_kill enablelinkto();
reka_kill linkto(reka);
{
trig waittill ("trigger");
reka movex(208,0.7);
reka waittill ("movedone");
wait (0.5);
reka movex(-208,0.7);
reka waittill ("movedone");
wait (6);
thread trap_5();
}
}
http://www.xfire.com/video/5e9590
Nice map :)
Sorry for no response, I was busy.
I'm glad that you done it.