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
Item triggering a script
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#1
Item triggering a script

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.

05-24-2016, 09:58 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#2
RE: Item triggering a script

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?
05-25-2016, 10:57 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Item triggering a script

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.

05-26-2016, 07:08 AM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#4
RE: Item triggering a script

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

(This post was last modified: 05-26-2016, 12:27 PM by Darkfire.)
05-26-2016, 12:20 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#5
RE: Item triggering a script

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

05-30-2016, 04:00 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#6
RE: Item triggering a script

(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.
05-30-2016, 04:20 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#7
RE: Item triggering a script

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.

05-31-2016, 02:31 AM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#8
RE: Item triggering a script

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.

06-02-2016, 06:19 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: Item triggering a script

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

06-02-2016, 08:08 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#10
RE: Item triggering a script

which part doesn't work?
In case it's the health part:
PHP Code: (Select All)
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.

06-02-2016, 08:57 PM
Find




Users browsing this thread: 1 Guest(s)