A kind of code is it possible?
Moderator: Moderators
-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
A kind of code is it possible?
hi all
i wonder if it possible to make a kind of code to activate one thing ?
activate 3 switch in a precisely order to Light On then make the light Off in a few secondes for example
in a precisely order ...........
thx
i wonder if it possible to make a kind of code to activate one thing ?
activate 3 switch in a precisely order to Light On then make the light Off in a few secondes for example
in a precisely order ...........
thx
script
Almost anything is possible, but your request is not very clear. Is it a puzzle the players must figure out? We will need the targetnames of your switches, triggers, and light entities. Post your script, if you have one.
-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
ok tltrude the pb is that i dont have the script yet!!!! i need your help.....
ok ill try to explain in a easiest way :
- i want to make a trigger triggerable(trigger teleport) only if i active some kinds of computer
for example 3 computers ( script object )
targetname: computer1
targetname: computer2
targetname: computer3
and 3 trigger use that fit each compu
targetname: computer1_trigger
targetname: computer2_trigger
targetname: computer3_trigger
my target :
active the computer 2 then the computer 1 then the computer 3 to make the trigger teleport triggerable
how i can script it ?
hope you understand me
TY
ok ill try to explain in a easiest way :
- i want to make a trigger triggerable(trigger teleport) only if i active some kinds of computer
for example 3 computers ( script object )
targetname: computer1
targetname: computer2
targetname: computer3
and 3 trigger use that fit each compu
targetname: computer1_trigger
targetname: computer2_trigger
targetname: computer3_trigger
my target :
active the computer 2 then the computer 1 then the computer 3 to make the trigger teleport triggerable
how i can script it ?
hope you understand me
TY
ok
Ok, I see what your saying. But still need some info.
1. Why are the computers script_objects? Will they be replaced when the triggers are used? If this is the case, what are the targetnames of the computers that replace them?
2. What should happen if the computer triggers are not triggered in the right sequence?
3. Is this an objective game or a dm game? Is it Mohaa, SH, or BT?
5. What is the targetname of the teleport trigger?
1. Why are the computers script_objects? Will they be replaced when the triggers are used? If this is the case, what are the targetnames of the computers that replace them?
2. What should happen if the computer triggers are not triggered in the right sequence?
3. Is this an objective game or a dm game? Is it Mohaa, SH, or BT?
5. What is the targetname of the teleport trigger?
-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
script
Why do the computer's need targetnames?
Ok, well I guess I'll use the computer script_objects as speakers, although the triggers could have played the sounds. I have no idea if this script will work or not. Name it the same as your bsp file (.scr) and put it in the same location.
Ok, well I guess I'll use the computer script_objects as speakers, although the triggers could have played the sounds. I have no idea if this script will work or not. Name it the same as your bsp file (.scr) and put it in the same location.
Code: Select all
//Your map name
//Architecture by:
//Scripting by: tltrude & bdbodger
// -------------------------------------------------------------------------------------
main:
// -------------------------------------------------------------------------------------
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Your map name!"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_alliedtext4" ""
setcvar "g_obj_alliedtext5" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_obj_axistext4" ""
setcvar "g_obj_axistext5" ""
setcvar "g_scoreboardpic" ""
waitthread global/lib_dm.scr::liberation_init
///////////////////////
level waittill prespawn
///////////////////////
// $world farplane 2200
// $world farplane_color ".09 .10 .12"
// $world farplane_bias 250
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr
exec global/dm_ai.scr
// level.music="MP_Anzio"
// level.script = maps/lib/mp_yourmapname_lib.scr
exec global/ambient.scr mohdm1
thread computer_engage
////////////////////
level waittill spawn
////////////////////
if (level.gametype > 2)
{
/////////////////////////
level waittill roundstart
/////////////////////////
}
if (level.gametype == 6)
{
// obj#, status, text, location
// status -- 1) don't draw, 2) in progress, 3) completed
addobjective 1 1 "Free teammates from the jail" $alliesjailswitch.origin
addobjective 2 1 "Free teammates from the jail" $axisjailswitch.origin
setcurrentobjective 1 allies
setcurrentobjective 2 axis
//Setup our jail break triggers
$axisjailtrigger thread AxisJailTrigger
$alliesjailtrigger thread AlliesJailTrigger
}
end
// -------------------------------------------------------------------------------------
AxisJailTrigger:
// -------------------------------------------------------------------------------------
self waittill trigger
//set the player using the jail switch trigger
local.player = parm.other
//flip the switch first
if( local.player.dmteam == axis )
{
waitthread DoAxisSwitch
thread global/lib_dm.scr::axisjaildooruse local.player
wait 12
waitthread DoAxisSwitch
}
$axisjailtrigger thread AxisJailTrigger
end
// -------------------------------------------------------------------------------------
AlliesJailTrigger:
// -------------------------------------------------------------------------------------
self waittill trigger
local.player = parm.other
//flip the switch first
if( local.player.dmteam == allies )
{
waitthread DoAlliesSwitch
thread global/lib_dm.scr::alliesjaildooruse local.player
wait 12
waitthread DoAlliesSwitch
}
$alliesjailtrigger thread AlliesJailTrigger
end
// -------------------------------------------------------------------------------------
DoAxisSwitch:
// -------------------------------------------------------------------------------------
if( level.bAxisSwitchDown == 0 )
{
$axisjailswitch anim turnoff
$axisjailswitch waittill animdone
level.bAxisSwitchDown = 1
}
else
{
$axisjailswitch anim turnon
$axisjailswitch waittill animdone
level.bAxisSwitchDown = 0
}
end
// -------------------------------------------------------------------------------------
DoAlliesSwitch:
// -------------------------------------------------------------------------------------
if( level.bAlliesSwitchDown == 0 )
{
$alliesjailswitch anim turnoff
$alliesjailswitch waittill animdone
level.bAlliesSwitchDown = 1
}
else
{
$alliesjailswitch anim turnon
$alliesjailswitch waittill animdone
level.bAlliesSwitchDown = 0
}
end
// -------------------------------------------------------------------------------------
// computer engage threads
// -------------------------------------------------------------------------------------
computer_engage:
level.c2_on = 0
level.c1_on = 0
level.c3_on = 0
thread com2
thread com1
thread com3
while (1) // "gate1_tele" is triggerable only if computers are activated in sequence (2-1-3).
{
if ((level.c2_on == 1) && (level.c2_on == 1) && (level.c2_on == 1))
{
$gate1_tele triggerable
wait 45 // <-- delay in seconds before reset
goto computer_engage
end
}
if ((level.c2_on != 1) || (level.c2_on != 1) || (level.c2_on != 1))
{
$gate1_tele nottriggerable
}
wait .1
}
end
com1:
$computer1_trigger waitill trigger
if ((level.c2_on == 1) && (level.c3_on == 0))
{
level.c1_on = 1
$computer1 playsound webley_snd_pickup
iprintln "Computer 1 engaged!"
end
}
$computer1 playsound webley_snd_noammo
level.c2_on = 0
level.c3_on = 0
iprintln "Sequence incorrect! Computers reset!"
goto com1
end
com2:
$computer2_trigger waitill trigger
if ((level.c1_on == 0) && (level.c3_on == 0))
{
level.c2_on = 1
$computer2 playsound webley_snd_pickup
iprintln "Computer 2 engaged!"
end
}
$computer2 playsound webley_snd_noammo
level.c1_on = 0
level.c3_on = 0
iprintln "Sequence incorrect! Computers reset!"
goto com2
end
com3:
$computer3_trigger waitill trigger
if ((level.c1_on == 1) && (level.c2_on == 1))
{
level.c3_on = 1
iprintln "Sequence correct, gate engaged!"
$computer3 playsound webley_snd_pickup
end
}
$computer3 playsound webley_snd_noammo
level.c1_on = 0
level.c2_on = 0
iprintln "Sequence incorrect! Computers reset!"
goto com3
end
Here is another script that has lights too . I spawned them at the trigger locations but there are other ways to do it .
Code: Select all
//Your map name
//Architecture by:
//Scripting by: tltrude & bdbodger
// -------------------------------------------------------------------------------------
main:
// -------------------------------------------------------------------------------------
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Your map name!"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_alliedtext4" ""
setcvar "g_obj_alliedtext5" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_obj_axistext4" ""
setcvar "g_obj_axistext5" ""
setcvar "g_scoreboardpic" ""
waitthread global/lib_dm.scr::liberation_init
///////////////////////
level waittill prespawn
///////////////////////
// $world farplane 2200
// $world farplane_color ".09 .10 .12"
// $world farplane_bias 250
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr
exec global/dm_ai.scr
// level.music="MP_Anzio"
// level.script = maps/lib/mp_yourmapname_lib.scr
exec global/ambient.scr mohdm1
level.com_index = 0
// -------------------------------------------------------------------------------------------------------
// you can do this hear but better to set the keys in radiant no targetname needed if you do it in radiant
// -------------------------------------------------------------------------------------------------------
$computer1_trigger.setthread = computer_triggers
$computer1_trigger.set = 1
$computer2_trigger.setthread = computer_triggers
$computer2_trigger.set = 2
$computer3_trigger.setthread = computer_triggers
$computer3_trigger.set = 3
////////////////////
level waittill spawn
////////////////////
if (level.gametype > 2)
{
/////////////////////////
level waittill roundstart
/////////////////////////
}
if (level.gametype == 6)
{
// obj#, status, text, location
// status -- 1) don't draw, 2) in progress, 3) completed
addobjective 1 1 "Free teammates from the jail" $alliesjailswitch.origin
addobjective 2 1 "Free teammates from the jail" $axisjailswitch.origin
setcurrentobjective 1 allies
setcurrentobjective 2 axis
//Setup our jail break triggers
$axisjailtrigger thread AxisJailTrigger
$alliesjailtrigger thread AlliesJailTrigger
}
end
// -------------------------------------------------------------------------------------
AxisJailTrigger:
// -------------------------------------------------------------------------------------
self waittill trigger
//set the player using the jail switch trigger
local.player = parm.other
//flip the switch first
if( local.player.dmteam == axis )
{
waitthread DoAxisSwitch
thread global/lib_dm.scr::axisjaildooruse local.player
wait 12
waitthread DoAxisSwitch
}
$axisjailtrigger thread AxisJailTrigger
end
// -------------------------------------------------------------------------------------
AlliesJailTrigger:
// -------------------------------------------------------------------------------------
self waittill trigger
local.player = parm.other
//flip the switch first
if( local.player.dmteam == allies )
{
waitthread DoAlliesSwitch
thread global/lib_dm.scr::alliesjaildooruse local.player
wait 12
waitthread DoAlliesSwitch
}
$alliesjailtrigger thread AlliesJailTrigger
end
// -------------------------------------------------------------------------------------
DoAxisSwitch:
// -------------------------------------------------------------------------------------
if( level.bAxisSwitchDown == 0 )
{
$axisjailswitch anim turnoff
$axisjailswitch waittill animdone
level.bAxisSwitchDown = 1
}
else
{
$axisjailswitch anim turnon
$axisjailswitch waittill animdone
level.bAxisSwitchDown = 0
}
end
// -------------------------------------------------------------------------------------
DoAlliesSwitch:
// -------------------------------------------------------------------------------------
if( level.bAlliesSwitchDown == 0 )
{
$alliesjailswitch anim turnoff
$alliesjailswitch waittill animdone
level.bAlliesSwitchDown = 1
}
else
{
$alliesjailswitch anim turnon
$alliesjailswitch waittill animdone
level.bAlliesSwitchDown = 0
}
end
// -------------------------------------------------------------------------------------
// computer engage threads
// -------------------------------------------------------------------------------------
computer_triggers: // "gate1_tele" is triggerable only if computers are activated in sequence (2-1-3).
{
level.com_index++
self playsound webley_snd_pickup
iprintln "Computer " self.set " engaged!"
level.com_order[level.com_index] = self.set
if(level.light[level.com_index])
{
level.light[level.com_index] = spawn script_model model fx/dummy.tik origin self.origin
level.light[level.com_index] light 1 0 0 100 // red light 100 radius
level.light[level.com_index] thread flash
}
else
level.light[level.com_index] delete
if(level.com_index == 3)
{
wait 1
If( level.com_order[1]== 2 && level.com_order[2] == 1 && level.com_order[3] == 3)
{
iprintln " you have the right order "
$gate1_tele triggerable
wait 45
$gate1_tele nottriggerable
for(local.i = 1;local.i <= 3;local.i++)
level.light[local.i] delete
}
else
{
playsound webley_snd_noammo // new sound maybe
iprintln "Sequence incorrect!"
}
level.com_index = 0
}
}
end
flash:
while(self)
{
self lighton
wait .5
self lightoff
wait .5
}
end-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
I think maybe it should delete the lights after the third try and it is not correct like this
instead of this
Code: Select all
If( level.com_order[1]== 2 && level.com_order[2] == 1 && level.com_order[3] == 3)
{
iprintln " you have the right order "
$gate1_tele triggerable
wait 45
$gate1_tele nottriggerable
}
else
{
playsound webley_snd_noammo // new sound maybe
iprintln "Sequence incorrect!"
}
for(local.i = 1;local.i <= 3;local.i++)
level.light[local.i] delete
level.com_index = 0
}
Code: Select all
If( level.com_order[1]== 2 && level.com_order[2] == 1 && level.com_order[3] == 3)
{
iprintln " you have the right order "
$gate1_tele triggerable
wait 45
$gate1_tele nottriggerable
for(local.i = 1;local.i <= 3;local.i++)
level.light[local.i] delete
}
else
{
playsound webley_snd_noammo // new sound maybe
iprintln "Sequence incorrect!"
}
level.com_index = 0
}

