Trigger Help

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

Moderator: Core Staff

Post Reply
DarthDuval
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: January 29th, 2008, 6:06 pm
Location: Belgium

Post by DarthDuval » January 29th, 2008, 6:13 pm

Hello, i'm a new mapper for CoD, but i have some experiance with GTKRadiant.

About that trigger damage, can i do the next thing with it? :

I want to make a sort of parcours, and you need to shoot three (different) targets. after you shoot the targets, a door must open. Anyone an idea how i can do that ?

already thanks.
DarthDuval was here...

Image
Image

DarthDuval
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: January 29th, 2008, 6:06 pm
Location: Belgium

Post by DarthDuval » January 30th, 2008, 1:20 pm

i dont think i get it fully, but i'll do my best, and i'm not that good with scripting...
DarthDuval was here...

Image
Image

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

Post by Drofder2004 » January 31st, 2008, 2:28 am

This would require scripting, there is a way of mapping it, but that would require me re-learning things which would be pointless, as scripting this would be 100 times easier.


Ignore the above, its a suggestion that would work, but there is an easier way (sort of) :)

Create all 3 triggers (trigger_damage).
Give them all the same targetname (e.g. trigTarget)
Make your door, give it a targetname of anything, e.g Door...

That is all that is needing to be mapped

Your script shouldn't be too hard, but if you have never worked with scripting, then this may look a bit like jibberish :P

Code: Select all

main()
{
   // Get all the triggers in one level variable (for global access).
   level.trigs = getentarray("trigTarget","targetname");
   // Get the door.
   door = getent("door","targetname");

   // Create a loop to tell the triggers to wait for damage
   // Pseudocode of a for loop...
   // Assign variable 'i' (index) to zero
   // Every loop check if 'i' is less than the amount of triggers (.size), if true...
   // Add 1 to variable 'i'
   // Using this loop all triggers will be threaded to a different function
   // It will also be given a new linked variable.
   for(i=0;i<level.trigs.size;i++);
   {
      level.trigs[i].damaged = false;
      level.trigs[i] thread checkDamage();
   }
   
   // Give the door its own thread to open when ready.
   door thread checkOpen();
}
   
//Damage thread, checks for damage
checkDamage()
{
   self waittill ("damage");
   self.damaged = true;
}

// Door open thread.
checkOpen()
{
   openDoor = 0;
   // While loop, pseuodocode:
   // While variable openDoor is not equal to the amount of triggers, keep looping.
   while(openDoor != level.trigs.size)
   {
      // reset variable every loop.
      openDoor = 0;

      // check if all triggers damaged
      for(i=0;i<level.trigs.size;i++)
         if(level.trigs[i].damaged == true)
            openDoor++;
   }
   // The for loop above works as follows.
   // It will loop the same amount of times as there are triggers
   // If the trigger has been damaged, it will add 1 to the variable
   // Else it continues...
   // If the variable equals the same value as the amount of triggers, the while loop will terminate
   // Once terminated, the door will rotate.

   door rotateTo((0,90,0), 1);
}
This code will only work once per map, and only for one player, a map_restart would be required to replay it. If you want it to reset at a point, either time or button, then it gets a little more complex each option. The above code is very determinate of a certain situation, changing the situation may change the code (simplify or become more complex), so although the code above should work, it may not work for all situations.

My recommendation, is to create your map and ignore the actual scripting for now, just remember what you want to happen and where, and then come back with a more in depth look at what you want done :)
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

DarthDuval
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: January 29th, 2008, 6:06 pm
Location: Belgium

Post by DarthDuval » January 31st, 2008, 6:09 pm

okay thx i'll try so best as i can, but... if i want to do it again, do i need to set another script or something ?


(by the way, when i want to play this map on codmp, it wont work, i press the start button after i selected my map to start new server, and the game just do nothing. anyone an idea why it doesnt work ?)
DarthDuval was here...

Image
Image

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

Post by Drofder2004 » January 31st, 2008, 6:31 pm

DarthDuval wrote:okay thx i'll try so best as i can, but... if i want to do it again, do i need to set another script or something ?


(by the way, when i want to play this map on codmp, it wont work, i press the start button after i selected my map to start new server, and the game just do nothing. anyone an idea why it doesnt work ?)
You need to compile it and etc, there are many posts around here somewhere and Nightmare still does CoD maps, so he can fill in those blanks, as I haven't touched CoD1 mapping for a very long time :)
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

DarthDuval
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: January 29th, 2008, 6:06 pm
Location: Belgium

Post by DarthDuval » February 1st, 2008, 8:04 pm

*sig* the scripting wont work with me... maybe anyone wants to do the scripting of the map ?
DarthDuval was here...

Image
Image

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » February 2nd, 2008, 12:32 am

What errors are you getting?
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » February 2nd, 2008, 2:34 am

/developer 1

Put that in console and run your map.
Post your errors, that code I wrote straight off the top of my head in about 10 minutes, there is bound to be mistakes.
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

DarthDuval
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: January 29th, 2008, 6:06 pm
Location: Belgium

Post by DarthDuval » February 2nd, 2008, 5:03 pm

there is a little problem with playin the map, cuz i've already pressed the start button a 1000 times, but my map wont run...
DarthDuval was here...

Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests