Use object just after took it

Good evening everyone.
I'm super new here, so my question can be super silly. Forgive me if I'm a noob, but I can't find how to solve this.

I can't make an object usable just after player have already taken it. In the game, it seems, if the object is in the room, you can already use it, and no need to take it.
In my example: a guard has a gun (an Use/Give object). You can't take the gun cause the guard don't give it to you, this works correctly. But if you write "use the gun", then you can use it.
There is a way I can allow the feature "Use/Give" just after you carry the object? If you don't have it in your inventory, you should not be able to use it.

Thanks for answers!


In the script for what happens when the object is used, you need to check if the player has it. So for example:

if (Got (this)) {
  // code for using it goes here
}
else {
  msg ("You can't use it unless you're holding it.")
}

Most of the built in commands require an object to either be in the inventory, or to be reachable. But each command makes this check itself. For any commands or verbs you add, you will need to check if the player is allowed to do that, and display a message if not.


Thanks!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums