Sorry for posting so much, but once again after hours of searching, I can't find anything on this anywhere...
I want to make a basic "use inventory with NPC" function, that only applies when the mouse cursor is set to the inventory item graphic, like in Sam n Max Freelance Police (and most probably many other games).
I have tried figuring out the code myself, and ended up with this, but apparently it is not entirely correct;
function Girl_AnyClick(){
if (iTeddyBear.CursorGraphic){
//some scripting
}
else{}
}
I don't know if it's AnyClick I should use, or if there's a better option, and I don't know if the (iTeddyBear.CursorGraphic) makes any sense in this context either...
Any help would be greatly appreciated.
Depending on the settings you've picked, the cursor item should be the inventory graphic item anyway, so player.ActiveInventory would work?
function Girl_AnyClick()
{
if (player.ActiveInventory == iTeddyBear)
{
//some scripting
}
else
{
}
}
This is a direct approach, though I think player.ActiveInventory==iTeddyBear inside the if would work better, but well, there you go anyhow.
function Girl_AnyClick(){
if (mouse.GetModeGraphic(mouse.Mode)==iTeddyBear.CursorGraphic){
//some scripting
}
else{
}
}
OR
function Girl_AnyClick(){
if (player.ActiveInventory==iTeddyBear){
//some scripting
}
else{
}
}
if (iTeddyBear.CursorGraphic){
This will always be true unless the CursorGraphic is set to 0, in which case it'll always be false.
The correct method was pointed out already, just wanted to say that the proper event would be "Use inventory on character" which will create a function named "Girl_Useinv()".
Girl_AnyClick on the other hand will react to any mouse mode (except Walk I believe).
Thanks a lot for the kind replies!
I have tried the ActiveInventory function, and it worked - BUT;
when ActiveInventory is active, it still applies even if one of the other cursors are visible (walk, talk, use, etc)...
What I want, is the function only to apply, when the inventory item is the cursor graphic. That's why I thought it would work better, if I used the CursorGraphic function...
I hope I explained this properly.
@Khris: I have actually tried to use the Useinv function also, but that didn't do anything. Obviously I made a mistake somewhere. Can you give me the full script for this function?
Anyone have an idea how to fix this?
The function is empty when it's created. But if you just use Girl_Useinv instead of Girl_AnyClick (and ActiveInventory instead of CursorGraphic), then everything should work just fine.
Edit: Like this.
function cGirl_UseInv()
{
if (player.ActiveInventory==iTeddyBear) {
// whatever
}
}
Oooh I see, so simple ;D
Thank you!