Frictional Games Forum (read-only)

Full Version: Item triggering a script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.
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?
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.
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
BUMP!
I'm still looking for help, any ideas ?
(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.
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.
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.
Have you tried looping a timer to check for HasItem() ?
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.
Pages: 1 2