Trigger Help
Moderator: Core Staff
-
- CJ Wannabe
- Posts: 5
- Joined: January 29th, 2008, 6:06 pm
- Location: Belgium
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.
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.
-
- CJ Wannabe
- Posts: 5
- Joined: January 29th, 2008, 6:06 pm
- Location: Belgium
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
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
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
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
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);
}
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
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
-
- CJ Wannabe
- Posts: 5
- Joined: January 29th, 2008, 6:06 pm
- Location: Belgium
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 ?)
(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 ?)
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
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 timeDarthDuval 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 ?)
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
-
- CJ Wannabe
- Posts: 5
- Joined: January 29th, 2008, 6:06 pm
- Location: Belgium
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]
"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]
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
/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.
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.
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
-
- CJ Wannabe
- Posts: 5
- Joined: January 29th, 2008, 6:06 pm
- Location: Belgium
Who is online
Users browsing this forum: No registered users and 0 guests