Sources and Receptrons 3, Permanant In Game Store.

Aim of Tutorial
Assumed Knowledge
The Full In-Game store
Overview of process

Hints and Tips

Aim of Tutorial

This tutorial intends to achieve a fully functional in-game permanent store, where you can come back later and continue to buy things if you want to.

Assumed Knowledge

This tutorial is for ADVANCEDdromed users, who are fairly comfortable with basic to intermediate dromed operation. A basic working knowledge of sources/receptrons is assumed and there will not be much hand-holding, and I also recommend you read and try to understand the principles explained in the temporary in game store tutorial.

IMPORTANT: the system involves assigning a source/receptron relay system on to the Avatar Garrett so that he can interface with objects via that method, and so needs a custom gamesys with such a system on it. See the tutorial on teleporting garrett for details on how to do this, or download a custom one premade here. 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.

(Back to Top)

Setting up the Fully Functional in Game Store

The last system that I described which used the door's hitpoints stumbled into problems as once the door was destroyed the links between the loot and the door were gone, as if the door was re-created how could you tell the game that it was now to stimulate the new one instead of the old one? Well, after thinking about it I decided that I needed to use another variable representation in the game, and decided to use......the z-axis!!!

The idea is to have an object which is not affected by gravity in a very tall room, and when the player gains loot it is teleported up, and when he buys things it falls down. If it falls down below a certain point, a blocking device will temporarily be installed, but when it goes back up again the blocking device is removed.

The initial set up is as before. First set up your 'buying' stand. Lets make it more interesting this time and allow the player to be able to buy choose between a speed potion and a healing potion (try not to faint from the excitement). Create both on a table, and remove scripts so that nothing happens when you frob'em, and modifiy the frob info so you can't pick them up, though it must have script in the world action otherwise you won't be allowed to frob it at all. I'll refer to them as BSpeed and BHeal. Create a tall blue room with one marker at the top, StartChute. In the previous tutorial we used two, but we only actually need one as we can use the edit effect of the teleport options to displace the objects being teleported to them. Down the bottom place the banner blocking the room, bank 90, TrigSale. Create another marker called StoreTarg, which is where you want the bought objects to appear.

Next step is to create the two potion archetypes with the TotalityStim sources on. I find it easier to create them under the original object archetypes. Call them BuyHeal and BuySpeed, and add to both a Totality Source, intensity 5, contact collision. Also, add physics model attributes to make sure that they will fall when created.

Save the gamesys.

Create a master copy of the two potions in a new object blue room, MasterHeal and MasterSpeed. Add both a source and receptron to each of the potions on the table to interface with the player (come on, you should be able to do that by now!) and for the receptrons set the trigger to create object, agent StartChute, and target is the corresponding masterpotion. ie, the speed potion will have a target of MasterSpeed, though both will go to StartChute for agent. Finally, add to the banner a receptron that teleports any TotalityStim intensity less than 5 to the StoreTarg. (remember to set the target to Source) Then go in and test it. Frobing the potions should cause the corresponding clones to appear at the marker.

As we did with the temporary game store, create a Kill Object banner in the object room. Name it Block, and add the receptron that destroys any TotalityStim that hits it. Create a marker above the first banner called BlockTarg.

Now, here is where the design varies. Create a long blue room, 150 units tall. (Max amount of loot on level x 0.1 + maxprice*0.1 + 20). In my case, my upper loot limit is 1200 so the max price 150.

This room will represent your loot tally. Create a flowerpot and change its Physics->Model->Attributes so that ita gravity of 0 and will not fall. Name it Tally. For reference, create a marker at the bottom of the room named 'Bottom'. Theoretically the pot should never need to go below this. Now, note it's z value. 0.1 x maxprice should represent how much further you have to climb to get to where the player has no loot. Using your maths skills, add this to the y value, and create another marker there called Empty. The easiest way of doing this is to modify the details by hand, create a marker in the right x,y pos, and then type in the correct z value. In my level, it is -94 + 0.1*150 = -79. Let us assume that we want Garrett to start with some gold, a 100. This means that the pot should be at the bottom marker + 0.1*100, i.e at -69. Do this for your z-value of bottom. We may as well link in some gold coins of 100 loot at this stage. Create the stack, change the loot value to 100 and link it to the player start via a contains link.

Now, we want the plant pot to change in height whenever goods are spent, and to increase in height when money is picked up. Unfortunately, though is no direct way of converting from Sources and Receptrons into a specific distance to teleport. We are going to have to 'hardcode' the exchange as it were. This means that your level should contain sensible amounts of loot, with there only being a slight difference of values between them as otherwise you are going to have to do lots of hardcoding.

Create another flowerpot called purse and place it in the blue room. We are going to hardcode it so that when it receives a TotalStim of intensity 10, it teleports Tally 10 units up, if it receives 30 it teleports it 30 units up,etc. We can teleport the Tally-pot by using it as both the target, and agent, effectively teleporting it to itself but then adding a z offset. I am assuming that in my level my treasure is going to be in multiples of 5, 12, 20, 50, 100, 200. And for the prices, my speed potion is going to cost 60, and my healing potion 150.

I shall demonstrate adding the receptron for '5'. Totality Stim, min 4, max 6, Teleport object, Target Tally, Agent Tally, Edit Effect Z 0.5. I shall demonstrate adding the receptron for '12'. Totality Stim, min 11, max 13, Teleport object, Target Tally, Agent Tally, Edit Effect Z 1.2. You get the idea? Repeat this for all the multiples that you change, and do the same for the negative values.

Let's now create some receipts. Simply use the previous archetype if you still have it, if you haven't create a new object called receipt under the Treasure->Swag->Lucre sub heading of physical. Assign a TotalityStim source contact collision intensity 7,add the script of PlayerFrob, add the physics to enable falling, and you can change the Shape->ModelName to 'hamscroll' like a recipt, then save the gamesys. Doing this or using the one from a previous gamesys, create two Receipt's in the object room, SpeedRec and MasterRec. Use properties to change their individual loot values to be -60 for the speed potion and -150 for the healing potion. As before, add another receptron to the corresponding potions on the table that create a clone of their receipt's at StartChute1, and edit the effect so that the teleport is slightly displaced so that they do not collide - 1 in x and z for instance. Then modify the banner at the bottom of the chute so that it frobs any object with an intensity of 6 to 8 and the receipts will transfer to the inventory when they collide with it. Now, add another receptron to the potions on the table. When they receive the stim they stimulate target Purse, agent Me, TotalityStim source, Then Add the corresponding MINUS 'price'. If you now go in to the game and buy a healing potion, the flowerpot should go closer to the bottom of the chute.

Now, we need to implement the blocking mechanism. To do this, add a source to the flowerpot, TotalityStim, trigger mode Radius, intensity -2. Make sure that the bottom marker is directly in line with the flower pot in x and y value terms, and then add a receptron to the bottom marker, scanning for intensity -2, effect is to teleport the KillObject banner, 'Block' to the BlockTarg marker, remembering to edit the effect and change the bank to 90 so that it doesn't vertically reset. Go back and modify the source on the tally flowerpot, and click first on Shape Data, and change its radius to the distance between the bottom end emptry markers plus a -0.2 error. (0.1 x max_cost, remember?) in my case 14.8. Then click on edit lifecycle, add the no max firings flag, and change the period to 3000. Now give it a go. Theoretically the banner should teleport in when you go below 0, but it probably kicks in slightly too late We need to increase the time it spends falling, and the best way of doing this is adjusting that rooms gravity properties. Create a new type of room under object hierachy, (change to rooms via the scroll bar) add your room under the main header and name it LowGRoom, and say yes to concrete room? Then, edit your new room and add Room->Gravity, and choose a low value, 10% lets say. Now, save your mission as new rooms do not require a modified gamesys, and then create the lowg room around the chute (the same way as you would an object, not via shift-insert). The setup will now acheive what the previous one could, when you run out of money, you can no longer buy anything and it will still not reset, but that can be easily fixed.

Now, the assumption is that once you have run out of money, you will have to leave the shop/store area, and you will have to return later after getting some more loot. All we need to do is to have an area trigger that teleports the Block banner away when you pass through it. To do this, create a bounds trigger on the entry route to your store, and name it Reset (Object->fnord->Marker->BoundsTrigger). When you walk through this area it will trigger a teleport trap, so create a teleport trap in the blue room roughly were the KillBounds banner originally is, name it BlockReset, and then link the bounds trigger to it via a CD link, and then a link from the teleport trap to Block to tell it to teleport Block. The block should now reset when you approach the store. The idea is that if you still have no money left, then the block will teleport back again by the time you reach the sales stand, if you have got enough money then the banner won't teleport back!

In actual level terms this should be easy, as loot will probably not be close enough and you can use multiple bounds triggers, but in this example level, place the bounds trigger a reasonable distance from the store, and then we can create the loot on the other side. On the level accompaying this tutorial, I created a corridor leading to another room which will be a treasure room. When adding loot to the system remember that if you pick up a sourced object the link is not triggered so you have to use a 'dummy object' which can't be picked up which transfers the object to your inventory and then destroys itself as well as stimulating purse. As all open loot will have this, it is probably a good idea to add your own archetype, you can either create a new one for each subtype, or simply have one general use one where you change the modelname. In the gamesys for the tutorial level it is called Dummy and exists under lucre. Add Frobinfo and deselect move and select script, and you may as well add a Totality Stim source level 3 contact frob in world to save having to do that every time as well. Also, you might want to add the script PlayerFrob to the other loot archetypes that will get transferred to your inventory rather than adding that every time as well. Next add tbe actual loot you want to create in a blue room somewhere, modifying the loot settings as appropiate and trying to stick to the multiples you assigned to purse. Add the script PlayerFrob if you haven't done so to the archetypes, then create a dummy object for each piece of loot where you want it to be picked up from in the level. The source is already on the dummy, so all is needed is to add the three receptrons, one to frob the target loot object, one to stimulate the purse the correct amount, and finally one to destroy itself. You may want to assign the last to the archetype again as it will always be present but the other two need specific targets. This dummy technique only applies if a piece of loot is 'free', if contained inside a chest you don't need it, remember to use the same system as in the previous tutorial with the relay and destroytrap.

Also, remember that you can use multiples of the numbers you defined. I want to add 150 in gems on a table in my tresure room, but I only haven't got a corresponding receptron. What do I do? I stimulate purse for 100, and then for 50.

As it stands, there are two problems with the system. Overshoot, and empty purse syndrome though they are both connected. Overshoot I use to describe nifty players who click rapidly when buying something. This will release a stream of objects, and each object will cause the tally pot to be teleported further and further down. Once it has gone out of range of the receptron/source pair, then buying is enabled yet again.

To fix this, we need to essentially 'bin' any surplus objects created until we have cycled the current one, and to make sure that the marker doesn't drop to below where it should. The bin feature is done by creating another chute, with another banner aptly named rubbish, and then to set a receptron on the banner the destroys any totalstim that hits it. Then create a marker at the top called StChuteTarg, and one near where the two start chute markers originally were called StartChutes. The system will essentially teleport the marker to the bin chute after the objects have been teleported to them. Add two markers which will control this teleport process,TeleIn and TeleOut, and assign a receptron to each. For TeleOut the receptron is to teleport StartChute to StChuteTarg, and TeleOut is to teleported StartChute to StartChutes. Then add a another receptron to the two potions on the table, to stimulate TeleOut TotalityStim, no max, etc. Next is a another receptron on TrigSale, the banner that teleports the objects to the store and on Block. If either of these two are triggered it means that a sale test has been completed, so the markers have to be teleported back so the receptron should stimulate TeleIn.

By itself, this is not a full fix, as we need to somehow inhibit the displacement of tally. One of the ways of doing this is to create a marker called TallyMirror which mirrors the place of Tally (same co-ordinates). The idea is that when Tally is displaced (whenever purse receives an stim), then the teleport is referenced from TallyMirror, not Tally. So no matter how many times you buy a potion, it will always teleport to the same place until TallyMirror is moved somehow. We only really need to change the teleport values for the negative stims, as these are the only ones that could cause problems (as there's no upper limit on looting!). Do this now, changing the receptrons on teleport so that for the negative entries the agent is TallyMirror. Next we need to teleport TallyMirror to tally if the sale is on by adding a receptron on TrigSale that does that, and to teleport Tally to TallyMirror if the sale is cancelled. (Remember target is the object to be teleported, agent is where it is going to go). The final thing is to teleport TallyMirror to Tally whenever you gain loot.

The easiest way of doing this would be to link it in to the BoundsTrigger. We can turn the Tally Pot into a teleport trap by adding the script 'TrapTeleporter' to it. Then, link in a CD link from Tally to TallyMirror, and then from the BoundsTrigger to Tally. This does not solve the empty purse problem. If you try to buy the healing potion and fail, you can't buy the speed potion until you go back out and re-enter the room. A way around this, is to teleport the block out automatically after the last object has dropped on to it. This will only work if you're teleporting the receipt to a higher place than the potion, which should be the case if you followed the tutorial perfectly (remember setting the z values when teleporting the receipt in edit effect?). Assuming this is the case, add yet another receptron to the kill object banner, that teleports it out when it receives a receptron form 6 to 8, (i.e back to ResetBlock). As only one object can go through at a time the block will have plenty of time to kick in.

But this still does not work fully. The problem this time is that if you try to buy an object that you can't afford, and then try to buy an object that you can, then the tally will be teleported back in to the positive range while the more expensive object is still falling. The simplest way to fix this is to change the lifecycle of the source on Tally so that it fires every half second or every second. You could implement a workaround which doesn't need this time to be increased, but that adds a lot more complexity. If you do wish to try, the problem is how to inhibit the purse stimulation once it has fired once. You could either create another chute mechanism or muck about with metaproperties, but changing the lifecylce to 500 is the simplest.

You now have a fully functional permanant store system. The only possible limitation is if you start selling objects of very small amounts of gold, or start picking up small amounts, but avoiding those sort of values shouldn't be any hardship. Another slight niggle is that the objects aren't transferred to your inventory, as my method using playerfrob can't work with edible objects would consume them, making them appear in a table is all well and good, but after buyng too much you start to stack objects, to get around this on my level everytime I teleported an object to the marker, I also moved the marker along slightly.

In the tutorial level the store is set up as described, but with a bit more loot and two lockpicks to buy.

(Back to Top)

Download the fullstor(271k) NOW!!!!!!
While stocks Last!

Overview of Process:
This section is everything listed out with no explanation, and everything correct first time. The names that I use for the objects are marked by brackets, if a naming convention is used it will refer to the healing example, the speed example, and then the generalised example.

Entries in Object Hierachy.

TotalityStim Act/React entered. Avatar->Garret. Modifed to have a receptron on that whenever it receives a TotalityStim, stimulates the source by 10.

New 'Totalitied' versions of the objects to be bought. Exist under the subtype of the object to be created, they have a TotalityStim level 3 contact collision on them, also, Physic Attributes is added if not already present to engage gravity. [BuyHeal, BuySpeed....BuyOBJECT)

New object (Receipt). Exists under the subtype of Treasure->Loot->Lucre. TotalityStim Source level 7, contact collision. Extra script added 'PlayerFrob'. Model->Shape Name->hamscroll.

New object (Dummy). TotalityStim Source intensity 3, contact Frob In World. Receptron, 0 min no max, effect to Destroy Object, target Me. Frobinfo added to Script,none,none.

New Room Type. LowG room, subtype under default room. Room->Gravity 50%.

Setup Necessary Objects:-

Copies of the equipment you want to be bought placed in you 'shop'. (BHeal, BSpeed...BOBJECT)

A marker near these objects where you want them to appear. (StoreTarg)

1st Blue Room (30 units of height or so)

Contain a banner at bank 90. (TrigSale)
Two Makers at top of room. (StartChute, StartChutes), placed above banner.
Actualy Room type is LowG.

2nd Blue Room for Objects.

Banner (Block)
TeleportTrap where Banner is (ResetBlock)
FlowerPot (Purse)
One of each new object archetype made, i.e. BuyHeal, BuySpeed. (MasterHeal, MasterSpeed....MasterOBJECT.)
A receipt for each sellable object that has a different price. (HealRec, SpeedRec....OBJECTRec)
Objects for each piece of loot in your level.
Two Markers, (TeleIn, TeleOut)

3rd Blue Room, to mirror avalaible money.

Height is (Max amount of loot on level x 0.1 + maxpricex0.1 + 20).
Marker (Bottom) height of bottom is small, about 5. Marker (Empty) height above Bottom is (0.1 x maxprice)
Marker (TallyMirror), height above Empty is (0.1 x startingloot)
Flowerpot (Tally) same co-ords as TallyMirror.
All the above should have the same x,y values.

4th Blue Room, the disposal chute.

Height 12.
Marker at top (StChuteTarg)
Banner at bottom pitch 90 (Rubbish)

Elsewhere

BoundsTrigger (Reset) on approach path to shop, you must not be able to get to the shop without trigger it.
Dummy objects for every piece of open loot in the level that can be picked up first time.

Properties of Objects.

Bheal, Bspeed

FrobInfo added, Script,None,None. TotalityStim source intensity 3, contact Frob in World.
4 TotalitySim receptrons, 0, no max.
Effects:-
Stimulate Object, Target:Purse Agent:Me Edit Effect Stimulus:TotalityStim Then Add 'negative cost of object' (i.e -60)
Create Object, Target MasterOBJECT, Agent StartChute.
Stimulate Object, Target: TeleOut, Agent:Me Edit Effect Stimulus:TotalityStim Then Add 3.
Create Object, Target OBJECTRec, Agent StartChute. Edit Effect, X:1, Y:0, Z:1.

TrigSale

4 Receptrons, all TotalityStim.
Range and Effects:-
Min 6 Max 8, FrobObject Target: Source.
Min 0 Max 5, TeleportObject, Target:Source, Agent: StoreTarg
Min 6 Max 8, StimulateObject, Target:TeleIn, Agent: Me, Stimulus:TotalityStim, Then Add 3.
Min 0 Max 5, TeleportObect, Target: TallyMirror Agent:Tally

Block

4 receptrons, all TotalityStim.
Range and Effects:-
Min 0 Max None, DestoyObect, Target:Source.
Min 6 Max 8, TeleportObect, Target: Tally Agent:TallyMirror
Min 6 Max 8, StimulateObject, Target:TeleIn, Agent: Me, Stimulus:TotalityStim, Then Add 3.
Min 6 Max 8, TeleportObect, Target: Me Agent:ResetBlock

ResetBlock

Links, ControlDevice, to Block

Purse

Many receptrons, depending upon how many different quantities of loot you want to be picked up.
Example for 100 gold:-
Min 99 Max 101, TeleportObject, Target:Tally, Agent:Tally, EditEffect X:0 y:0 z:(100/10=10)
And receptrons for every diffent price you have, example for potion that costs 60.
Min -61, Max -59, TeleportObject Target:Tally, Agent:TallyMirror, EditEffect X:0 Y:0 z:(-60/10=0.6)

Bottom

Receptron, TotalityStim, Min -3, Max -1. TeleportObject, Target: Block, Agent:BlockTarg Edit Effect Bank 90.

Tally

Script Addeed, 'TeleportTrap'.
Physical->Attributes->gravity set to 0
ControlDevice link to TallyMirror.
TotalityStim source, intensity -2, Radius, Edit Shape Radius (MaxCostx01), Edit Life Cycle, No Max firings and period 500.

Rubbish

Receptrons: TotalityStim, min 0 no max. DestoyObject Target:Source.

Reset

2 Control Device links.
One to Tally, one to ResetBlock.

Dummy Objects

Change Modelname to be that of the loot you want to pick up.
2 receptrons, min 0 max none.
Frob Object Target: The loot you wish it to mirror.
StimulateObject Target:purse Agent:Me, Edit Effect, Stim TotalityStim, Then add 'ammount of loot/10'.

(Back to Top)

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.
  • Source and Receptrons cannot do everything. One part missing is that they cannot add links or remove links between objects, and adding and removing metaproperties sometimes results in a mess. The easiest way to get around this is to start up a conversation, or use an AI watchobj technique instead.
  • The quickest way to transfer from a frob to a receptron is to setup an emitter, add the ReloadTweqEmitt script so that it can fire more than once, and then set up a door with a pokestim receptron on it. This can only be used for specific object to object frobs, not general ones.
  • With a system such as this life gets very complicated. Check, check and recheck before being happy that it works, and if one of my settings does not work for you, think of a workaround.
If you need help, write me, totality@ridge7.demon.co.uk or go to the Forum, http://www.ttlg.com. And if you don't want to be labeled as a newbie, use the Forum's search function first!

 

(Back to Top)