Page 1 of 1

A "CreateItemInBackpack" question

Posted: Tue Mar 28, 2006 11:12 pm
by Yukiko
I want to be able to create items in a players backpack when they are offline. I can do it in their bank boxes but when I try in the backpack the item isn't created. Anyone have any idea how to do this for orffline characters?

TIA

TTFN

Posted: Wed Mar 29, 2006 2:38 am
by XtehseA
been looking for this aswell, just wondering how i can move a item into a backpack without recreating it.

Posted: Wed Mar 29, 2006 2:40 am
by DevGIB
MoveItemToContainer( item, container, x := -1, y := -1 );

read your uo.em people :P

Posted: Wed Mar 29, 2006 4:14 am
by Tritan
I have not had any luck with this myself. So what I do is use a added function to the login scripts to create the item when they log on instead. Once the item is created I remove the account property that gets placed when I want to create items for offline characters.

Posted: Wed Mar 29, 2006 10:09 pm
by Yukiko
I will try that DevGIB. Your example doesn't answer my question exactly but if it works it will be a workaround at least.

Posted: Sat Apr 01, 2006 9:02 am
by Firedancer
Yukiko wrote:I will try that DevGIB. Your example doesn't answer my question exactly but if it works it will be a workaround at least.
Hmm not tested it, but have you tried that:

account:=FindAccount(<account_name>);
character:=account.getcharacter(<number>);
//... or do a foreach loop through all of these each and compare
// with serial or playername or whatever you got to identify the
// desired char or you have the accountname anyway, then it's easier.

==> so in the end you get the offline character you want to work with.

ok... so you got the char
=> container:=character.backpack;
now if createitemincontainer() doesn't work.... how about creating the item elsewhere, and do a moveitemtocontainer()?

Posted: Sat Apr 01, 2006 9:08 am
by Danielle
Might want to try adding:

Code: Select all

Set_Script_Option(SCRIPTOPT_CAN_ACCESS_OFFLINE_MOBILES, 1);

...to the script.

Posted: Sat Apr 01, 2006 11:19 pm
by Yukiko
Oh my goodness! That might just do it.

Is that a POL 95 option Danielle? If so I must have missed it.

I will try that.

I know DevGIB's solution didn't work.

Firedancer, I already have the character reference through the SystemFindObjectBySerial function call. I use serials to reference the characters. I know the script is working because it works for online characters but not for offline characters.

Posted: Sat Apr 01, 2006 11:24 pm
by Yukiko
*smiles and does a happy dance*

Thanks Danielle! That worked!

I owe you one.

I never knew that was an option. I suppose I should reread the POL docs again.

Posted: Sun Apr 02, 2006 6:55 am
by Danielle
You're welcome.

The docs aren't that great, which is why I've started working on the Wiki again. Eventually we'll have good documentation.. I hope. :)

Posted: Sun Apr 02, 2006 7:12 am
by DevGIB
sorry i didnt realise you didnt have that option enabled :P otherwise i would have mentioned it... come to think of it i really should have just said it anyway
meh aslong as its all working now :)

Posted: Sun Apr 02, 2006 9:18 pm
by Yukiko
NP DevGIB. Always so many things to think about and overlook in script development. I have been scripting POL/eScript for 3 maybe 4 years now and I was not even aware of that option. I just assumed characters were accessible on or offline. Never had a need before to gain access to an offline players pack in a script before.

To quote Montgomery (Scotty) Scott, "The more they overtake the plumbing, the easier it is to stop up the drain."