Page 1 of 1
Posted: January 29th, 2008, 6:13 pm
by DarthDuval
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.
Posted: January 30th, 2008, 1:20 pm
by DarthDuval
i dont think i get it fully, but i'll do my best, and i'm not that good with scripting...
Posted: January 31st, 2008, 2:28 am
by Drofder2004
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
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

Posted: January 31st, 2008, 6:09 pm
by DarthDuval
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 ?)
Posted: January 31st, 2008, 6:31 pm
by Drofder2004
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

Posted: February 1st, 2008, 8:04 pm
by DarthDuval
*sig* the scripting wont work with me... maybe anyone wants to do the scripting of the map ?
Posted: February 2nd, 2008, 12:32 am
by Nightmare
What errors are you getting?
Posted: February 2nd, 2008, 2:34 am
by Drofder2004
/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.
Posted: February 2nd, 2008, 5:03 pm
by DarthDuval
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...