Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
Okay, I see how that would be desired/necessary, finally. After staring at this script for two hours. How would I set this up? I'm not sure if i'd have to define it in extra_english.lang, or do some scripting mumbo jumbo, or what?
To clarify further, could someone provide some example code of what needs to be done? I learn better with a visual aid.
|
|
09-15-2013, 06:00 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Need help debugging various script functions
Here's an untested example:
Note, this would all go into your inventory.hps file if you intend to use the inventory item idea:
void OnGameStart() { /*! * SyringeScript: internal name for callback * * PlayerItem: item in inventory that represents the player * * Syringe: item in inventory that represents the syringe * * StartSyringePowers: function to call when the two items (i.e. PlayerItem and Syringe) are combined in inventory * * false: false should only be set if syringes all hold the same inventory name, otherwise use true * and duplicate the line for each syringe with a unique inventory name: */ AddCombineCallback("SyringeScript", "PlayerItem", "Syringe", "StartSyringePowers", false); }
void StartSyringePowers(string &in player_item, string &in syringe) { // Remove ONLY the syringe! RemoveItem(syringe); // Force-exit inventory! ExitInventory();
// Adjust player movement speeds // Bigger values will make the player fall of the map! SetPlayerMoveSpeedMul(1.8); SetPlayerRunSpeedMul(1.5);
// Timer to play custom heartbeat sound AddTimer("heartbeat_sound", 0, "heartbeat_sound"); // Duration of the epinephrine effect! AddTimer("finishTimer", 10, "finishTimer"); }
void heartbeat_sound(string &in asTimer) { 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 StopSound("heart", 1); // stop sound if it is still playing RemoveTimer("heartbeat_sound"); }
|
|
09-16-2013, 05:29 AM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
I don't have an inventory.hps, so i'd have to make one. Lemme see what I can do with that....
in order for this to work, i'd have to make the item unusable directly from the inventory(by setting the entity file for the syringe to a puzzle item instead, it is currently based as a sanity potion). Then I would have to find a player-representing object that wouldn't look strange or unfitting in the context(an alcohol-dipped cloth, perhaps?), and also include CombineItemCallbacks.
So, if this works, would I be removing the syringe scripts from the main map hps file?
EDIT: Okay, I know what I could use. But, i'd need to find a good model of a roll of bandages. i'm googling it, but I can't find anything. At least, not anything that doesn't mean shelling out money I don't have. Any ideas?
|
|
09-16-2013, 01:36 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Need help debugging various script functions
Yeah, taking the item-combination route means you won't have to repeat your code across multiple maps, so you could safely remove any syringe code from the map scripts.
|
|
09-16-2013, 02:08 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Need help debugging various script functions
(09-16-2013, 01:36 PM)Drakeman1234 Wrote: I don't have an inventory.hps, so i'd have to make one. Lemme see what I can do with that....
in order for this to work, i'd have to make the item unusable directly from the inventory(by setting the entity file for the syringe to a puzzle item instead, it is currently based as a sanity potion). Then I would have to find a player-representing object that wouldn't look strange or unfitting in the context(an alcohol-dipped cloth, perhaps?), and also include CombineItemCallbacks.
So, if this works, would I be removing the syringe scripts from the main map hps file?
EDIT: Okay, I know what I could use. But, i'd need to find a good model of a roll of bandages. i'm googling it, but I can't find anything. At least, not anything that doesn't mean shelling out money I don't have. Any ideas?
Didn't have a model? Make it/make someone else did it.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
09-16-2013, 02:45 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
(09-16-2013, 02:45 PM)JustAnotherPlayer Wrote: (09-16-2013, 01:36 PM)Drakeman1234 Wrote: I don't have an inventory.hps, so i'd have to make one. Lemme see what I can do with that....
in order for this to work, i'd have to make the item unusable directly from the inventory(by setting the entity file for the syringe to a puzzle item instead, it is currently based as a sanity potion). Then I would have to find a player-representing object that wouldn't look strange or unfitting in the context(an alcohol-dipped cloth, perhaps?), and also include CombineItemCallbacks.
So, if this works, would I be removing the syringe scripts from the main map hps file?
EDIT: Okay, I know what I could use. But, i'd need to find a good model of a roll of bandages. i'm googling it, but I can't find anything. At least, not anything that doesn't mean shelling out money I don't have. Any ideas?
Didn't have a model? Make it/make someone else did it.
Okay, I think I managed to find a proper model to use, from a Half-Life 2 mod called Nightmare House 2, but now i gotta figure out how to rip it and convert it for use in Amnesia. There's a vtf(valve texture file), a vmf(valve material file), and a mdl file. How do I proceed now?
Btw, my internet really wouldn't handle the 2GB download of Source SDK.
Just trying to comprehend what to do here. Thinking, "maybe Collada can be helpful".
1 minute later, my head explodes from how unintuitive it is.
Okay, I managed a way around, but i'm wondering, is there a way to turn .Blend files into .ent files?
|
|
09-16-2013, 03:19 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
|
09-16-2013, 05:01 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
I followed the directions carefully, but when I try to view it rendered, the screen shows up blank. No mesh at all.
Nevermind, I think i got it. Alright, maybe i'll finally have this problem out of the way in a day or two.
Hahah, I got it!
Also, your script for the inventory.hps sounds right, but it isn't working for some reason. Maybe I screwed it up somehow. Trying to combine the items just throws the boilerplate "Combination does not work!" response. SyringePlayer is the player-representing item, Speedremedy is the syringe item.
void OnGameStart()
{
AddCombineCallback("InjectSpeedRemedy","SyringePlayer","SpeedRemedy","StartSyringePowers",false);
}
void StartSyringePowers(string &in SyringePlayer, string &in SpeedRemedy)
{
RemoveItem("SyringePlayer");
RemoveItem("SpeedRemedy");
ExitInventory();
GivePlayerDamage(3,"BloodSplat",false,true);
GiveSanityDamage(40,true);
SetPlayerMoveSpeedMul(1.8);
SetPlayerRunSpeedMul(1.5);
SetPlayerLookSpeedMul(2.0);
AddTimer("heartbeat_sound", 0, "heartbeat_sound");
AddTimer("finishTimer", 10, "finishTimer");
}
void heartbeat_sound(string &in asTimer)
{
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
StopSound("heart", 1); // stop sound if it is still playing
RemoveTimer("heartbeat_sound");
}
Edit: Nevermind, I managed to fix it. Alright, i'm going to update the code in the first post. By the way, I want to create an effect similar to the visual effect the monster roar insanity events cause: The screen tinting bright red. FadeSepiaColorTo doesn't quite seem to have what i'm looking for. Any ideas?
|
|
09-16-2013, 06:45 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Need help debugging various script functions
For the SpeedyRemedy script, you need to correct a few things. For starters, when you pick up an item from the environment, the item's name becomes the name of the entity. So you have to add a combine callback for each item. Therefore, you would have to change "false" to "true" for each combine callback. Secondly, you're not supposed to remove the SyringePlayer item. How else are you going to continue using the syringes? Finally, it turns out the inventory.hps doesn't allow timer callbacks defined in it to be triggered by the timers. So you have to add finishTimer to all of your map scripts to stop the effect.
As for the monster roar effect, you could probably do something with the global fog.
|
|
09-17-2013, 01:18 AM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
1. I did manage to fix the SpeedRemedy script on my own.
2. By adding more bandage items around my maps! I intend it like this.
3. Alright, i'll do that.
4. I got pretty damn close to the effect I wanted just by using box lights, but i'll give that a try too.
Alright, I think i'm almost done with the first room. Now I want to add some improvements to the intro script to make it more cinematic-like. Here's the current intro script:
void OnEnter()
{
ScriptDebugOn();
FadeOut(0.01f);
PreloadSound("react/React_breath_slow.snt");
PreloadSound("insanity/Insanity_Whisper.snt");
PreloadSound("react/React_Pant.snt");
PreloadSound("15/15_The_Big_Scream.snt");
PreloadSound("react/React_Sigh.snt");
PreloadSound("react_sigh"); PreloadSound("react_breath"); PreloadSound("player_climb"); PreloadSound("general_thunder");
PreloadSound("00_creak"); PreloadSound("scare_walk_hallway"); PreloadSound("00_cuts"); PreloadSound("react_scare");
PreloadSound("00_loop"); PreloadSound("player_bodyfall"); PreloadSound("00_faint"); PreloadSound("scare_slam_door");
PreloadSound("ambience_wind_eerie_no3d"); PreloadSound("ambience_hollow_tinker"); PreloadSound("react_pant"); PreloadSound("joint_door_move_special");
PreloadSound("general_wind_whirl"); PreloadSound("00_laugh"); PreloadSound("general_rain_m");
SetPlayerActive(false);
SetPlayerLampOil (0);
SetPlayerCrouching(true);
AddTimer("StartTimer",2,"StartTimer");
SetEntityPlayerInteractCallback("Collapse","IntroCollapse",true);
SetEntityCallbackFunc("BedRoomDoor","Bedroomdoor");
}
void InsanityTimeChecker(string &in asTimer)
{
if(PermanentSanityLow==1)
{
AddTimer("SanityLoss",13.5,"ReduceSanity");
AddDebugMessage("Sanity Loss",true);
}
}
void ReduceSanity(string &in asTimer)
{
if(GetPlayerSanity() < 3)
{
GiveSanityDamage(-5,false);
}
else if(GetPlayerSanity() > 12)
{
GiveSanityDamage(5,false);
}
AddDebugMessage("ReduceSanity Called",true);
GiveSanityDamage(0.8,false);
AddTimer("RecheckInsanity",0,"InsanityTimeChecker");
}
void ScareIntro1(string &in asTimer)
{
AddDebugMessage("ScareIntro function called!",true);
PlayGuiSound("react_breath_slow1.ogg",3.0);
AddDebugMessage("You should hear a breathing.",true);
AddTimer("Wait",3,"ScareIntro1again");
AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitagain",3,"ScareIntro1again");
AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitsomemore",2,"ScareIntro1again");
AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitevenmore",2.5,"ScareIntro2");
}
void ScareIntro1again(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",3.0);
AddDebugMessage("ScareIntro1Again fires off properly.",true);
}
void ScareIntro2(string &in asTimer)
{
PlayGuiSound("Insanity_Whisper2.ogg",1.0);
AddDebugMessage("Hear the whispers.",true);
PlayGuiSound("15_the_big_scream3.ogg",4.0);
AddDebugMessage("screams!",true);
AddTimer("Awake",1,"ScareIntroAwaken");
AddDebugMessage("Time to wake up!",true);
}
void ScareIntroAwaken(string &in asTimer)
{
SetInventoryDisabled(true);
FadeSepiaColorTo(50.6,0.2);
SetRadialBlurStartDist(0.7);
FadeRadialBlurTo(4.0,0.5);
FadeImageTrailTo(3,2);
FadeLightTo("pointlight_1",1,0,0,255,-1,1);
FadeLightTo("pointlight_2",1,0,0,255,-1,1);
FadeLightTo("pointlight_3",1,0,0,255,-1,1);
FadeLightTo("pointlight_4",1,0,0,255,-1,1);
FadeLightTo("pointlight_5",1,0,0,255,-1,1);
FadeLightTo("pointlight_6",1,0,0,255,-1,1);
FadeLightTo("pointlight_7",1,0,0,255,-1,1);
FadeLightTo("pointlight_8",1,0,0,255,-1,1);
FadeLightTo("pointlight_9",1,0,0,255,-1,1);
FadeLightTo("pointlight_10",1,0,0,255,-1,1);
FadeLightTo("pointlight_11",1,0,0,255,-1,1);
FadeLightTo("pointlight_12",1,0,0,255,-1,1);
FadeLightTo("pointlight_13",1,0,0,255,-1,1);
FadeLightTo("pointlight_14",1,0,0,255,-1,1);
FadeLightTo("pointlight_15",1,0,0,255,-1,1);
FadeLightTo("pointlight_16",1,0,0,255,-1,1);
FadeIn(3.0f);
FadePlayerFOVMulTo(0.7,2);
GiveSanityDamage(80,false);
PlayGuiSound("react_pant6.ogg",3.0);
AddDebugMessage("panting!",true);
AddTimer("WalkTime",0.1,"Playerwalk"); //prepare yourself for long, repeated script.
SetPlayerActive(true);
SetPropStaticPhysics("FallVase1",false);
AddTimer("VaseScare1",0.5,"VaseScare");
SetPlayerMoveSpeedMul(0.1);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(2.0);
PermanentSanityLow++;
AddTimer("WaitforIntro3",2,"ScareIntroEnd");
PlayMusic("search_suitor.ogg",true,3.0,1.0,0,false);
AddTimer("InsanityWait",0,"InsanityTimeChecker");
AddTimer("EndAutoWalk",9,"StopAutoWalk");
}
void VaseScare(string &in asTimer)
{
StartPlayerLookAt("FallVase1",3.0,1.0,"");
GiveSanityDamage(5,true);
AddPropForce("ThrowVase1",5000,0,0,"world");
AddPropForce("ThrowVase2",8000,0,0,"world");
AddTimer("VaseScareTime",0,"VaseScareEnd");
}
void VaseScareEnd(string &in asTimer)
{
StopPlayerLookAt();
}
void ScareIntroEnd(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",2.0);
AddDebugMessage("breathing",true);
AddTimer("BreathTime",1.5,"Breathing");
AddTimer("BreathTime2",3.0,"Breathing");
AddTimer("Sightime",4.0,"PlayerSigh");
}
void Breathing(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",2.0);
AddDebugMessage("breathing",true);
}
void PlayerSigh(string &in asTimer)
{
PlayGuiSound("react_sigh6.ogg",2.5);
AddTimer("Activetime",3.0,"ActivatePlayerControl");
AddDebugMessage("*sigh*",true);
}
void ActivatePlayerControl(string &in asTimer)
{
AddTimer("FinalIntroWait",7,"Endthebluralreadyornot");
SetPlayerMoveSpeedMul(0.5);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(0.3);
SetPlayerJumpDisabled(true);
}
void Endthebluralreadyornot(string &in asTimer)
{
FadeImageTrailTo(0,4);
SetMessage("PathofDarknessText","Intro1",7);
}
void StartTimer(string &in asTimer)
{
AddTimer("StartScare",1,"ScareIntro1");
AddDebugMessage("This timer isn't the problem either.",true);
}
void IntroCollapse(string &in aschest_small_1)
{
SetPlayerMoveSpeedMul(0.1);
SetPlayerRunSpeedMul(0.0);
SetPlayerLookSpeedMul(3.0);
PlayGuiSound("insanity_monster_roar03.ogg",4.0);
StartRandomInsanityEvent();
GiveSanityDamage(90,false);
AddTimer("RecoverTime",9,"CollapseEnd");
}
void CollapseEnd(string &in asTimer)
{
SetPlayerMoveSpeedMul(0.5);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(0.3);
}
void BacktoNormal(string &in aspotion_sanity_2, string &in asType)
{
PermanentSanityLow--;
RemoveItem("EnhancedSanity");
RemoveItem("potion_sanity_2");
FadeSepiaColorTo(8,2);
FadeSepiaColorTo(6,2);
FadeSepiaColorTo(4,2);
FadeSepiaColorTo(2,2);
FadeSepiaColorTo(0,2);
AddTimer("ReliefWait",2,"BacktoNormal2");
}
void BacktoNormal2(string &in asTimer)
{
AutoSave();
GiveSanityBoost();
AddPlayerSanity(80);
FadeRadialBlurTo(0,4);
FadeImageTrailTo(0,10);
FadeOut(5.0f);
AddTimer("EndIntro",1,"IntroOver");
SetEntityActive("Thedoorislocked",false);
}
void IntroOver(string &in asTimer)
{
SetFogActive(false);
SetEntityActive("Boxlight_1",false);
SetEntityActive("Boxlight_2",false);
SetEntityActive("Boxlight_3",false);
SetEntityActive("Redbox",false);
SetEntityActive("Redbox2",false);
SetEntityActive("Redspotlight",false);
SetEntityActive("spotlight_1",false);
SetEntityActive("spotlight_2",false);
SetEntityActive("spotlight_3",false);
SetEntityActive("spotlight_4",false);
SetEntityActive("pointlight_1",true);
SetEntityActive("pointlight_2",true);
SetEntityActive("pointlight_3",true);
SetEntityActive("pointlight_4",true);
SetEntityActive("pointlight_5",true);
SetEntityActive("pointlight_6",true);
SetEntityActive("pointlight_7",true);
SetEntityActive("pointlight_8",true);
SetEntityActive("pointlight_9",true);
SetEntityActive("pointlight_10",true);
SetEntityActive("pointlight_11",true);
SetEntityActive("pointlight_12",true);
SetEntityActive("pointlight_13",true);
SetEntityActive("pointlight_14",true);
SetEntityActive("pointlight_15",true);
SetEntityActive("pointlight_16",true);
FadeLightTo("pointlight_1",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_2",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_3",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_4",1.0,0.5,0,255,-1,1);
FadeLightTo("pointlight_5",1.0,0.5,0,255,-1,1);
FadeLightTo("pointlight_6",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_7",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_8",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_9",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_10",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_11",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_12",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_13",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_14",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_15",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_16",1,0.5,0,255,-1,1);
SetPropActiveAndFade("StoreKey",true,1);
SetPropActiveAndFade("Note02",true,1);
SetPropActiveAndFade("bastard_2",true,1.0);
SetPropActiveAndFade("bastard_3",true,1.0);
SetPropActiveAndFade("Rose1",true,1.0);
SetPropActiveAndFade("Note01",true,0.5);
StopMusic(1.0,1);
PlayMusic("06_amb.ogg",true,2.0,1.0,0,true);
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(0.8);
SetPlayerRunSpeedMul(0.0);
SetPlayerLookSpeedMul(1.0);
SetSwingDoorLocked("BedRoomDoor",false,false);
FadeIn(2.0f);
SetMessage("PathofDarknessText","Intro2",4);
}
void Playerwalk(string &in asTimer)
{
if (CanAutoWalk==true)
{
MovePlayerForward(1.0);
AddTimer("Walk2",0.1,"PlayerWalk");
}
}
void StopAutoWalk(string &in asTimer)
{
CanAutoWalk = false;
}
I want to make it so that the player automatically kind of shuffles off of a bed, and falls onto the floor, getting up after a few seconds. Having trouble getting the MovePlayerForward part to work, though.
|
|
09-17-2013, 12:58 PM |
|
|