Conveyor belt

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Conveyor belt
Shock Trooper
Member # 10488
Profile #0
I'm trying to create a terrain script which makes a space act like a conveyor belt. It works, but there's one problem: when several conveyor spaces are chained together, you are taken instantly to the end of the chain rather than being pushed a single space. Is there any way to fix this? I thought of setting an SDF which is reset in, say, the scenario start state, but then only one belt space would operate per turn.

My code:
if (char_on_me() == -1) end();
willPush = 1;
// If hasted, the character may not be pushed.
if (get_char_status(char_on_me(),3) > get_ran(1,1,100)) willPush = 0;
// If flying or hovering feet, the character will not be pushed.
if (get_char_status(char_on_me(),25) > 0 || get_char_status(char_on_me(),27) > 0) willPush = 0;
if (willPush == 1) {
print_named_str(char_on_me()," is pushed!");
relocate_character(char_on_me(),xTarget,yTarget);
force_instant_terrain_redraw();
}
(It's in the START_STATE.)

[ Sunday, December 16, 2007 18:48: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Lifecrafter
Member # 6193
Profile Homepage #1
I'm pretty sure you could do this in the town start_state, thus eliminating the need to lay down tons of terrain scripts. Run a check for each NPC, seeing if they are on a conveyor belt. If they are, move them one space forward (in either the +- x or +- y depending on what direction belt it is.) Make sure the belts' blockage are defined so that you can't walk backwards on them.

--------------------
"NOW PASS ME MY BOOTS. I HAVE AN APPOINTMENT WITH A FACE." -Nikki

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Shock Trooper
Member # 10488
Profile #2
Well... I never thought of this. Only one minor problem – I wanted to be able to set an SDF to turn it off (so it stops pushing). However it's fairly unlikely I'll have two completely separate conveyor networks in the same town, so that shouldn't be a significant problem.

I actually made the terrain script be set automatically, but I still had to go through and set the direction appropriately.

I wonder... could I make this work outdoors?
Posts: 334 | Registered: Friday, September 14 2007 07:00
Lifecrafter
Member # 6193
Profile Homepage #3
If you wanted to turn off a conveyor belt and leave others on, you'd have to swap the entire belt to a different 'dummy' belt, which would look the same but be a different number that isn't recognized in the start_state as being a belt, and thus wouldn't push people.

I don't think it'd work outdoors, since you can't get the x,y loc of the party to check what floor they're standing on, and can't use the terrain script method either.

--------------------
"NOW PASS ME MY BOOTS. I HAVE AN APPOINTMENT WITH A FACE." -Nikki

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Shock Trooper
Member # 10488
Profile #4
Or I could use my original method - the SDF - if I simply wanted to disable all belts in the town.

By the way, what's the maximum number of creatures in a town? And the max num of items?

Edit: There's no way to iterate through all items in the town like you can do with creatures, is there? :(

Edit: It's telling me there is "syntax error [statement" (ALint) or "Bad term in expression" (Avernum) on line 39. That's the "south" line in the INIT_STATE:
variables;

short xTarget,yTarget,willPush,i,j;
// Constants
short north,east,south,west,nw,ne,se,sw;

body;

beginstate INIT_STATE;
// Set the constants
nw = 0;
ne = 0;
se = 0;
sw = 0;
north = 474;
east = 476
south = 477;
west = 475;
set_ter_script_mode(ME,3);
break;
This makes no sense at all.

[ Monday, December 17, 2007 12:26: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Agent
Member # 5814
Profile #5
The "east" line is missing a semicolon.

Maybe an SDF could be used to chart whether a belt has moved a player yet, with one for each player (6). Set them to a number after moving a player, and reset them every turn. If you want the belt to stop you can set all the SDFs to the inactive value.

Will monsters also need to walk on the belt?

--------------------
It's just trying to say hi!
Posts: 1115 | Registered: Sunday, May 15 2005 07:00
Infiltrator
Member # 5576
Profile Homepage #6
The maximum is 120 creatures, I think, and something like 144 items, but move_item_on_spot is probably your best bet for items.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 7662
Profile #7
Looking at the 3D source file Global.h around line 65 gives all of the limits, this agrees with Editor help file. In particular, you can only place eighty monsters, the other 34 slots are reserved for summonings.

Edit: as it so happens the Blazing Blades produced good conveyor belt graphics.

[ Monday, December 17, 2007 14:43: Message edited by: Ishad Nha ]
Posts: 292 | Registered: Monday, November 13 2006 08:00
Infiltrator
Member # 5576
Profile Homepage #8
80 placed creatures + 34 summoned + 6 party members = 120 charcters in the town.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 10488
Profile #9
quote:
Originally written by Calphrexo:

The "east" line is missing a semicolon.
Whoa – how'd I miss that?

quote:
Originally written by Calphrexo:

Maybe an SDF could be used to chart whether a belt has moved a player yet, with one for each player (6). Set them to a number after moving a player, and reset them every turn. If you want the belt to stop you can set all the SDFs to the inactive value.

Will monsters also need to walk on the belt?

Actually, for the characters I'm going to check each character in turn to see if they are on a belt, so that monsters/NPCs can be affected by them - provided they aren't blocked.

quote:
Originally written by Ishad Nha:

Edit: as it so happens the Blazing Blades produced good conveyor belt graphics.
I've seen the graphic you mean (based on the original Exile graphics), but I had already made my own at that time. However, I will likely switch at some point as mine is really bad.

quote:
Originally written by Niemand:

The maximum is 120 creatures, I think, and something like 144 items, but move_item_on_spot is probably your best bet for items.
Originally written by Niemand:
80 placed creatures + 34 summoned + 6 party members = 120 charcters in the town.
Thanks. I was assuming 250, but clearly I was wrong.

Now I just have to figure out a way to ensure a specific pile of items is only pushed once per turn... The easiest way would be to work backwards along the chain, but that would require different code for each town that uses conveyors. I'll do it if I can't think of a better way, though... I have a suspicion that this is actually the only way it could work.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Infiltrator
Member # 5576
Profile Homepage #10
quote:
The easiest way would be to work backwards along the chain, but that would require different code for each town that uses conveyors.
About a year ago I worked on this for some time, and I concluded that a unique script for every town was the only practical way. One major reason is that even if you make sure that you only move each character once, how you you correctly handle things that are next to each other on the conveyor, or when one goes off the end, stops, and the others can't move forward?

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00