Page 1 of 1

Walkon script member

Posted: Sat Jun 10, 2017 6:50 am
by DevGIB
I've been searching the forums but can't find the answer on any discussion regarding it.

I'm not sure if there is a way and I've been through most of the docs to try and work it out, however i'm wanting to set walkon scripts on the fly/from a script. I can't see a member under the item class.

Whilst my script compiles fine it doesn't appear to actually work in game.

Code: Select all

foreach item in (createdset)
	item.name := "GIBS  Treasury";
	item.walkonscript := ":sets:statics/treasury_walkOn";
	item.setprop("GuildID", 0x1);
endforeach
If what i'm looking to do isn't possible i guess the alternative would be to make an item which has the walk on script i want then create that and change the graphic to all the individual graphics i want but the above way seemed much easier.

Re: Walkon script member

Posted: Sat Jun 10, 2017 9:31 am
by Turley
I don't think there is a specific member. But I would anyway suggest to create items via GetItemDescriptor if multiple properties need to be changed, since you can define them before creating. And this way you should also be able to define a custom walk-on entry.

Re: Walkon script member

Posted: Sat Jun 10, 2017 11:58 am
by Harley
DevGIB, I tried it like you and have negative result.
I found else way.
My item didn't have from the beginning WalkScript.
When I create it, in my command, I set to to start_script() with this item and all looks great!
var script := start_script( ":gmitems:control/special-item-decay", order_cloak );

Re: Walkon script member

Posted: Sat Jun 10, 2017 2:55 pm
by RusseL
Workaround

walkon.src

Code: Select all

start_script(CStr(GetObjProperty(walkon_item, "walkon_script")), {character, walkon_item});
Set the right property and it should do what you want.
I am not sure, but it should be better to use run_script_to_completion here. Do not allow users to trigger this script twice:)

Re: Walkon script member

Posted: Sun Jun 11, 2017 12:54 am
by DevGIB
Turley wrote:
Sat Jun 10, 2017 9:31 am
But I would anyway suggest to create items via GetItemDescriptor if multiple properties need to be changed, since you can define them before creating.
I'm trying this at the moment but it doesn't appear to be working. From all accounts its assigning that property when creating the item, however it doesn't seem to trigger the walkon script, as its not a member of the item class. I've checked through the items.txt file and it appears that walkon scripts aren't stored there, i don't know enough about the core to work out how it actually reads and loads a walkon script but it must be triggered by the objtype and not by a prop or member on the actual item itself.
RusseL wrote:
Sat Jun 10, 2017 2:55 pm
walkon.src

Code: Select all

start_script(CStr(GetObjProperty(walkon_item, "walkon_script")), {character, walkon_item});
Unfortunately the limitation i was coming up against was i'm using objtypes which i currently don't have items defined for in config files. I'm going to do some testing now, but using Turleys method with a placeholder item that has all its other parts changed at creation i might be able to do this with a generic script i will give it a test.
Harley wrote:
Sat Jun 10, 2017 11:58 am
When I create it, in my command, I set to to start_script() with this item and all looks great!

Code: Select all

		var script := start_script( ":gmitems:control/special-item-decay", order_cloak );
As above, but this looks like a control script, unless theres a way to trigger a walkon event from a control script?


I'll do some more testing by combining the 2 methods and see how i go.