Bob!RynthidZerzelikyrAyanAerlintheNeftetgearknightsdarkisleSanctuary

Tutorial: Adding Landscape Item Pickup

Unofficial support for the creating and editing of metas.
Dmdtt
Moderator
Posts: 266

Tutorial: Adding Landscape Item Pickup

Post#1 » February 19th, 2015, 2:04 pm

The primary purpose of this would be to add to your hunting meta so that you can clear landscape spawns such as black coral, prickly pears or desert flowers that normal will take over a spawn location for an enemy. This is a bit more complicated than the average meta so I will try my best to explain each step.

To start I just want to explain how I structure my hunting metas to clear up any questions someone might have of my use of states called default2, default3, Hunting, Default.

Default - I use as a launching state it loads up my character profile for the hunting location then adjusts settings in any other plugins like octagram, loads an empty route to clear the navigation and sets the normal settings for my character profile then finally sets to Default2.

Default2 - is what I call my listening state, 95% of the time nothing happens in this state it just waits for any of the number of conditions listed in the state to be met, some examples are character death or commands from other characters or in this case a world object coming into range.

Default3 - in my example is the state I use temporarily while the meta picks up/uses the world object it is interacting with, once complete it transitions to the Hunting state. In my metas a state like Default3 would also have some of the same conditions such as Character Death and some basic Chat commands that can be issued by other characters.

Hunting state - is simply an Always load Embedded Nav Route then return to Default2 to listen for further conditions to be met.

Now to the task at hand, adding the landscape pickup.

First you need to be able to react to having a Desert Flower or a Prickly Pear in range 10m, and use that to set meta state to Default3 and load an empty route

Default2 -

Code: Select all

-Condition-
All: {Expr coordinatedistancewithz[getplayercoordinates[], wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=10, Any: {Expr wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Desert Flower, wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Prickly Pear}}

-Action-
All: {Set Meta State: Default3, Embedded Nav ["None"] (0pts)}


next in default3 load a embedded nav route to pickup the flower/pear

Default3 -

Code: Select all

-Condition-
Expr coordinatedistancewithz[getplayercoordinates[], wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=13

-Action-
All: {Expr setvar[ObjectClose, 1], Embedded Nav ["Pickup"] (2pts)}


this nav will be a circular route with 2 points

/vt mexec actiontryuseitem[wobjectfindnearestbyobjectclass[8]]

10s pause

the next condition will detect once that object has been picked up if it is a desert flower

Default3 -

Code: Select all

-Condition-
All: {Expr getvar[ObjectClose]==1, coordinatedistancewithz[getplayercoordinates[], wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]>14}

-Action-
All: {Expr Act setvar[ObjectClose, 0], Set Meta State: Hunting}


the final condition will detect if a Prickly Pear was used

Default3 -

Code: Select all

-Condtion-
All: {Chat Message: "^As the prickly pear is moved, it disturbs a nest of desert wasps!", Expr getvar[ObjectClose]==1}

-Action-
All: {Expr Act setvar[ObjectClose, 0], Set Meta State: Hunting}
1 x

Dmdtt
Moderator
Posts: 266

Re: Tutorial Adding Landscape Pickup.

Post#2 » March 1st, 2015, 12:21 pm

Made a few corrections to the tutorial, seems I did not take into account the fact that some pears spawn on pillars and can be 14.5-16m away, also fixed objectClass so they are all 8.
1 x

MMS
Posts: 3

Re: Tutorial: Adding Landscape Item Pickup

Post#3 » April 24th, 2016, 7:46 am

This might not be the best place for a complete beginner question but this is a meta I would like to implement and I am struggling with.

Should all metas be entered via the on screen editor? What is the format for entering them? Is there a little guide somewhere for setting up something basic to get me started?

I get it to half work but I get errors like:
[VTank] Error in meta expression: coordinatedistancewithz[getplayercoordinates[]} (Unmatched [ in function call: "coordinatedistancewithz[getplayercoordinates[]}")

I think this relates to the way I am entering the meta code.

Thanks for your help. I just need to get my head round the underlying method for setting these things up I think.
1 x

User avatar
HellsWrath
Site Admin
Posts: 388

Re: Tutorial: Adding Landscape Item Pickup

Post#4 » April 24th, 2016, 12:07 pm

MMS wrote:This might not be the best place for a complete beginner question but this is a meta I would like to implement and I am struggling with.

Should all metas be entered via the on screen editor? What is the format for entering them? Is there a little guide somewhere for setting up something basic to get me started?

I get it to half work but I get errors like:
[VTank] Error in meta expression: coordinatedistancewithz[getplayercoordinates[]} (Unmatched [ in function call: "coordinatedistancewithz[getplayercoordinates[]}")

I think this relates to the way I am entering the meta code.

Thanks for your help. I just need to get my head round the underlying method for setting these things up I think.


You use the in-game editor. You will only use notepad .001% of the time (and never necessary)

Your expression gives the error "Unmatched [ in function call: " because you don't have a closing bracket, you have a curly brace.
Every opening bracket [ needs a closing bracket ]

If you look in the string coordinatedistancewithz[getplayercoordinates[]}
Count the brackets, you see above, you get the error from the curly brace [ [ ] }
It needs to be equal, [ [ ] ]

coordinatedistancewithz[getplayercoordinates[]]


You won't ever manually type curly braces in meta {}
They appear on their own around Any{} and All{} rules to show what is contained within it

There is not a guide for using the editor, but there is plenty of documentation to get you familiar with the options.

http://www.virindi.net/wiki/index.php/V ... eta_System

http://www.virindi.net/wiki/index.php/Meta_Functions
2 x

MMS
Posts: 3

Re: Tutorial: Adding Landscape Item Pickup

Post#5 » April 24th, 2016, 1:15 pm

Thanks so much for the quick reply. It's always so obvious isn't it? What a silly mistake. I was wondering what those {} brackets meant and now I know. I think I will enjoy playing with this tool once I get used to it!

Still getting this error all the time. Hopefully will crack it soon:


[VTank] Error in meta expression: coordinatedistancewithz[getplayercoordinates[]] (coordinatedistancewithz[] takes 2 arguments.: "coordinatedistancewithz[getplayercoordinates[]]")

Many thanks once again.
1 x

User avatar
HellsWrath
Site Admin
Posts: 388

Re: Tutorial: Adding Landscape Item Pickup

Post#6 » April 24th, 2016, 3:53 pm

It tells you right there in the error, it requires 2 arguments, You only have 1.

You only copied part of the expression.

to detect a prickly pear within a range of 10:

Code: Select all

Expr coordinatedistancewithz[getplayercoordinates[],wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=10



http://www.virindi.net/wiki/index.php/Meta_Functions

coordinatedistancewithz[2]
Description: Returns the 3d distance between two coordinates. The result is a number specified in meters.

Parameter count: 2

Param 0 (Coordinates): The first coordinates object.
Param 1 (Coordinates): The second coordinates object.


So you are trying to find the distance between yourself and an object -
coordinatedistancewithz[]

your first parameter is your location -
getplayercoordinates[]

and your second parameter is the object location, which has one parameter -
wobjectgetphysicscoordinates[]

parameter:
wobjectfindnearestbyobjectclass[8]

which becomes
wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]

Completed it is

coordinatedistancewithz[getplayercoordinates[],wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=10
1 x

MMS
Posts: 3

Re: Tutorial: Adding Landscape Item Pickup

Post#7 » April 26th, 2016, 3:33 pm

Okay I am going to seem really ignorant but I can't figure this out at all. How do I enter the code for Default2? I have been trying for a couple of days now (each evening!) to figure this out and it's driving me mad.

I get this error a lot, depending on how I enter the info:

Error in meta expression: wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Desert Flower, wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Prickly Pear (Call to unknown function "Desert Flower, wobjectgetname": "wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Desert Flower, wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Prickly Pear")

For example on Default2 would I do the following?

-Condition-
All: {Expr coordinatedistancewithz[getplayercoordinates[], wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=10,

On the left hand side set the top of the box to "All" then add an expression from the drop down at the bottom and paste the above in.
Then below that add an "Any" and within that an expression (from the drop down at the bottom) and paste the below in.

Any: {Expr wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Desert Flower, wobjectgetname[wobjectfindnearestbyobjectclass[8]]==Prickly Pear}}

The set the box on the right to "All" and add the 2 commands underneath?

-Action-
All: {Set Meta State: Default3, Embedded Nav ["None"] (0pts)}

Or do I have two instances of the state Defaut2 so I can keep the "Any" separate from the "All"?
1 x

Return to “VT: Meta Support”

Who is online

Users browsing this forum: No registered users and 1 guest

Login  •  Register