Help on entity activation - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Help on entity activation (/thread-25679.html) Pages:
1
2
|
Help on entity activation - TShapeShifter - 07-12-2014 hey guys, this is probably a dumb question and much likely the answer is no but I recently have been wondering, is it possible to activate an entity upon the possession of a certain number of notes? Like for example is it possible for an entity to only activate itself if the player picks up all the notes in a story? Sorry if this is a dumb question, any help is very much appreciated, thank you RE: Help on entity activation - MsHannerBananer - 07-12-2014 (07-12-2014, 10:26 PM)TShapeShifter Wrote: hey guys, this is probably a dumb question and much likely the answer is no but I recently have been wondering, is it possible to activate an entity upon the possession of a certain number of notes? Like for example is it possible for an entity to only activate itself if the player picks up all the notes in a story? It's not a dumb question! xD If it is possible, I would think you can use an if statement. Note's are considered items, and are technically stored in the inventory. You could set up a script box that calls a check function that looks for the if statement and whether or not you have all notes. The if statement would look something like this: PHP Code: if(HasItem("nameofnote1") == true && HasItem("nameofnote2") == true && HasItem("nameofnote3") == true) If the player is missing any of those notes, the script won't call. I've never tried it myself, so I'm not completely sure, however if you can attach script to the interaction with notes, then I'm sure this would work. RE: Help on entity activation - TShapeShifter - 07-12-2014 (07-12-2014, 10:48 PM)MsHannerBananer Wrote:(07-12-2014, 10:26 PM)TShapeShifter Wrote: hey guys, this is probably a dumb question and much likely the answer is no but I recently have been wondering, is it possible to activate an entity upon the possession of a certain number of notes? Like for example is it possible for an entity to only activate itself if the player picks up all the notes in a story? That's actually a great idead! Thanks I'll give it a try! (07-12-2014, 10:54 PM)TShapeShifter Wrote:(07-12-2014, 10:48 PM)MsHannerBananer Wrote:(07-12-2014, 10:26 PM)TShapeShifter Wrote: hey guys, this is probably a dumb question and much likely the answer is no but I recently have been wondering, is it possible to activate an entity upon the possession of a certain number of notes? Like for example is it possible for an entity to only activate itself if the player picks up all the notes in a story? Didn't work T-T God I was so sure it was gonna work... :c I dont suppose you have any other ideas? RE: Help on entity activation - Romulator - 07-13-2014 Yep (Only for another idea...)! Use Local Variables On each note that affects your monster counter, put the code name of your script in PlayerInteractCallback (MsHannerBananer pointed that out, but this is what she meant). Spoiler below!
This is the code you should use :3 PHP Code: void OnStart() RE: Help on entity activation - TShapeShifter - 07-13-2014 (07-13-2014, 01:56 AM)Romulator Wrote: Yep (Only for another idea...)! Use Local Variables Still didn't work Am I doing anything wrong? o: PHP Code: void OnStart() RE: Help on entity activation - MsHannerBananer - 07-13-2014 Okay, let's start from the top. This'll be a long explanation so I'm going to use spoilers. Step One Spoiler below!
Step Two Spoiler below!
Step Three Spoiler below!
And that's it. I hope this can clear some stuff up for you and that it works for you. If you still have problems and are getting error messages, then post your script and hpl log. RE: Help on entity activation - Mudbill - 07-13-2014 I don't think a collide callback would be very reliable for this type of check. You could just check it every time you actually pick up a note. I think the issue here is that it's in the PlayerInteractCallback. It probably slipped Rom's mind that the basic CallbackFunc is ran duing OnPickup. Try calling the code Rom provided within the CallbackFunc at the top of each note. Edit: Actually, let's tweak it a bit. If you have the check to use == 3 before the script that adds the value, then value #3 is actually not recognized until the 4th time this is called. It goes from top to bottom, so even if the value is 3 by the end of it, it won't trigger the if-statement unless it is 3 when it reaches it. PHP Code: void OnStart() This script is slightly more compact and it works the other way around. First it checks if the value has not yet reached 3 (the heart <3 means "less than three" :3). If it has not reached it, it adds another value. If it has reached 3 (or more), it will run the script in the else-block instead. RE: Help on entity activation - Romulator - 07-13-2014 Aw sh... forgot... test last... >.> Either way, we have gone through it a couple of times Whichever solution the OP uses, we can assist with otherwise if there are still problems! RE: Help on entity activation - TShapeShifter - 07-13-2014 Guys thanks alot! I've managed to do it, I tried what Mudbill told me but it didn't work for some reason I then used this: PHP Code: void OnStart() RE: Help on entity activation - Mudbill - 07-13-2014 If you need to use global variables, just change the AddLocalVarInt to AddGlobalVarInt, as well as the Set and Get versions. That's all. |