| Author |
Topic: Script for a gate that opens with a trigger_damage |
| LennardN95 |
General Member Since: Sep 9, 2009 Posts: 35 Last: Oct 26, 2009 [view latest posts] |
|
|
|
Category: CoD Mapping Posted: Sunday, Sep. 27, 2009 07:08 pm |
 |
ok, i'm noob at scripting, that's why I'm asking you guys for help. Ok here's my idea, I wanna make a script, that if you shoot a texture in, a gate opens.
Now i have a texture named Mushroom, and I placed it in my (test) map. I right clicked on it @ 2D view and made it a Trigger_damage. Then i made the gate and made it a Script_brushmodel.
Mushroom texture:
Classname: Trigger_Damage
Targetname: Mushroom
Gate:
Classname: Script_Brushmodel
Targetname: Gate
Now I made this script (which is obvious wrong):
Quote:
mushroom()
{
trig = getent ("mushroom", "targetname");
while (1)
{
trig waittill ("trigger", user);
user.code = "";
}
}
mushroom_1()
{
code_1 = getent ("mushroom", "targetname");
while (1)
{
code_1 waittill ("trigger", user);
user.code += "1";
}
}
cannon()
{
code_trig = getEnt ("mushroom", "targetname");
code_door = getEnt ("gate", "targetname");
while (1)
{
mushroom waittill ("trigger", user);
if (user.code == "1")
{
user iPrintLnBold ("^2Access Granted");
wait 0.5;
code_door rotateYaw (-90, 2, 0.5, 0.5);
code_door waittill("rotatedone");
wait 5;
code_door rotateYaw (90, 2, 0.5, 0.5);
code_door waittill ("rotatedone");
}
else
{
user iPrintLnBold ("^1Access Denied");
user.code = "";
}
wait 3;
}
}
I used a diff script to make this one, and forgot to change the movements, but i can do that later.
Then I compiled my map, and when I shot the Mushroom, the gate didn't open?
Can anybody please help me?
Thx! |
 |
|
|
| GomerPyle |
General Member Since: Oct 1, 2006 Posts: 357 Last: Jul 14, 2011 [view latest posts] |
|
|
 |
|
|
| oppdelta |
General Member Since: Jun 3, 2007 Posts: 143 Last: Apr 27, 2011 [view latest posts] |
|
|
|
Category: CoD Mapping Posted: Sunday, Sep. 27, 2009 11:16 pm |
 |
NuuuuUU!
A trigger MUST HAVE the trigger texture. Make another brush around ya mushroom or w/e and get it the targetname "trig_mush"
Code:
main()
{
thread gate();
}
gate()
{
trigger = getent("trig_mush","targetname")
while(1)
{
trigger waittill("trigger", user)
user iPrintLnBold ("^2Access Granted");
wait 0.5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}
|
 |
|
|
| Sevenz |
 |
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
|
|
| LennardN95 |
General Member Since: Sep 9, 2009 Posts: 35 Last: Oct 26, 2009 [view latest posts] |
|
|
|
Category: CoD Mapping Posted: Monday, Sep. 28, 2009 03:48 pm |
 |
OK thx for the replies, but it still doesn't work.
Here's what I did.
I selected the trigger texture from ''common'' and made a trigger in front of the mushroom, and made it a trigger_damage surface or entity or whatever its called, targetname: trigger_mush, after pressing enter, I pressed escape to deselect.
Then I selected the gate, and made it a script_brushmodel, targetname: gate.
Then I copied oppdelta's script, and followed Sevenz instruction, so I replaced trigger waittill ("trigger") to trigger waittill ("damage")
I made a .pk3 map, and put it in maps/mp, called trigger_mush.gsc
Then I tested my map, shot to the Mushroom, but nothing happened?
s
Should I ''connect'' the Mushroom and the Gate together? Or did I do anything wrong at scripting? Here's my script.
Quote: main()
{
thread gate();
}
gate()
{
trigger = getent("trig_mush","targetname")
while(1)
{
trigger waittill("damage", user)
user iPrintLnBold ("^2Access Granted");
wait 0.5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}
I hope you know how to fix.
Thx! |
 |
|
|
| oppdelta |
General Member Since: Jun 3, 2007 Posts: 143 Last: Apr 27, 2011 [view latest posts] |
|
|
|
Category: CoD Mapping Posted: Monday, Sep. 28, 2009 07:33 pm |
 |
GRRRR... Maybe on COD4/5 It's "damage" but on vCOD it's "trigger"
Put it back to my way >.>
Oh i forgot to add somthign to the script, use this.
Code:
main()
{
thread gate();
}
gate()
{
trigger = getent("trigger_mush","targetname");
gate = getent("gate","targetname");
while(1)
{
trigger waittill("trigger", user);
user iprintlnbold ("^2Access Granted");
wait .5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}
edited on Sep. 28, 2009 03:34 pm by oppdelta
edited on Sep. 29, 2009 12:12 am by oppdelta |
 |
|
|
| Sevenz |
 |
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
|
|
| LennardN95 |
General Member Since: Sep 9, 2009 Posts: 35 Last: Oct 26, 2009 [view latest posts] |
|
|
|
Category: CoD Mapping Posted: Monday, Sep. 28, 2009 08:31 pm |
 |
It says: Script Compile Error.
The error in console is: bad syntax.
This is what I did.
I selected the Mushroom, then I made it a trigger_damage
I deselected, and made a common trigger brush around it, and made it a trigger_damage too.
I selected both entities, and entered this:
classname: trigger_damage
targetname: trigger_mush
Then I compiled map, no errors yet.
After that I made a .GSC file with this script:
Quote: main()
{
thread gate();
}
gate()
{
trigger = getent("trig_mush","targetname");
gate = getent("gate","targetname");
while(1)
{
trigger waittill("trigger", user)
user iprintlnbold ("^2Access Granted");
wait .5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}
And put it in my maps/mp folder of my .pk3 file.
But when I tried to test it, it failed?
Should the gate be a Script_brushmodel?
Thanks for the help! |
 |
|
|
| LennardN95 |
General Member Since: Sep 9, 2009 Posts: 35 Last: Oct 26, 2009 [view latest posts] |
|
|
|
|
| Sevenz |
 |
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|