A "CreateItemInBackpack" question

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

A "CreateItemInBackpack" question

Post 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
XtehseA
New User
Posts: 22
Joined: Thu Feb 23, 2006 8:33 pm

Post by XtehseA »

been looking for this aswell, just wondering how i can move a item into a backpack without recreating it.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

MoveItemToContainer( item, container, x := -1, y := -1 );

read your uo.em people :P
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Firedancer
Grandmaster Poster
Posts: 104
Joined: Fri Feb 03, 2006 6:32 am

Post 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()?
Danielle
Grandmaster Poster
Posts: 104
Joined: Tue Feb 07, 2006 3:32 pm

Post by Danielle »

Might want to try adding:

Code: Select all

Set_Script_Option(SCRIPTOPT_CAN_ACCESS_OFFLINE_MOBILES, 1);

...to the script.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Danielle
Grandmaster Poster
Posts: 104
Joined: Tue Feb 07, 2006 3:32 pm

Post 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. :)
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post 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 :)
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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."
Post Reply