Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 56 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty
Category: CoDUO Mapping
CoD United Offensive mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Last scripting needed: trigger on/off triger.origin?help needed
pallchrn
General Member
Since: Feb 12, 2004
Posts: 31
Last: Feb 16, 2010
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Thursday, Nov. 8, 2007 10:41 am
hi thx in advance
i have only one more script to finish to release my map and wondering if anyone can help me. i have a door which goes up and down using triggers but as it comes down. someone is standing underneath it glitches and holds the player underneath. caqn anyone think oif a trigger_hurt or a script_brushmodel that would move or destroy of the player when the door is descending thankyou.i was thinking of a poited brush that would go up as the door comes down to move the player.i tried the trigger:off trigger: on script but not sure if trigger_hurt would work. and only works for a trigger_use (if it works for trigger_hurt plz reply): the script i have is similar to:

main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

elevator_start() {
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 192;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}



Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoDUO Mapping
Posted: Thursday, Nov. 8, 2007 04:27 pm
That requires a trigger hurt to be linked to your doors. Do a forum search for "enablelinkto", it should return lots of results for just what you want.
Share |
pallchrn
General Member
Since: Feb 12, 2004
Posts: 31
Last: Feb 16, 2010
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Thursday, Nov. 8, 2007 09:36 pm
thankyou very much caretaker i searched for the linkto and found a very useful post about a big block ;p (exactly what i wanted)

now i have a problem for the trigger of my door to work with the big block here are my .gsc files trying to use (i want the block to work at the time the door is coming down)


door script:


main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
thread elevator_start2();
}

elevator_start() {
elevator = getentarray ("door_sequence_trigger","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}
elevator_start2() {
elevator = getentarray ("door_trigger_2","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("updowndoor", "targetname");
;
level.elevatorMoving = true;
speed = 3;
height = 170;
wait (1);
if (level.elevatorDown) { // moves to top
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}


block script eddited:


Main ()
{
maps\mp\_load::main();
thread block_move();
thread block_kill();
}

block_move()
{
block = getent ("block","targetname");
trig = getent ("block_trigger","targetname");

while (1)
{
trig waittill ("trigger",user);
block moveto ((-675,-240,0), 2);
block waittill ("movedone");
wait 2;
block moveto ((-675,-240,168), 2);
block waittill ("movedone");
}
}

block_kill()
{
block = getent ("block","targetname");
killzone = getent ("block_killzone","targetname");

while (1)
{
killzone waittill ("trigger",user);
if (user istouching(block))
{
user suicide();
wait 1;
}
}
}
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoDUO Mapping
Posted: Friday, Nov. 9, 2007 05:23 pm
I wouldn't use two seperate scripts for that, but just one and have both the block and the door react to the same trigger.. but that's just me.

My guess why the block won't move..

you've used two main() functions (unless they're in seperate .gsc files). Call both block_move(); and block_kill(); functions from your elevator main() function...
In your block main() function you call the _load function (this should be done from your map.gsc main function only, no need for it to be there.



Share |
pallchrn
General Member
Since: Feb 12, 2004
Posts: 31
Last: Feb 16, 2010
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Friday, Nov. 9, 2007 06:46 pm
ok i tried into one script ( thankyou caretaker)

but nothing working now, the sound works for the door but nothing moves (updowndoor is the origin and door)
i took out the block_trigger (as triggered from the door)


main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
thread elevator_start2();
thread block_kill();
}

elevator_start() {
elevator = getentarray ("door_sequence_trigger","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}
elevator_start2() {
elevator = getentarray ("door_trigger_2","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();

}
}

elevator_move() {
elevatormodel = getentarray ("updowndoor", "targetname");
;
level.elevatorMoving = true;
speed = 3;
height = 170;
wait (1);
if (level.elevatorDown) { // moves to top
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}


block_kill()
{
death = getentarray ("updowndoor","targetname");
killzone = getent ("block_killzone","targetname");

while (1)
{
killzone waittill ("death",user);
if (user istouching(death))
{
user suicide();
wait 1;
}
}
}
Share |
pallchrn
General Member
Since: Feb 12, 2004
Posts: 31
Last: Feb 16, 2010
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Friday, Nov. 9, 2007 07:23 pm
k i noticed i didnt have trigger and had death at the bottom of the script . altered this and it now kils me when i walk into the block_killzone for some reason. the door still dosnt go up though
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoDUO Mapping
Posted: Saturday, Nov. 10, 2007 09:41 am
The door is not moving because you used getentarray on your door... this means all the entities with the targetname updowndoor will be put in an array (is there even more than one?)

Two solutions
1) If there is just one door with that targetname.. change getentarray ("updowndoor", "targetname"); to
getent ("updowndoor", "targetname");

2)
Use a for loop calling the different entities in the array
Share |
pallchrn
General Member
Since: Feb 12, 2004
Posts: 31
Last: Feb 16, 2010
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Saturday, Nov. 10, 2007 02:13 pm
thankyou caretaker for all your help

i got the door working a dream now ;p

if anyone wants the script ill leave it here any questions xfire me "pallchrn"

i had to use two script 1st is the door
main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
thread elevator_start2();
}

elevator_start() {
elevator = getentarray ("door_sequence_trigger","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}
elevator_start2() {
elevator = getentarray ("door_trigger_2","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("updowndoor", "targetname");
;
level.elevatorMoving = true;
speed = 3;
height = 170;
wait (1);
if (level.elevatorDown) { // moves to top
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
fish = getent ("doorsound", "targetname");
fish playsound ("doorso"); // sound definition for soundaliases.csv
wait (1);
thread maps\mp\hotchkiss_script::main();
elevatormodel moveZ (height - (height * 2), speed,1,1);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}


and the 2nd was the door killzone

Main ()
{

block = getent ("block","targetname");
fish = getent ("block_killzone","targetname");
trig = getent ("block_trigger","targetname");
block thread maps\mp\_utility::triggeron();
fish thread maps\mp\_utility::triggeron();
trig thread maps\mp\_utility::triggerOn();
thread block_move();
thread block_kill();
}

block_move()
{
block = getent ("block","targetname");
trig = getent ("block_trigger","targetname");
fish = getent ("block_killzone","targetname");

while (1)
{
trig waittill ("trigger",user);
block moveto ((-675,-240,0), 2);
block waittill ("movedone");
wait 2;
block moveto ((-675,-240,168), 2);
block waittill ("movedone");
block thread maps\mp\_utility::triggerOff();
fish thread maps\mp\_utility::triggerOff();
trig thread maps\mp\_utility::triggerOff();
}

}

block_kill()
{
block = getent ("block","targetname");
killzone = getent ("block_killzone","targetname");

while (1)
{
killzone waittill ("trigger",user);
if (user istouching(block))
{
user suicide();
wait 1;
}
}
}
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty : CoDUO Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»