Frictional Games Forum (read-only)
Item triggering a script - 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: Item triggering a script (/thread-47998.html)

Pages: 1 2


Item triggering a script - Darkfire - 05-24-2016

So I want to have an item that when used disappears and triggers a script. Like for example health potion, but instead of adding health it would start a chosen script.

Is it possible ? I fiddled a little with the model editor but couldn't find anything.


RE: Item triggering a script - Slanderous - 05-25-2016

I remember that one of the endings in The Great Work was triggered after using a certain item, perhaps you could take a peek how was that done?


RE: Item triggering a script - Mudbill - 05-26-2016

What kind of item? If it's in the world, that would be easy. If it's a health potion or other consumable, then you gotta do a little more.


RE: Item triggering a script - Darkfire - 05-26-2016

Forgot to tell. Yeah, it's an inventory item, ritual knife in this case.

PS. Seems that it's time to play the Great Work


RE: Item triggering a script - Darkfire - 05-30-2016

BUMP!
I'm still looking for help, any ideas ?


RE: Item triggering a script - Slanderous - 05-30-2016

(05-30-2016, 04:00 PM)Darkfire Wrote: BUMP!
I'm still looking for help, any ideas ?

I believe I've got you on skype, so when you're available hit me up and we might come up with something together.


RE: Item triggering a script - Daemian - 05-31-2016

MMmhh I know you can do it with a health potion.
It works but you need a timer to check when the player used the item. And to keep the player's health at < 100.


RE: Item triggering a script - Darkfire - 06-02-2016

Yeah, I think I'll do that. Although I tried to make it so it diminishes the health, but it doesn't work at all. Maybe if I use it normally it will.
I'll check back if it doesn't.


RE: Item triggering a script - Mudbill - 06-02-2016

Have you tried looping a timer to check for HasItem() ?


RE: Item triggering a script - Daemian - 06-02-2016

which part doesn't work?
In case it's the health part:
PHP Code:
void DaggerLoopCheck (string &in a):
If (
GetPlayerHealth() >99) { SetPlayerHealth=98.0f ;} //prevents regeneration
if (!HasItem("CustomDaggerItem")) { funcPlayerUsedTheItem; } //checks the item

AddTimer "dagger123""DaggerLoopCheck"); //loops itself
}

void funcPlayerUsedTheItem {
//code
RemoveTimer ("dagger123");


oh and you gotta make your custom item a Health Potion type in the model editor.