Hi guys,
so for the first time I want to use some custom functions to generate me some shortcuts.
It's just about getting the charcater to play a pickup animation, making the object invisible and adding the item to the inventory.
That'S really an old issue, and I started by digging up some old Code-Advice that Khris scripted 10 Years ago or so.
So, in the Globalscript I have
function PickUpLow(int dir, int obj, InventoryItem*inv) {
player.LockView(6); // change this to the pick up-view
player.Animate(2, 5, eOnce, eBlock); // play pick up-animation, make sure it's blocking
object[obj].Visible=false; // turn off object
player.AddInventory(inv);
player.UnlockView();
}
Int he GLobalscript Header:
import function PickUpLow(int dir, int obj, InventoryItem*inv);
In my Roomscript it will be;
function oBlueCup_AnyClick()
{
if (Verbs.MovePlayer(523, 531)) {
// LOOK AT
if(Verbs.UsedAction(eGA_LookAt)) {
player.Say("It's a blue cup.");
}
// USE
else if(Verbs.UsedAction(eGA_Use)) {
player.Say("I'd rather pick it up.");
}
// Push
else if(Verbs.UsedAction(eGA_Push)) {
player.Say("It might break.");
}
// Pull
else if(Verbs.UsedAction(eGA_Pull)) {
Verbs.Unhandled();
}
// PICKUP
else if(Verbs.UsedAction(eGA_PickUp)) {
PickUpLow(eDir_Right, oBlueCup, iCup);
}
//USE INV
else if(Verbs.UsedAction(eGA_UseInv)) {
Verbs.Unhandled();
}
// don't forget this
else Verbs.Unhandled();
}
}
My Error reads:
Error (line 105): Type mismatch: cannot convert 'Object' to 'int'
My guess is that maybe some codestuff was updated in the timespan of ten years, and I'm just missing something obvious.
So... Any thought?
My guess, is that your function is defining an int (int obj) but then you telling it to pickup oBlueCup, which is an object.
Try using the object number instead?
Thanks Dude! That was quick and did the trick :)
That's really one of my rookie prolems... using commands is no problems, but what all these different types of things do... no clue.
Well that's what help forums are there for, thanks again!
You don't have to use the literal number, you can do this:
PickUpLow(eDir_Right, oBlueCup.ID, iCup);
This should also work:
function PickUpLow(int dir, Object* obj, InventoryItem*inv) {
player.LockView(6); // change this to the pick up-view
player.Animate(2, 5, eOnce, eBlock); // play pick up-animation, make sure it's blocking
obj.Visible=false; // turn off object
player.AddInventory(inv);
player.UnlockView();
}
Aaah, even better! Thanks Khris :)