Drop (Solved)

Davewoody55
10 Feb 2019, 12:20

Can anybody think of a way that i can print a message everytime an item is dropped in a certain location?

I could add a bit of a script to every movable object in my game to check if the player is in location X then print the message, but i'm guessing there must be a more elegant solution.

Any help would be appreciated
Woody


mrangel
10 Feb 2019, 12:57

Create a command in that room with the pattern drop #object#?

A command in the room would be run instead of the standard drop command while the player is there. You should probably copy the script for the standard drop command, and then just change it to print the message.

If you only want the message to be printed when an object is actually dropped (not if the object's own drop script interferes or something) then you'd put your extra script after the DoDrop line, and include an if statement to check if the object was successfully dropped. (I'd say test for if (obj.parent = game.pov.parent) - so that the message isn't printed for an object that can't be dropped, a worn garment, or for an object that disappears when dropped.


Davewoody55
10 Feb 2019, 13:17

See i knew there would be a more efficent way! Thats brilliant! Thanks. I'll get the hang of this eventually! LOL Thanks Again