2021s
How to drop items in Crayta
May 22, 2021Introduction
Something we had to do for High Noon was implement a feature where the player would drop all of their collected gold when they died. We re-used the existing pickup logic for this, including some custom changes so that the dropped items wouldn’t respawn on a new round, and could only be picked up once.
Getting started
I’m assuming we’re in an empty world here, so the first step is to install the Inventory package from the community tab in your editor. If you’re creating a game from an existing template like Capture the Flag, this package will already be installed.
If you’re on a blank game, add the User Inventory template to the user template, and the Player Inventory View template to the player.
Next, add a trigger to the map, add the pickupSpawnerScript to it, any entity, and the inventoryItemSpecScript script. I used the ammo entity. Feel free to customize the properties on the pickupSpawnerScript at this point. For this example, we’re going to turn on “useOnCollision”, and “showOnInit”, and turn off “enableCollisionOnChildren” to keep things simple.

Now, create a template out of the result, and place a few instances of the template around the map. What we’re going to do is define a space to drop these off, and they’ll all fall on the ground.
Dropping items
Paint a square of the map a new color, to designate it as the dropoff zone, then add a trigger that covers the entirety. This is going to be our test zone.

Create a new script and add it to the player template, call it “dropItemsScript”, or whatever you fancy.
local DropItemsScript = {}
-- Define what template we want to drop from the inventory
DropItemsScript.Properties = {
{ name = "templateToDrop", type = "template" }
}
function DropItemsScript:DropItems()
-- The player's inventory exists on the user
local user = self:GetEntity():GetUser()
local inventory = user.inventoryScript
-- Get the item we want to drop out of the inventory, this item will contain
-- the number of items the user is carrying
local item = inventory:FindItemForTemplate(self.properties.templateToDrop)
-- If the user isn't carrying this item, we have nothing to drop
if not item then return end
-- We want to drop the items around the user, so store the user's position before starting to drop items
local pos = self:GetEntity():GetPosition()
-- We want to drop the items one at a time, so we can calculate new positions for all of them
for i=1,item.count do
-- Calculate a new position in in a circle around the user, at a max distance of 500
local maxDistance = 500
local newPosition = pos + (Vector.New(math.random(), math.random(), 0) * maxDistance) - Vector.New(maxDistance / 2, maxDistance / 2, 0)
local drop = GetWorld():Spawn(self.properties.templateToDrop, newPosition, Rotation.Zero)
-- Tell the pickup spawner script we don't went this item to respawn after being picked up
drop.pickupSpawnerScript.properties.singlePickup = true
-- show the pickup
drop.pickupSpawnerScript:ShowPickup()
end
-- Remove all the items from the inventory
inventory:RemoveFromItem(item, item.count)
end
return DropItemsScriptNotice we have a property on this script, you’ll want to set this to the ammoPickup we created earlier.
The property that we set called “singlePickup” doesn’t exist in the pickup spawner script, so we’ll have to add that. Open up the pickupSpawnerScript and add the property
{ name = "singlePickup", type = "boolean", default = false }
Now modify PickupSpawnerScript:Pickup(player) with
if self.properties.singlePickup then
self:GetEntity():Destroy()
end
At the very bottom of the method.
Finally, in the trigger you added for your dropoff zone, set the OnTriggerEnter function to the DropItems method on the player.
You can check out a working example of this here: https://launch.crayta.com/play/dfr6rten
Just testing mastodon integration!
The Evoxel Files: Declassified v1.0.1
Apr 29, 2021Fixes
- Properly calculate movement independent of framerate (Fixes game on PC)
- You should no longer maintain velocity if respawned while falling
- If you somehow manage to get above the command center, you should now die
- Leaving the ground at all while playing will now kill you
- There is no longer a small window to re-enter the arena after the last person dies, and before the round actually ends
- Hyperdrive animation will loop
Improvements
- Add blue border to dialog text
- Client is now only responsible for their own hit detection
- Dialog box is now slightly transparent, so you can see the evoxels following you
- Evoxels will now longer look up/down
- Timer will now persist shortly after dying
- Floodlights will turn off while in outline/8-bit mode
- outline/8-bit mode will turn off after dying
The Evoxel Files: Declassified Released
Apr 24, 2021
The evoxel files: declassified has been released on Crayta.
Evoxel files was created between April 19th and April 23 2021, as part of the Alien Conspiracy: Classified game jam.
The goal of the game is to survive as long as possible on a small plateau, all the while being chased by hundreds of cheerful pink evoxels, avoiding crossing green evoxels, and dodging speeding blue evoxels.
Players are ranked by time survived on a weekly basis, as well as all-time.
You can change the post processing effect by interacting with 1 of the 2 buttons on the side of the waiting room.
Evoxels are a homage to the game Evoxel, by Mochi.
Click here to play The Evoxel Files: Declassified on Epic Games or Stadia
My submission for the #crayta game jam: launch.crayta.com/play/q4p2…
My submission to the #crayta game jam is coming along: clipia.ca/media/90
The ominous turn of an evoxel clipia.ca/media/85
Started working on my #crayta game jam game! The theme is “Classified”
Adding syntax highlighting to micro.blog.
Mar 24, 2021If you wrap code in fences (```) on micro.blog, you’ll be presented with a code block with no syntax highlighting. This just won’t do.
To enable syntax highlighting on any theme, head to your Design tab, click on “Edit Custom Theme”, then “New Plugin”.
Enter whatever name floats your boat, and paste https://github.com/joshleblanc/plugin-syntax-highlighting into the Clone URL box.
Give micro.blog a few seconds to update, and you should see your code in all its highlighted glory. To specify the language, just add the language name after the fences (```ruby for example)
For example:
def hello_world
p "Hello, World!"
endfunction helloWorld() {
console.log("Hello, World!");
}