Tutorial: Adding Landscape Item Pickup
Posted: 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 -
next in default3 load a embedded nav route to pickup the flower/pear
Default3 -
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 -
the final condition will detect if a Prickly Pear was used
Default3 -
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)}
Default3 -
Code: Select all
-Condition-
Expr coordinatedistancewithz[getplayercoordinates[], wobjectgetphysicscoordinates[wobjectfindnearestbyobjectclass[8]]]<=13
-Action-
All: {Expr setvar[ObjectClose, 1], Embedded Nav ["Pickup"] (2pts)}
/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}
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}