Page 1 of 2

help with script on deathrun map

Posted: August 30th, 2013, 3:23 pm
by Pun1sheR
He if anyone can help me it would be great. I'm trying to make spinning circle trap fo my map but it doesn't work when I hit the activate button. My other two do idk if its script problem or what but here's my script.

Code: Select all

main()
{
   Trap02 = getentarray ("trap02", "targetname");
   If (isdefined(trap02))
   For (I = 0; I < trap02.size; i ++)
   Trap02[i] thread trap02_start();
}
Trap02_start()
{
   Brush = getEnt ("trap02", "targetname");
   Trig = getEnt ("trap02_activate", "targetname");
   Trig waittill ("trigger", who);
   Trig delete();
   {
      Brush rotateYaw(360,0.5),
      Wait 120;
   }
}
Any ideas what might be wrong?

Re: help with script on deathrun map

Posted: August 31st, 2013, 5:19 pm
by Drofder2004
Pun1sheR wrote:He if anyone can help me it would be great. I'm trying to make spinning circle trap fo my map but it doesn't work when I hit the activate button. My other two do idk if its script problem or what but here's my script.

Code: Select all

main()
{
   Trap02 = getentarray ("trap02", "targetname");
   If (isdefined(trap02))
   For (I = 0; I < trap02.size; i ++) <-- THIS
   Trap02[i] thread trap02_start();
}
Trap02_start()
{
   Brush = getEnt ("trap02", "targetname"); <-- THIS
   Trig = getEnt ("trap02_activate", "targetname");
   Trig waittill ("trigger", who);
   Trig delete();
   {
      Brush rotateYaw(360,0.5),
      Wait 120;
   }
}
[/size]
Any ideas what might be wrong?
Trap02 = getentarray ("trap02", "targetname"); // Multiple entities
Brush = getEnt ("trap02", "targetname"); // Single entity

If you have more the one entity in the map called "trap02", you can not use 'getEnt'.

For (I = 0; I < trap02.size; i ++) <-- THIS
'i++' not 'i ++'

Code: Select all

main()
{
   trap02 = getEntArray ("trap02", "targetname");
   if( isDefined( trap02 ))
      for(i = 0; i < trap02.size; i++)
         trap02[i] thread trap02_start();
}
 
trap02_start()
{
   trig = getEnt ("trap02_activate", "targetname");
   trig waittill ("trigger", who);
   trig delete();
 
   self rotateYaw(360,0.5),
   wait 120;
}
There are still flaws with the code, but without knowing what you are doing and what you are aiming to achieve, I cannot fix it.

Re: help with script on deathrun map

Posted: August 31st, 2013, 8:31 pm
by Pun1sheR
So far it works but I cannot seem to make it spin more then a 360 turn. Any ideas there?

Re: help with script on deathrun map

Posted: August 31st, 2013, 9:05 pm
by Pun1sheR
Also my door triggers don't delete so people can spam use it

Re: help with script on deathrun map

Posted: August 31st, 2013, 9:15 pm
by Drofder2004
What exactly are you trying to do...

The reason it spins for no more than 360, is because you SET it to 360. You want it to spin more:

Code: Select all

spins = 100;
rotateYaw((360*spins), (0.5*spins));
Instead of trying to delete the trigger, just turn it off.

Code: Select all

trig thread maps\mp\_utility::triggerOff();

Re: help with script on deathrun map

Posted: August 31st, 2013, 9:51 pm
by Pun1sheR
I'm trying to make a deathrun map, and this is my first one. And thanks for the help with spins :). But the triggeroff thing do I have to make it or what?

Re: help with script on deathrun map

Posted: August 31st, 2013, 9:53 pm
by Pun1sheR
Never mind I just noticed the utility thing.
Thanks a lot, and one more thing. Do you know how to make the traps that move back and forth in like an arc with the spikes on the ends?

Re: help with script on deathrun map

Posted: September 1st, 2013, 5:53 pm
by Drofder2004
Sorry, but I do not know maps off the top of my head...

Most 'traps' that cause death use a trigger_damage or a trigger_multiple (required for CoDJumper Mod)

Moving triggers:
viewtopic.php?f=19&t=3538

The function:

Code: Select all

trig = getEnt("trig", "targetname");
trig waittill("trigger", p);
p suicide();

Re: help with script on deathrun map

Posted: September 2nd, 2013, 3:40 pm
by Pun1sheR
Woulds that suicide script work on a keycode door if you put that after else? If so would it be:
else
{
P suicde();
Level.input "";
}
??

Re: help with script on deathrun map

Posted: September 2nd, 2013, 7:40 pm
by Drofder2004
If you got the code wrong, yes.

Code: Select all

if(inputCode == level.unlockCode)
{
   // Open Door
}
else
{
   // player suicide
}
 
// Reset Code

Re: help with script on deathrun map

Posted: November 27th, 2013, 10:29 pm
by Pun1sheR
Well, I've got another question for you, how would you make a GUID protected room?

Re: help with script on deathrun map

Posted: November 28th, 2013, 9:12 pm
by Drofder2004
Pun1sheR wrote:Well, I've got another question for you, how would you make a GUID protected room?

Code: Select all

level.guid = xyz;
if(player getGuid() == level.guid)
{
   /* Allow entry */
}
This will not work on listen servers, only online servers.

Re: help with script on deathrun map

Posted: November 29th, 2013, 3:51 pm
by Pun1sheR
Thanks man :)

Re: help with script on deathrun map

Posted: November 29th, 2013, 3:52 pm
by Pun1sheR
I tried doing this on my own, but instead of player getGuid I used player.guid

Re: help with script on deathrun map

Posted: November 29th, 2013, 9:36 pm
by Pun1sheR
And you could tell it works in listen when you put the correct code and it says error, if you have it set to do that, and I have one more then I'm done... The map I've been doing all this one has three different ways... Easy medium and hard, would it be better to do easy and hard for a first map or continue with all three ways?