ID:150371
 
If I wanted to have the game make a footstep sound every time the player moves or check for monster encounter every step, or even just << the direction to the usr, how would one go about it. I have looked in the help files, but unfortunately, I am still enough of a newbie that the code help is a bit ambiguous for me to understand it. I have tried several things in this line but nothing I try works.
mob/proc
showdir()
src << src.dir
mob/Move()
showdir()
..()
Look up Move(), and take a look at Zagreus's random battle lib or whatever its called.

Alathon
In response to Alathon
I did a cut and paste of the example LoW gave and then played with it. It is actually just what I needed.

See, when I first started to build AE, I used sleep to space out calls on the encounter/combat procs. It caused a ton of problems. Then I switched to using if(round(world.time/32) >= 4) at the top of the mob/Stat() proc as a means of timing the encounter checks. I have always wanted to do it based on the character's actual movement 8)

Thanks *)

Now that I have this I am on the track I wanted to be on. The next step for me is as follows. In AE, the more weight you carry, the slower you move. Most people have a move of 12. If you become lightly encumbered you lose a third of that, moderate is half movement, etc. I still havent a clue how I am going to do this. I have tried changing tick_lag but that's no good.

Any suggestions?
In response to Kidknee
Sleep or spawn inside the Move() proc

mob/Move(Loc)
if(src.weight > src.weight_to_encumber)
sleep(src.weight/10) // or whatever
return 1
return 1

Should work

Alathon
In response to Kidknee
Kidknee wrote:
I did a cut and paste of the example LoW gave and then played with it. It is actually just what I needed.

See, when I first started to build AE, I used sleep to space out calls on the encounter/combat procs. It caused a ton of problems. Then I switched to using if(round(world.time/32) >= 4) at the top of the mob/Stat() proc as a means of timing the encounter checks. I have always wanted to do it based on the character's actual movement 8)

Thanks *)

Now that I have this I am on the track I wanted to be on. The next step for me is as follows. In AE, the more weight you carry, the slower you move. Most people have a move of 12. If you become lightly encumbered you lose a third of that, moderate is half movement, etc. I still havent a clue how I am going to do this. I have tried changing tick_lag but that's no good.

Any suggestions?

The only times you'd want to use tick_lag is to slow the game processor down in response to extreme activity, or to make more (or less) accurate timing, probably in a single player game. My favorite way to control movement speed is to make a var called tmp/can_move = 1 on the mob, and then in client/Move() (you should probably put all of your special player movement effects here instead of mob/Move(), or things like teleportation and monster movement might get screwed up) you can check to see if the player can move:

if (can_move) //if the player can move
can_move = 0 //then they can't move again for a while
spawn(10 - speed) can_move = 1 // my own formula
..() //default movement business
In response to Alathon
I like that. I will have to see if I can work that in some how. What I am essentially trying for this:

Each space in my game on the overland map represents about 20 miles. I dont really have to put in a day/night cycle graphically, although I keep trying to. Essentially, each space you move represents a day, on a very basic level. However, I need to facilitate a "world clock" that allows people to keep in sync on the "world calender". In combat, every player will have a given speed. Most of the races have a 12 move, but the smaller races move 6. At the moment, I dont do the movement thing in combat, however, if I am to be successful with my game, I need to understand that which I have to implement. Version 1.12, which is up right now, does not include the per move time of day change that I just added.

Originally, at the top of the Stat proc under mob/player, I used world.time/32 as a timer. It was set so that when round(world.time/32) >= 4, it called Time_Of_Day(). Time of day simply increments tod to the next in the list (you dont wanna see my code for that trust me, it sucks). I have 6 time zones in a given day. Morning, mid_day, evening, dusk, mid_night, and dawn. Dependant on the time of day, and the type of terrain you are in, you will access a different encounter table for random monsters. This system also takes into account the "population level" of the square you have moved into. I have 3 pop levels in the system. Different communities of different sizes, and keeps/fortresses will alter the pop level. Pop levels are either "tame", "border", or "wild". A tame area will only produce a monster if a 1 is rolled on a d20. A border area will produce a monster if a 1 is rolled on a d12. A d10 is used to check for wild areas.

If you are in the plains near the smallest of villages in the frozen land of Skyshine, you check for a 1 on a d10, as the land surrounding the smallest villages is considered wild country, and if a 1 is rolled, indicating an encounter, the game rolls for the monster on the encounter table labelled "Skyshine". Skyshine is the default area as most of the country is wilderness and flat icy wastes. If you were on a hill square though, it would be "Skyshine_Hills_Wild". It is a fairly complex system, but I didnt devise it, I am merely trying to implement it. So yeah, I gotta figure out how do to it so that instead of each step being just a 4 hour section of a day, I need each step to represent a day. /shrug. We'll see how it pans out.

Actually, if any of you guys havent checked it out yet, I would value some input on what I have so far. If you know anything about Advanced Dungeons and Dragons, your appraisal of the work thus far would be invaluable. This game is based on my campaign world which I set up over 17 years ago. I have tons of content to implement but i have time. hehe.

byond://Kidknee.AE##version=1.12

I do appreciate the tips big time 8).
In response to Kidknee
Kidknee wrote:
Pop levels are either "tame", "border", or "wild". A tame area will only produce a monster if a 1 is rolled on a d20. A border area will produce a monster if a 1 is rolled on a d12. A d10 is used to check for wild areas.

You might be able to do this to simplify your random encounters. It is statistically true to the ad&d way, and since the players cannot see the encounter roll, they would be none the wiser.
THe lowest common denonimator of 10, 20 and twelve is 60.

make a list called control which references tame as 3, border as 5 and wild as 6.

60/3 is 20, 60/5 is 12 and 60/6 is 10.

so:
tame = 3
border = 5
wild = 6

then take your chance of an encounter as prob([control],60)

This way you can add more control areas easily, and use control as a reference to an encounter table.

Just a thought. Please, someone tell me if I'm on glue.