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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mementos WILL WORK NOW! (completed)
MaxTheOne Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jul 2020
Reputation: 0
#1
Mementos WILL WORK NOW! (completed)

ok so i have been working on a custom story for days now and for a whole day i was trying to figure out how to add mementos. i have watched 2 tutorial videos and i still cant do it. when i went to mudbill on one of his vids he replied once and did not reply to me when i asked him why the mementos wont work. maybe its so obvious why it wont work and thats why he stopped lol. so now i had to make an account on the forums as a last resort. my mementos wont work. i followed mudbills tutorial and it wont work. i looked through my whole script and no errors i see. the script must be working because the game does not crash but when i interact with the thing that will give a memento it will not. it refuses it. here is my WHOLE code line for the level. it has a key and crowbar function and they both work. but when i try to make a memento it wont work. i think it has something to do with putting the parts in incorrect places? if anyone looks through this and there are no errors in the code then i need to change something in the editor. 

void OnStart()
{  
AddUseItemCallback("", "Crowbar Used 2", "Grate", "UseCrowbarOnGrate", true);
AddEntityCollideCallback("Crowbar Joint 1", "GrateBreak", "BreakGrate", true, 1);
}

void UseCrowbarOnGrate(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
PlaySoundAtEntity("", "player_crouch.snt","Player", 0.05, false);
AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
}

void TimerPlaceCrowbar(string &in asTimer)
{
SetEntityActive("Crowbar Joint 1", true);
PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}

void BreakGrate(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Crowbar Joint 1", false);
SetEntityActive("Crowbar Used 1", true);

SetSwingDoorLocked("Grate", false, false);
SetSwingDoorClosed("Grate", false, false);
SetSwingDoorDisableAutoClose("Grate", true);

AddPropImpulse("Grate", 0, 9, 0, "world");

CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "GrateDoorEffect", false);

GiveSanityBoostSmall();

PlaySoundAtEntity("", "close_gate.ps", "GrateDoorEffect", 0, false);

AddTimer("", 0.1, "TimerPushDoor");
}

void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("Grate", -9, 9, 0, "world");
AddTimer("", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("Grate", false);
AddUseItemCallback("", "Transept R Key", "Transept R", "UseKeyOnDoor2", true);
AddEntityCollideCallback("Player", "GrateLockedMem", "EventQuest", true, 1);
}

void UseKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Transept R", false);
PlaySoundAtEntity("", "unlock_door.snt", "Transept R", 0, false);
RemoveItem(asItem);
}

void EventQuest(string &in asParent, string &in asChild, int alstate)
{
AddQuest("GrateLockedMem", "GrateLock");
}

if anyone can figure whats wrong with this i will credit at the end of my story or somethin idk. i really just want mementos. i almost just gave up on my story because it just wont work. the bottom of the script it the memento part.
(This post was last modified: 07-28-2020, 02:49 PM by MaxTheOne.)
07-25-2020, 09:56 PM
Find Reply
kirakatve Offline
Frictional Games

Posts: 77
Threads: 10
Joined: Jan 2018
Reputation: 4
#2
RE: Mementos WONT WORK!

Our modding community is currently mostly active on Discord, if you have an account you can join in and join the modding channels with the appropriate role!

Your friendly neighbour the community manager.
07-27-2020, 09:30 AM
Find Reply
Mudbill Offline
Muderator

Posts: 3,880
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Mementos WONT WORK!

When you say it's not working, what exactly do you mean? It's important to point out what you expect to happen and what actually happens.

Do you get the memento icon? Does it add a text-less and empty memento? Or does nothing happen whatsoever?

The script looks correct but that's assuming your area named GrateLockedMem actually collides with the player and that your extra_english.lang is set up correctly to display the text for this memento.

PS: Youtube is pretty bad at actually giving me notifications so it's possible I didn't see your comment.

07-27-2020, 02:05 PM
Find Reply
MaxTheOne Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jul 2020
Reputation: 0
#4
RE: Mementos WONT WORK!

(07-27-2020, 02:05 PM)Mudbill Wrote: When you say it's not working, what exactly do you mean? It's important to point out what you expect to happen and what actually happens.

Do you get the memento icon? Does it add a text-less and empty memento? Or does nothing happen whatsoever?

The script looks correct but that's assuming your area named GrateLockedMem actually collides with the player and that your extra_english.lang is set up correctly to display the text for this memento.

PS: Youtube is pretty bad at actually giving me notifications so it's possible I didn't see your comment.
oh. well that explains it lol. anyways i will explain what happens. its a touch memento. im trying to give a memento when you touch a locked grate. when i touch it it does nothing. it does not give me a memento icon. and im pretty sure the english lang thing it correct/has nothing to do with the function actually working. my problem is that it wont give me the memento. does it has something to do with the type of door/openable? because some things like the ceiling trapdoor will not lock. but the grate im using locks so i really cant figure out what else i could do. also no other types of mementos work either. area and item ones also dont work either.
07-27-2020, 11:30 PM
Find Reply
MaxTheOne Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jul 2020
Reputation: 0
#5
RE: Mementos WONT WORK!

(07-27-2020, 09:30 AM)kirakatve Wrote: Our modding community is currently mostly active on Discord, if you have an account you can join in and join the modding channels with the appropriate role!

would you provide me a link to the server?
07-27-2020, 11:31 PM
Find Reply
Mudbill Offline
Muderator

Posts: 3,880
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Mementos WONT WORK!

If you want to get the memento when you touch something, you must use the correct callback type. Right now you're using a collide callback, meaning the event won't trigger unless the player is located inside the grate, which likely never happens. You must use AddEntityPlayerInteractCallback instead of AddEntityCollideCallback.

Discord is https://discord.com/invite/frictionalgames

(This post was last modified: 07-28-2020, 03:06 AM by Mudbill.)
07-28-2020, 03:06 AM
Find Reply
MaxTheOne Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jul 2020
Reputation: 0
#7
RE: Mementos WONT WORK!

(07-28-2020, 03:06 AM)Mudbill Wrote: If you want to get the memento when you touch something, you must use the correct callback type. Right now you're using a collide callback, meaning the event won't trigger unless the player is located inside the grate, which likely never happens. You must use AddEntityPlayerInteractCallback instead of AddEntityCollideCallback.

Discord is https://discord.com/invite/frictionalgames

HOLY MOTHER OF COW! IT WORKS NOW! YOU'VE DONE IT! AFTER 3 DAYS OF ME TRYING TO FIGURE IT OUT. AND OF COURSE IT WAS ONE LITTLE TINY MISTAKE. it works now. thank you so much  Big Grin . would you want to be credited in the credits of my story for figuring out why the memento wont work? LOL


Attached Files
.jpg   20200728073116_2.jpg (Size: 141.85 KB / Downloads: 3)
07-28-2020, 12:38 PM
Find Reply




Users browsing this thread: 1 Guest(s)