UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

how do i make audio play when looking at target lookat?

HOT
broken avatar :(
Created 11 years ago
by NaviLlusShore
0 Members and 1 Guest are viewing this topic.
9,448 views
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
Signature
NaviLlicious
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
so im trying to get my audio to play when i look at certain objects so i set up a trigger lookat and put the KVP's in and whenever i look at the trig the audio doesnt play so i was wondering if theres something else i need to do? and i have the audio converted and in the mod.ff i used ZK's tutorial
Last Edit: September 14, 2013, 09:10:23 pm by NaviLlusShore
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
so im trying to get my audio to play when i look at certain objects so i set up a trigger lookat and put the KVP's in and whenever i look at the trig the audio doesnt play so i was wondering if theres something else i need to do? and i have the audio converted and in the mod.ff i used ZK's tutorial
Never test a script by relying on an audio sound to play. There's too many "unknowns" and you won't know right away if it's your script that's broken or if the sound is broken.

Add an iPrintLn() that happens when the trigger is looked at - if you see the iPrintLn, then you know your sound is not working properly. If you don't see the iPrintLn, then your script is not correctly set up or the trigger you are trying to use does not work. I've never used a trigger_lookat - personally I would just make a trigger use, and then use the islookingat(org) utility function to tell when a player is looking at my trig.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
i will try the trigger_use then so how would i add the islookingat(org) utility function? first map pretty new to this
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
i will try the trigger_use then so how would i add the islookingat(org) utility function? first map pretty new to this
Code Snippet
Plaintext
players = GetPlayers();
for(i=0;i<players.size;i++)
{
    if(players[i] islookingat(trigger))
    {

    }
}
Something along the lines of that.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
so would i put this anywhere in the script? and thats for mapname.gsc correct?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
so would i put this anywhere in the script? and thats for mapname.gsc correct?
No that's just a bit of example code.
You gotta get the ent of your trigger and set the variable "trigger" equal to it. The UGX wiki shows how to do this by using the getent function. You have to include that code also in a function that you create, and then even if you do have that you need it to loop as it will only check if the player is looking at the trigger once.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
im looking at the wiki right now what section would that be under?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Not exactly specific documentation at the moment but examples are available:
http://ugx-mods.com/wiki/index.php?title=Arrays
http://ugx-mods.com/wiki/index.php?title=Variables
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
so with the variables i just change "trigger" to "trigger_use" then "targetname" to the kvp targetname i gave in radiant? and then the hintstring would be the same targetname?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
so with the variables i just change "trigger" to "trigger_use" then "targetname" to the kvp targetname i gave in radiant? and then the hintstring would be the same targetname?
the variable can be any name you want, it doesn't have to be "trigger_use". I just used trigger as an example. the first arg of getent is the value, the second arg is the key(which is targetname). As for the hintstring you use:
Code Snippet
Plaintext
trigger setHintString("hintstring");
to set the hintstring. including &&1 within the hintstring will show the use button. For instance in script "setHintString("Press &&1 to Open Door");" would look something like "Press F to Open Door" in game, or whatever your use is set to.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
so &&1hintstring will show the use button and the arrays are to bring down the line count?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
so &&1hintstring will show the use button and the arrays are to bring down the line count?
Ignore the arrays unless you have multiple triggers, I just sent that link as it has an example of how the getent function is used.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
alright does this look right?

trigger = getEnt("trigger_use","zk_eggtrig");
trigger setup();
 
setup()
{
self setHintString("&&1hintstring");

i got a bad syntax error idk if this is exactly right
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
alright does this look right?

trigger = getEnt("trigger_use","zk_eggtrig");
trigger setup();
 
setup()
{
self setHintString("&&1hintstring");

i got a bad syntax error idk if this is exactly right
include the trigger stuff within your function. Also you wanna use targetname as your key. You also probably don't wanna use trigger_use as your value as the classname has the same value.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
when you say your function do you mean a specific spot in the script? i have this at the bottom of my mapname.gsc

{

trigger = getEnt("test","targetname");
trigger setup();
 
setup()
{
self setHintString("&&1 hintstring");

}

 
Loading ...