I am very new to the world of scripting, and am having a bit of a hard time understanding the language. I have gone through the first few tutorials for Sammy's Quest, which have been very helpful in helping me with the first few steps, ie creating the 'world' of 12 walkable rooms, making the first few interactive objects and so on. I have also read the tutorials on scripting, but if I am being perfectly honest, a bit of it went over my head. I am sure that with practice I will get it, but it can be frustrating trying to work things out when you are a beginner.
Something I need advice on:
When the player, Clancy, enters the 'cave entrance' room where Samuel is, I have got Samuel to walk to him, say his speech, then walk back and forth... but this only works the first time the player enters the room. Ideally, I would like Samuel to walk back and forth between two spots when he enters the room. Samuel spawns at 219, 200. I have tried functions such as
Code: ags
(before the below block of script)
but this seems to just freeze the character in place
Here is what I have at the moment.
Code: ags
If anyone could give me some guidance, that would be much appreciated. Thanks!
Something I need advice on:
When the player, Clancy, enters the 'cave entrance' room where Samuel is, I have got Samuel to walk to him, say his speech, then walk back and forth... but this only works the first time the player enters the room. Ideally, I would like Samuel to walk back and forth between two spots when he enters the room. Samuel spawns at 219, 200. I have tried functions such as
function room_RepExec() {
if (cSamuel.x==219)cSamuel.AddWaypoint(286, 183);
(before the below block of script)
but this seems to just freeze the character in place
Here is what I have at the moment.
function room_FirstLoad()
{
cSamuel.Walk(70, 197, eBlock, eWalkableAreas);
cSamuel.Say ("Stay out of the mine! It is dangerous!");
}
function room_RepExec() {
if (cSamuel.x==70)cSamuel.AddWaypoint(286, 183);
else if (cSamuel.x==286)cSamuel.AddWaypoint(161, 187);
else if (cSamuel.x==161)cSamuel.AddWaypoint(286, 193);
}
If anyone could give me some guidance, that would be much appreciated. Thanks!