diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-17 17:37:19 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-17 17:37:19 -0400 |
| commit | 3498738f081e3d61faabeba3c632e36ac9d8031f (patch) | |
| tree | a19bd0ea8d2904afa1915ed899ae6bd832277fb0 | |
| parent | ea5c6452b163ec42784b403d44b4a5c04893d234 (diff) | |
| download | artery-3498738f081e3d61faabeba3c632e36ac9d8031f.tar.gz artery-3498738f081e3d61faabeba3c632e36ac9d8031f.tar.bz2 artery-3498738f081e3d61faabeba3c632e36ac9d8031f.zip | |
Rewrote tutorials and readme
Rewrote tutorials to sound more natural
Rewrote readme to sound more natural
| -rw-r--r-- | README.md | 23 | ||||
| -rw-r--r-- | tutorials/tut042_too_many_items.md | 2 | ||||
| -rw-r--r-- | tutorials/tut050_entities.md | 34 |
3 files changed, 43 insertions, 16 deletions
@@ -1,14 +1,14 @@ # Artery RPG base -Artery is a gamemode base for Garrys Mod that aims to provide a lot of the functionality needed to build an RPG. Artery is organized as a set of modules that each provide one functionality, and an editor that provides an easy-to-use interface for setting up worlds. +Artery is a gamemode base for Garrys Mod that aims to provide a lot of the functionality needed to build an RPG. Artery is organized as a set of modules that each provide some functionality, and an editor that provides an easy-to-use interface for setting up game worlds. Artery can: * Stich several servers together to create a single logical world * Save and load player data -* Spawn npcs that wander around, give quests, provides shops, and more! -* Easily work with external NPC addons so you don't have to make all the stuff to kill yourself -* Allow for extensible addons to change basic parts of artery, or just add on to the base +* Spawn npcs that wander around, give quests, trade, and more! +* Easily work with external addons so you don't have to make everything yourself +* Load addons to add onto the base ##Dependencies @@ -17,21 +17,13 @@ As of now, artery depends on the following addons: * bobbleheadbob's zone tool * CapsAdmin's PAC3 (+JetBoom's animbonelib which comes packaged with PAC3) * artery_editor +* MySQLOO ## Installation -To install, simple clone this repository into the gamemodes/ folder of the server. Start the server with `+gamemode artery` +To intall, see @{tut000_setup.md} -## Setup - -In order to build your world, you will probably need to write a lot of your own items, and a few npcs. This is much easier with the artery_editor addon, and GCompute. Just start the server with the sandbox gamemode. - -* To add npcs, go under the entities tab, and go to the "artery" section. -* To add randomly spawning monsters, place art_huntablespawn points around the map, and then create zones with bobbleheadbob's Zones tool. Configure the zone with the monsters, and chance of spawning you want. -* To add new items, see the items tutorial on [the documentation](https://cogarr.net/artery/) -* To stich servers together into a logical world, use the zones tool to place art_serverchagne volumes, configure the volume with the server to go to (ipaddress:port) and the location on the server to spawn the player. - -Server owner? See @{tut000_setup.md} +## Develop Developer looking to use Artery? See the tutorials below! @@ -45,3 +37,4 @@ Developer looking to use Artery? See the tutorials below! * @{tut040_items.md} * @{tut041_not_enough_items.md} * @{tut042_too_many_items.md} +* @{tut050_entities.md} diff --git a/tutorials/tut042_too_many_items.md b/tutorials/tut042_too_many_items.md index 9d95b00..48ba0cf 100644 --- a/tutorials/tut042_too_many_items.md +++ b/tutorials/tut042_too_many_items.md @@ -2,7 +2,7 @@ ## Too many items -In the last tutorial we saw how to create lots and lots of items. Sometimes, you think to yourself "that's way too many", and when you do, you simplify. Rougelike games have a tendency to have attributes associated with items. Commonly, "blessed", "normal", and "cursed". In this tutorial, we'll be using the technique discussed in @{tut021_detouring.md} to give every item one of these stats by overrideing @{item.lua.RegisterItem} the Serialize() and DeSerialize() methods to give every item a little extra data. +In the last tutorial we saw how to create lots and lots of items. Sometimes, you think to yourself "that's way too many", and when you do, you simplify. Rougelike games have a tendency to have attributes associated with items. Commonly, "blessed", "normal", and "cursed". If we implemented this by detouring the item.RegisterItem() function, we would make 3 items for every 1 item in the game. Moreover, if you had 3 addons that each did this, the number of items would quickly explode to an unmanageable number. In this tutorial, we'll look at another method of giving items effects. Instead of creating items with names, we're going to override how items save and load themselves to give them a little extra data. garrysmod/addons/artery\_rougelite/data/artery/global/item\_attributes.txt diff --git a/tutorials/tut050_entities.md b/tutorials/tut050_entities.md index e443cae..f223228 100644 --- a/tutorials/tut050_entities.md +++ b/tutorials/tut050_entities.md @@ -28,6 +28,9 @@ garrysmod/addons/artery\_rougelite/data/global/entity\_fountain.txt scripted_ents.Register(ENT, "artery_fountain") +### Alter + +Use mostly the same approach. You can skip this entity if you never went through @{tut042_too_many_items.md} garrysmod/addons/artery\_rogelite/data/global/entity\_alter.txt local ENT = scripted_ents.Get("prop_dynamic") @@ -50,5 +53,36 @@ garrysmod/addons/artery\_rogelite/data/global/entity\_alter.txt ply:GiveItem(item) end end + + scripted_ents.Register(ENT, "artery_fountain") It may have been tempting here to just set the item's .attribute in our iscursed() function, since it will be the first place we detect a cursed item. **HOWEVER!** There are a lot of places in Artery that this kind of thing can BREAK other addons. Generally speaking, try not to modify items while they're in an inventory. Remove them, modify them, then add them back. + +### Chest + +This one is pretty easy, it's really only here to show you how to extend the entities that are already in Artery. + + local ENT = scripted_ents.Get("prop_dynamic") + + DEFINE_BASECLASS("art_chest") -- this defines a local variable called BaseClass + + function ENT:Initalize() + self:SetModel("models/props_junk/wood_crate002a.mdl") + end + + function ENT:Use(ply) + --Get all the items the player has that are cursed + local iscursed = function(item) + if item.attribute == -1 then -- Item is cursed + return true + end + end + local to_uncurse_pos = ply:HasItem(iscursed) + while(to_uncurse_pos) do --Will be nil if we don't have any cursed items + local item = ply:RemoveItem(to_uncurse_pos) + item.attribute = nil + ply:GiveItem(item) + end + end + + scripted_ents.Register(ENT, "artery_fountain") |
