Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help debugging various script functions
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#11
RE: Need help debugging various script functions

No, no I haven't. It still doesn't work. Placing a sound object works, but only as a snt. I want a specific sound to play. A sound entity object COULD serve my purpose, but it doesn't allow me to pick a sound by the ogg file, only by the snt file, which does random sounds out of a set, apparently.

Say....perhaps I could circumvent this grievous error by making custom snt files?
(This post was last modified: 09-14-2013, 09:54 PM by Silent Darkness.)
09-14-2013, 09:41 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#12
RE: Need help debugging various script functions

If positioning isn't an issue, you can play a GUI sound. This should allow you to play the OGG file directly without having to create your own SNT file.

Tutorials: From Noob to Pro
09-14-2013, 10:02 PM
Website Find
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#13
RE: Need help debugging various script functions

Does it have to be in the gui directory?

For what I want, I want the sounds to be played from the player anyways, so that would work very well. If it can be used from outside the sounds/gui directory, then that sounds much better xD

And also, the engine scripts description for PlayGuiSound says the extension is snt.
(This post was last modified: 09-14-2013, 10:20 PM by Silent Darkness.)
09-14-2013, 10:10 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#14
RE: Need help debugging various script functions

I'm talking about using the function PlayGuiSound. So long as it's located somewhere in your custom story folder, the game shouldn't have issues finding it.

Tutorials: From Noob to Pro
09-14-2013, 10:18 PM
Website Find
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#15
RE: Need help debugging various script functions

Thanks, My Computer. PlayGuiSound fixed things up just right. Now, about the EphiPhirine junk. The syringe code?

The inject function is called when the syringe is picked up. here's the unmodified code for the syringe.

void OnStart()
{  
SetGlobalVarInt("picked", 0); //value to check if the item is picked up
}


void pick(string &in asEntity, string &in type)
{
AddPlayerSanity(-5); //reduce player's sanity so he will be able to use the item(If HIS SANITY IS 100% HE WON'T BE ABLE TO USE THE ITEM!!!)
SetGlobalVarInt("picked", 1);
AddTimer("Used_timer", 1, "Used_timer"); //timer which will check if the item is used

}

void Used_timer(string &in asTimer)
{
if (GetGlobalVarInt("picked")== 1){ //check if it's picked up
AddTimer("Used_timer", 1, "Used_timer"); //loop timer
if (HasItem("syr")==false) {  //check if the item is used...I named my item "syr"
SetPlayerMoveSpeedMul(1.8); //players moving speed...Bigger value will make the player fall of the map!!!
SetPlayerRunSpeedMul(1.5); //players running speed...Bigger value will make the player fall of the map!!!
RemoveTimer("Used_timer"); //remove the timer so it wont loop again
SetGlobalVarInt("picked", 0);
AddTimer("heartbeat_sound", 0, "heartbeat_sound"); //timer to play custom heartbeat sound

AddTimer("finishTimer", 10, "finishTimer"); //duration of the epinephrine effect!Change if needed

}
}
}

void heartbeat_sound(string &in asTimer)
{
if (GetGlobalVarInt("picked")== 0){
PlaySoundAtEntity("heart", "Heartbeat_fast.snt", "Player", 0, true);
AddTimer("heartbeat_sound", 8, "heartbeat_sound"); //loop sound
}
}


void finishTimer(string &in asTimer)
{
SetPlayerMoveSpeedMul(1); //change players speed to normal
SetPlayerRunSpeedMul(1);//change players speed to normal
SetGlobalVarInt("picked", 2); //changed so it wont loop again...Not sure if needed
StopSound("heart", 1); //stop sound if it is still playing
RemoveTimer("finishTimer");
RemoveTimer("heartbeat_sound");
//remove timers...Not sure if needed
}
(This post was last modified: 09-14-2013, 10:48 PM by Silent Darkness.)
09-14-2013, 10:40 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#16
RE: Need help debugging various script functions

For starters, you'd have to start using AddGlobalVarInt (this takes negative numbers, just like AddPlayerSanity) in place of SetGlobalVarInt. You could also remove the item that gets added automatically when the player interacts with the syringe item and replace it with something like "syr_"+GetGlobalVarInt("pick"). That way you can remove it using the same syntax and can loop through the syringes (e.g. with a for loop) and check if they're in the inventory (since there's no guarantee what order the player will use the syringes). Also, you should avoid having SetGlobalVarInt("picked", 0) in OnStart or OnEnter. By default all undefined map variables will be given null-like values when accessed. Since you're using global map variables, this implies you're going to repeat this script across multiple maps, and you wouldn't want these other maps screwing with the inventory count.

Tutorials: From Noob to Pro
09-15-2013, 12:07 AM
Website Find
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#17
RE: Need help debugging various script functions

1. Alright, i'll use AddGlobalVarInt.
2. ....Ouch. I'm not that pro at scripting. You'll have to walk me through that one. Starting with what lines of code i'd have to change to get the same syntax removal.
3. That's the one-map version of the syringe. There's another version of the script for use along multiple maps.

Alright, that's all of this I can take for the night. I'll update the script in the first post and call it a day.
(This post was last modified: 09-15-2013, 02:27 AM by Silent Darkness.)
09-15-2013, 02:17 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#18
RE: Need help debugging various script functions

You could make it easier for yourself if you don't mind having an item in the inventory that represents the player. In this way, you can make use of item combination callbacks and keep all the syringes with the same name and avoid most of the complications from modifying your current script.

Tutorials: From Noob to Pro
(This post was last modified: 09-15-2013, 03:06 AM by Your Computer.)
09-15-2013, 03:05 AM
Website Find
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#19
RE: Need help debugging various script functions

.....cool story, bro xD

Very little of what you just said made sense to me. Although, i'm having a thought here. You wouldn't stack syringes, would you? I wonder if it would be that bad to have seperate inventory occurences for each syringe(they're supposed to be rare anyways)

I'll try to make this work anyways, but it's something to keep in mind.

Also, the item name in my maps is "SpeedRemedy"
09-15-2013, 03:04 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#20
RE: Need help debugging various script functions

(09-15-2013, 03:04 PM)Drakeman1234 Wrote: .....cool story, bro xD

Very little of what you just said made sense to me. Although, i'm having a thought here. You wouldn't stack syringes, would you? I wonder if it would be that bad to have seperate inventory occurences for each syringe(they're supposed to be rare anyways)

I'll try to make this work anyways, but it's something to keep in mind.

Also, the item name in my maps is "SpeedRemedy"

Oh, YC's always, I repeat, ALWAYS sound like this. It's like a computer.

What he meant was having an item in your inventory that represents the Player itself. In this way, you can keep all the syringes you want and still have the same name.

"Veni, vidi, vici."
"I came, I saw, I conquered."
09-15-2013, 03:17 PM
Find




Users browsing this thread: 1 Guest(s)