Sources & Receptrons 2

Aim of Tutorial

 

This tutorial intends to highlight the necessary steps to make an in-game store where the player can buy objects midgame at the cost of loosing some loot. Also, it is a learning tutorial, and will not tell you how to do the store straight off, ‘mistakes’ are made along the way as I felt it would be more logical this way. The end product will allow the purchasing of items until the player runs out of money, then the store has to shut. I already have worked out a better system that does not shut, but that is more complicated still.

 

Assumed Knowledge

 

This tutorial is for ADVANCED dromed users, who are fairly comfortable with basic-intermediate dromed operation. A basic working knowledge of sources/receptrons is assumed and there will not be much hand-holding.

IMPORTANT: the system involves assign a source/receptron relay system on to the Avatar Garrett so that he can interface with objects via that method, (essentially a custom stim source, and a receptron a Garret that bounces the stim back to the object that gave it) and so needs a custom gamesys with such a system on it. See tutorial on TELEPORTING GARRETT for details on how to do this, or download theLEVEL with my gamesys included or simply the GAMESYS ITSELF, once you have the .gam file, copy it to your thief directory and within dromed use the command ‘set_gamesys actreact’ and then save your mission normally to register the change. If successful, the dark.gam on the status bar should change to actreact.gam.

The tutorial starts from a basic level with all necessary scripts, starting points loaded. Also, it is a learning tutorial, and will not tell you how to do the store straight off, ‘mistakes’ are made along the way as I felt it would be more logical this way.

.

The In Game Store

 

The first step is to set up your ‘buying’ stand. Within your basic level, create a table, and put the object you wish to be ‘bought’ on top of it. In this tutorial to start with I am going to buy a bread loaf. Also, place a marker called ‘StoreTarg’ where you want the objects to appear from once they have been bought. The object on the table is a store copy, and will not actually be picked up by the player.

Rename the loaf to ‘BLoaf’ for future reference, and add->Scripts, then delete the eat food script. Create a tall blue room. (A blue room is an area that is otherwise impossible to get to, it will be useful to see what is going on in the room at the moment, so create them next to your main room) This room is essentially going to be used for a kind of disposal chute, when the player uses the loaf we will create a copy of the loaf we are going to give at the top of this room, and when it hits the bottom it will be teleportedto the marker in front of the player. The first step to do this is to create a marker at the top of this blue room, name it ‘StartChute’, and then to create a banner at the bottom under this marker and to rotate so an object falling from the marker will eventually hit it. Any object is viable for this, but a banner is nice and big as standard, and doesn’t have any scripts associated with it that could slow the game down. Create a mini-blue room as an object store, this room will contain the master copy of our loaf. Create another loaf now, and name it MasterLoaf, but there is a problem with this that we will discover later.

Go back to the loaf on the table, and change its frob properties [Add->frobinfo] so that when you frob it doesn’t move to your inventory but the loaf can still be frobed – change the frobinfo so it only says script under World frob. Now, we need to add a source/receptron tags to get the object to interface with player in stimulus terms. If you are using the totality.gam provided, just give the loaf a source, stimulus TotalityStim of level 10, engaged on contact, Frob in World only. Now add a receptron, TotalityStim, min of 0, no max. For the effect, select Create Object, target object MasterLoaf and agent object StartChute. This now means that when you frob the loaf on the table, a bread loaf clone will appear at the top of the chute room. If you go into game mode, and if you can get to your blue room, you’ll notice that it doesn’t actually fall. For this to work it must be able to fall, so change the Master Loaf so that it has Physics->Model->attributes, and this should engage gravity.

The next step is to assign a receptron to the banner, Totality Stim, min 0 and max 5, and a Teleport Object Effect, target object is Source, agent object is StoreTarg. This will set it up so that when any TotalityStim source hits the banner it will be teleported to the table marker. Add the TotalStim source to the MasterLoaf now, Totalitytim, Contact, Collision, intensity 3. Go into the game and try it.

It doesn’t work.

What is happening is that the TotalityStim source is not being copied when the loaf is created. You can see this by saving your level, and then executing the command ‘set game_mode_backup 0’. This tells dromed not to reset your level after returning to dromed, and allows you to see what state the level is in when you leave it. Be warned though, that saving after doing this could result in instabilities, so after checking what you want, reload and set the backup back to 1. In this case, you want to frob the loaf on the table, and then exit out and have a look at the loaf now lying on the banner. It has no source even though we added one to the template loaf. Remember to ‘set game_mode_backup 1’ and reload your level.

This is no problem, just modify the gamesys and add the source there.. Create a new archetype under the original loaf named ‘BuyLoaf’ (click on the normal loaf entry then add) When the screen pops up add the TotalityStin source, contact collision only intensity 3, while we are here we may as well give the archetype basic physics properties as well so it falls. Now save the gamesys. If you are using the one at the start of the tutorial just File, Save Gamesys and overwrite it. Delete the previous MasterLoaf, and create a new one from our new template, and name it MasterLoaf again. As we deleted it, our receptron on the table loaf has gone, recreate it with the same settings as before. Now when you try it frobing the loaf will create a new one at the top of the chute, it will fall and hit the banner, and then be teleported in front of you!

Now, create a a reasonably sized blue room, create a rotating door about midway height horizontally (bank 90 so that it opens downwards), making sure that it has plenty of room to open. Name it Purse. Edit its properties so that it has lots of max hitpoints, as many as the theretical max loot tally, I shall use 1500 and give it a slay result of terminate(Add->Game->DamgeModel for both). Then set its current hitpoints to 10. This door will hopefully mirror the amount of loot the player has, so we better give the player some loot to start with. Create a stack of coins in the object blue room, and link the starting point to the stack via the contains link, and change the loot value to equal 10, (Add->DarkGamesys->Loot). Now Garett has some money to spend, and now it gets complicated.

Create a flower pot on top of the door, named OutCheck. Create another banner on the floor underneath both the flower pot and the door, call it EngageBlock. Now, we need a marker created slightly above the centre of the first banner. Do this and name it ‘TargBlock’, and in the Blue Object room create a third banner, named ‘KillObject’, and rotate so that it is like the other two banners (Make sure that MasterLoaf won’t fall onto it otherwise it will trigger the receptron we are about to add)). Give the KillObject banner a receptron, TotalityStim, min 0 max 5 effect is to Destroy Object, target Source. Add a receptron to the second banner, EngageBlock, min 0 max 12, but with the a Teleport Object effect instead, target is KillObject and agent is TargBlock. So, when the second banner triggers it will teleport the third banner in front of the first, and it will destroy any loaf that falls on it. Now, give the flower pot a totality source, intensity 3, engaged on contact, collision. If you check this by manually forcing the pot and banner to collide, you’ll notice that the indeed the KillObject banner is teleported, but it resets to its default banking, ie vertical. Edit the effect for the teleport receptront of the second banner that teleports KillObject, by clicking on edit effect under the receptron. Then type in 90 under the bank option. Now, we need to link in the buying process to losing the hitpoints on the door

. To do this, create another receptron on the loaf on the table with the same settings as the previous one, but for the effect choose damage object, and Target of purse, edit the effect, and select damage type 1, and then set how much you want your loaf to cost in ‘Then Add’ box. For this tutorial I chose 3. Now, you will be able to buy three loafs, and then the door will be destroyed and the blocking banner will teleport. Of course, as yet the players loot total will not go down, so lets fix that. Create a new object archetype, under the Treasure->Swag->LucreLoot-> heading, called Receipt, and Add Shape->ModelName of ‘hamscrol’ (like a receipt) and add a negatvie loot value of -3. Remember to add this to the the actual Receipt archetype not the others. Add physics settings so it can fall,also, give it a TotalityStim source, intensity 7 (note the 7), propgator contact so that it can go through our teleport chute routine. Save the gamesys (or you could wait a bit as we are going to change it again, but it is good practice to save)
Now, create a receipt in the object blue room, and name it ‘Price3’. There are problems when creating two objects from the same point at the same time as they sometimes collide with each other, so create another marker next to StartChute named StartChute2, and slightly displace it vertically as well. Go back to the MasterLoaf and add a receptron that creates a Price3 clone to the new StartChute2. It would also be nice if we could teleport the object directly to the inventory. We can’t teleport it, but we can use an inbuilt script to force the player to pick it up. Modify the Recepit archetype, add a script called ‘PlayerFrob’. (Save Gamesys) This script does have limits, it will only work with grouped object items, i.e. loot. (If you try it on any non-grouped object like Bafford Scepter then it will transfer to your inventory, but your inventory will not show it.). Go back to the banner that teleports it to StoreTarg (the first banner), create a new source min 6 max 8, effect to Frob Object target Source. So now, whatever hits that banner with a TotalitySim of less than 5 teleports in front of you, between 6 and 8 goes to your inventory.

Unfortunately, you can’t teleport the loaf to the inventory, as the PlayerFrob command effectively eats the loaf rather than picks it up. Now, you can buy three loafs, but when your total gets down to 0 you can no longer buy any!!! One important thing to note, is that the time taken for the flower pot to hit its banner has to be less than the time taken for the chute to complete its cycle, otherwise you might be able to get into negative loot.

This is the first stage, the next is to link every piece of loot in your level so that when you pick it up, it heals the door slightly. Lets create some more coins stacks in a chest on the other side of the room. Create a silver stack and link it to the chest via the contains link As the stacks will be in the chest, we will need to add the soucr/receptron to the chest not the stacks themselves as that is what the player frobs.. All ‘tresure’ will have to be linked like this (See UPDATE at end), or you could specify only coins to decrease the work you have to do. Add a Totality source/receptron system to the chest. For the source, intensity 5, on Contact Frob in World only . Receptron, no max, Damage Object, target Purse, edit effect ‘then add’ negative numbers to heal the door. This number should represent the money gained by the player when the object is picked up either directlry or indirectly. For one silver coin stack, it’s -12. For two in a chest it would be -24. When you now open the chest it heals the door. Go in and try it.

Can you guess the problem? Whenever you use the chest, it always heals the door, even though your loot total hasn’t increased. This happens as we have set the healing process to trigger when the chest is frobbed. How do we get around this one? Well, we somehow need to terminate the healing process after it has been intialised once and the easiest way of doing that is to destroy the object, but we don’t really want the chest to disappear. Instead create a marker near the chest named ‘OpenCheck’. Add the receptron to the marker with the same settings as before, healing the door -12 points. Now, also add another receptron with the effect of destroy object, with the target being ‘me’ ie the marker itself. Now, go back to the chest and edit the receptron so that when it is triggered it Stimulates Object, target OpenCheck, stimulus TotalityStim, Then Add 6. When the chest is now triggered, it transfers the coins to your inventory, triggers the marker, which then heals the door and destroys itself severying the healing link.

Unfortunately, the system still has its limitations. One thing to bear in mind is the timing of the chute, if it is too long then the player can rapidly click to beat the system, fix this by increasing the drop, though still making sure that when the door is destroyed the system stops. But the major limitation is that once the door has been destroyed, the links are effectively removed, so there is no way of re-initialising the system.

In other words, once you have run out of money, that is it:-( Even though you may be disappointed, it can still be used in game as a temporary store. You could have a vendor, manning the stall (which would make sense), who get’s annoyed at you when you run out of money and kicks you out of his shop and locks up. See attatched example file for this, ignore the room with the levers and inverters, it is simply there to handle the portcullis shutting. The technique is also good for other counter usage, and doesn’t even need to be as complicated. For instance, it can be easily modified to limit the number of knockouts that you can do on a level, or the amount of times you do anything that can be linked to the system, which is just about anything.

If you REALLY want a permanant in game store, then look at the next tutorial.

UPDATE:
I have found another slight problem when expanding the system to include simple gold coins stacks, a source that is on a pick-upbable object unfortunately does not trigger. This means that if you wanted to add a source/receptron system to loot byiteself, the system will go wrong. The workaround is to create a dummy object which can not be picked up i.e has no move script, and this object has the source/recptron link. Another two receptrons will need to be added apart from the one that heals the purse door, one that frobs the real loot, which has the PlayerFrob script added to it, and finally one that destroys the dummy object. So, when you frob the dummy object it heals the door, causes the player to pick up the loot and destroys itself.

Download the TGAMESTO(243K) NOW!!!!!!
While stocks Last!

Tips and hints

  • Always remember the bug when editting with sources and receptrons – you must have a source or a receptron added to an object after you edit it for the first time. You can delete it afterwards.
  • Receptrons will always trigger in the order that they are in the receptron table, from top to bottom, so if you have a one shot trigger, which deletes itself, check that there are no further receptron instructions after the delete one.
  • If you can’t work out what a source/receptron is doing, add a link from the receptron to frob a lever so that you can see it move.
  • The source/receptron relay system that is set up on Garrett is very important, it is the most efficent way that the player can interface with a receptron object.
  • Remember that stimuli do other tasks in the game environment as well. Only use the inbuilt ones when you are sure that they will not interfere with the normal running of the game, and when using your custom ones, be careful not to overlap intensities.
  • For a collision source to work, the objects actually have to do that. They have to have a physical dimension, and one of them must stop.
  • Using a source and receptron system this way is quite hard work, and involves quite a bit of bug testing. In this instance, anything going wrong will simply not allow the player to buy anything. If you are not sure whether your nifty feature will work all the time, put in some kind of failsafe.
If you need help, write me, TOTALITY@RIDGE7.DEMON.CO.UK or go to the Forum,HTTP://WWW.THIEF-THECIRCLE.COM/TEG/GUIDES/TWG/WWW.TTLG.COM. And if you don’t want to be labeled as a newbie, use the Forum’s search function first!

About this entry