help with script on deathrun map

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

help with script on deathrun map

Post by Pun1sheR » August 30th, 2013, 3:23 pm

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?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script on deathrun map

Post by Drofder2004 » August 31st, 2013, 5:19 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » August 31st, 2013, 8:31 pm

So far it works but I cannot seem to make it spin more then a 360 turn. Any ideas there?

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » August 31st, 2013, 9:05 pm

Also my door triggers don't delete so people can spam use it

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script on deathrun map

Post by Drofder2004 » August 31st, 2013, 9:15 pm

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();
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » August 31st, 2013, 9:51 pm

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?

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » August 31st, 2013, 9:53 pm

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?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script on deathrun map

Post by Drofder2004 » September 1st, 2013, 5:53 pm

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();
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » September 2nd, 2013, 3:40 pm

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 "";
}
??

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script on deathrun map

Post by Drofder2004 » September 2nd, 2013, 7:40 pm

If you got the code wrong, yes.

Code: Select all

if(inputCode == level.unlockCode)
{
   // Open Door
}
else
{
   // player suicide
}
 
// Reset Code
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » November 27th, 2013, 10:29 pm

Well, I've got another question for you, how would you make a GUID protected room?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script on deathrun map

Post by Drofder2004 » November 28th, 2013, 9:12 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » November 29th, 2013, 3:51 pm

Thanks man :)

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » November 29th, 2013, 3:52 pm

I tried doing this on my own, but instead of player getGuid I used player.guid

Pun1sheR
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: August 27th, 2013, 7:29 pm

Re: help with script on deathrun map

Post by Pun1sheR » November 29th, 2013, 9:36 pm

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?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests