Page 2 of 2

Posted: Fri Jun 03, 2005 7:34 pm
by wacko
#1: Like Rookie One said, this thread is called by the trigger_multiple itself (by the key/value setthread/room_occupied). You don't have to call it from the main thread nor would you have to "introduce" it to the script or such. As soon as the trigger is touched, it goes for the thread and executes it. :wink:

#2: Your way is working but I would add another thread to make your script easier to read. Like this:

Code: Select all

main:
...
level waittill spawn
thread occupied_prep
...
end

occupied_prep:
$object hide
$object1 hide
$object2 hide
end

Posted: Fri Jun 03, 2005 7:51 pm
by Kalti
That makes sense... thank you once again :wink:

Posted: Sun May 27, 2007 1:11 pm
by Kalti
Finally implementing this into my map :oops:

Problem is... the sounds keeps playing after I leave the room, everything else gets hidden properly.

Total length of the .wav file is 4 minutes 13 seconds... So I'm guessing a sound cannot be stopped before it's end?

Posted: Sun May 27, 2007 1:54 pm
by Kalti
Nvm... I was using "stopsound" while I should be using "stoploopsound"

Anyways, once a n00b... :D

Wow!

Posted: Sun May 27, 2007 5:01 pm
by tltrude
Wow, you did it, and it only took two years!!!

Posted: Sun May 27, 2007 5:10 pm
by ViPER
lol - it's amazing you found the original post!

Posted: Mon May 28, 2007 7:34 pm
by Kalti
Yeah, yeah... Venice Forever :)

Anyways, I'm trying to add a trigger_use in the earlier mentioned script... 4 triggers "use" actually, which all do the same thing: "show" $destination_signs.

So I have this:

Code: Select all

main:

//*** Scoreboard Messages And Image
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"

local.master = spawn ScriptMaster

//local.master aliascache [aliasname] [soundfile] soundparms [basevolume] [randvolume] [basepitch] [randpitch] [mindist] [maxdist] [channel] loaded maps "obj dm"

   // call additional stuff for playing this map round based is needed
   if(level.roundbased)
      thread roundbasedthread

   level waittill prespawn

//*** Precache Dm Stuff
   //exec maps/dm/yourmapnamehere_precache.scr

   exec global/door_locked.scr::lock
   level.script = maps/dm/creditroom.scr
   //exec global/weather.scr
   //exec global/shutter.scr

   $trigger_show_dest1 thread destination1
   $trigger_show_dest2 thread destination2
   $trigger_show_dest3 thread destination3
   $trigger_show_dest4 thread destination4

   level waittill spawn
   //$room_occupied thread room_occupied
   thread occupied_prep

end

//*** Room ***
occupied_prep:
   $destination_signs hide
   $speaker_room stoploopsound snd_room
   $object hide
   $object1 hide
   $object2 hide

end

room_occupied:
   self nottriggerable
   $speaker_room loopsound snd_room
   $object show
   $object1 show
   $object2 show
   local.occupied = 1
   while (local.occupied)
   {
      for (local.i = 1; local.i <= $player.size; local.i++)
      {
         if (isAlive($player[local.i]) && $player[local.i].dmteam != spectator)
         {
            if ($player[local.i] isTouching $room_occupied)
               break
            }
         local.occupied = 0
         $speaker_room stoploopsound snd_room
    $object hide
    $object1 hide
    $object2 hide
    $destination_signs hide
      }
      waitframe
   }
   self triggerable

end

destination1:
while (1)
{
	$trigger_show_dest1 waittill trigger
	$trigger_show_dest1 show $destination_signs
	{
		wait 2
	}
}
end

destination2:
while (1)
{
	$trigger_show_dest2 waittill trigger
	$trigger_show_dest2 show $destination_signs
	{
		wait 2
	}
}
end

destination3:
while (1)
{
	$trigger_show_dest3 waittill trigger
	$trigger_show_dest3 show $destination_signs
	{
		wait 2
	}
}
end

destination4:
while (1)
{
	$trigger_show_dest4 waittill trigger
	$trigger_show_dest4 show $destination_signs
	{
		wait 2
	}
}
end

//-----------------------------------------------------------------------------

roundbasedthread:

   // Can specify different scoreboard messages for round based games here.

   level waitTill prespawn

   level waittill spawn

   // set the parameters for this round based match
   level.dmrespawning = 0 // 1 or 0
   level.dmroundlimit = 5 // round time limit in minutes
   level.clockside = kills // set to axis, allies, kills, or draw

   level waittill roundstart

end
4 triggers "use" = $trigger_show_dest1 / $trigger_show_dest2 / $trigger_show_dest3 / $trigger_show_dest4

1 "script_object" = $destination_signs

Tbh. I think I'm trying to combine 2 totally different scripting structures with the waittil trigger bit... Which is probably the reason why I can't get it to work.

So, within the setthreaded "room_occupied" I have placed 4 triggers "use" which all should call "show" one and the same "$destination_signs" script_object" and which in turn should get hidden after the player leaves the "room_occupied" trigger.

Posted: Mon May 28, 2007 7:50 pm
by ViPER
any errors and desription of what IS happening ?

Posted: Mon May 28, 2007 8:06 pm
by Kalti
Well, if I comment these out:

Code: Select all

   $trigger_show_dest1 thread destination1
   $trigger_show_dest2 thread destination2
   $trigger_show_dest3 thread destination3
   $trigger_show_dest4 thread destination4
Then the $destination_signs gets hidden, when I use the unedited script from my previous post, the $destination_signs shows.

Doing use on of the 4 $trigger_show_dest doesn't do anything on both occasions, no console messages whatsoever...

Posted: Mon May 28, 2007 9:31 pm
by wacko
I might be completely wrong but I've never seen this show command the way you use it. I know it like

Code: Select all

destination1:
   $trigger_show_dest1 nottriggerable
   $destination_signs show
   wait 2
   $trigger_show_dest1 triggerable
end 
Also, in my opinion the trigger_use need key/values of
targetname/trigger_show_dest1
setthread/destination1
and they must not be mentioned in the main thread

vis_leafgroup

Posted: Tue May 29, 2007 6:18 am
by tltrude
You should consider using vis_leafgroups. They can hide anything, even speakers.

Here is an example tutorial map that Wacko and I did a few years ago.
mp_ambient2
Image


For you, the vis_leafgroups would have to be everywhere outside the room, and target a small one inside that hides the sign and speaker.

Posted: Tue May 29, 2007 9:40 am
by Kalti
@ Tom; that requires a full vis compile right?
wacko wrote:I might be completely wrong but I've never seen this show command the way you use it...
That's because of my unimaginable little understanding of scripting :oops:

Anyways, your insight and my non-existing scripting abilities lead me to the following:

Code: Select all

main:

//*** Scoreboard Messages And Image
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"

local.master = spawn ScriptMaster

//local.master aliascache [aliasname] [soundfile] soundparms [basevolume] [randvolume] [basepitch] [randpitch] [mindist] [maxdist] [channel] loaded maps "obj dm"

   // call additional stuff for playing this map round based is needed
   if(level.roundbased)
      thread roundbasedthread

   level waittill prespawn

//*** Precache Dm Stuff
   //exec maps/dm/yourmapnamehere_precache.scr

   exec global/door_locked.scr::lock
   level.script = maps/dm/creditroom.scr
   //exec global/weather.scr
   //exec global/shutter.scr

   level waittill spawn
   //$room_occupied thread room_occupied
   thread occupied_prep

end

//*** Room ***
occupied_prep:
   $speaker_room stoploopsound snd_room
   $object hide
   $object1 hide
   $object2 hide
   $destination_signs hide

end

room_occupied:
   self nottriggerable
   $speaker_room loopsound snd_room
   $object show
   $object1 show
   $object2 show
   local.occupied = 1
   while (local.occupied)
   {
      for (local.i = 1; local.i <= $player.size; local.i++)
      {
         if (isAlive($player[local.i]) && $player[local.i].dmteam != spectator)
         {
            if ($player[local.i] isTouching $room_occupied)
               break
            }
         local.occupied = 0
         $speaker_room stoploopsound snd_room
    $object hide
    $object1 hide
    $object2 hide
    $destination_signs hide
      }
      waitframe
   }
   self triggerable

end

destination1:
   $trigger_show_dest1 nottriggerable
   $destination_signs show
   wait 2
   $trigger_show_dest1 triggerable
end

destination2:
   $trigger_show_dest2 nottriggerable
   $destination_signs show
   wait 2
   $trigger_show_dest2 triggerable
end

destination3:
   $trigger_show_dest3 nottriggerable
   $destination_signs show
   wait 2
   $trigger_show_dest3 triggerable
end

destination4:
   $trigger_show_dest4 nottriggerable
   $destination_signs show
   wait 2
   $trigger_show_dest4 triggerable
end

//-----------------------------------------------------------------------------

roundbasedthread:

   // Can specify different scoreboard messages for round based games here.

   level waitTill prespawn

   level waittill spawn

   // set the parameters for this round based match
   level.dmrespawning = 0 // 1 or 0
   level.dmroundlimit = 5 // round time limit in minutes
   level.clockside = kills // set to axis, allies, kills, or draw

   level waittill roundstart

end
In conjunction with setting setthread/destination1 for all of the 4 triggers use.

I'm hiding "$destination_signs" in the "occupied_prep" thread and I'm using the 2nd part of the "room_occupied" thread to hide the "$destination_signs".

Sadly, I'm at the office now so I can't play around with it until this evening :cry:

Posted: Tue May 29, 2007 11:48 am
by wacko
Kalti wrote: In conjunction with setting setthread/destination1 for all of the 4 triggers use.
I changed the script a bit, because all 4 triggers should do the same anyway. Now using one deactivates all of them, which imho makes sense. Give all of them setthread/destination (without _#)
Kalti wrote:I'm hiding "$destination_signs" in the "occupied_prep" thread and I'm using the 2nd part of the "room_occupied" thread to hide the "$destination_signs".
I also changed your script to what Rookie once wrote. Hopefully this is working, just give it a try. My experience tho tells me that Rookie's scripting is quite reliable :wink:
Here are the relevant, new threads:

Code: Select all

room_occupied:
   self nottriggerable
   $speaker_room loopsound snd_room
   $object show
   $object1 show
   $object2 show
   local.occupied = 1
   while (local.occupied)
   {
      for (local.i = 1; local.i <= $player.size; local.i++)
      {
         if (isAlive($player[local.i]) && $player[local.i].dmteam != spectator)
         {
            if ($player[local.i] isTouching $room_occupied)
            {
               local.occupied = 1 //not sure about this line
               break
            }
         }
         local.occupied = 0
         $speaker_room stoploopsound snd_room
         $object hide
         $object1 hide
         $object2 hide
         $destination_signs hide
         $trigger_show_dest1 triggerable
         $trigger_show_dest2 triggerable
         $trigger_show_dest3 triggerable
         $trigger_show_dest4 triggerable
      }
      waitframe
   }
   self triggerable
end

destination:
   $trigger_show_dest1 nottriggerable
   $trigger_show_dest2 nottriggerable
   $trigger_show_dest3 nottriggerable
   $trigger_show_dest4 nottriggerable
   $destination_signs show
   wait 2
end
Additionally, it would be nice to add little coronas (or s/th like that) above each button (trigger_show_dest# thingies) which u could show in room_occupied and hide in destination to show players whether the triggers are active.

Posted: Tue May 29, 2007 3:49 pm
by Kalti
Hmm... those coronas may be a nice touch, lemme try... thanks Wacko :D