Walkon script member

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
DevGIB
Grandmaster Poster
Posts: 204
Joined: Mon Feb 06, 2006 6:12 am

Walkon script member

Post by DevGIB » Sat Jun 10, 2017 6:50 am

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.

Turley
POL Developer
Posts: 644
Joined: Sun Feb 05, 2006 4:45 am

Re: Walkon script member

Post by Turley » Sat Jun 10, 2017 9:31 am

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.

Harley
Forum Regular
Posts: 311
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Walkon script member

Post by Harley » Sat Jun 10, 2017 11:58 am

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 );

RusseL
Forum Regular
Posts: 348
Joined: Fri Feb 20, 2009 8:30 pm

Re: Walkon script member

Post by RusseL » Sat Jun 10, 2017 2:55 pm

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:)

DevGIB
Grandmaster Poster
Posts: 204
Joined: Mon Feb 06, 2006 6:12 am

Re: Walkon script member

Post by DevGIB » Sun Jun 11, 2017 12:54 am

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.

Post Reply