 |
fightcancer Beginner
Joined: 01 Nov 2004 Posts: 17
|
Posted: Wed Nov 03, 2004 4:15 pm
Need help with automating movement |
Wow!!! omg! may I first say what an incredible forum this is! I was so excited to find a community discussing scripts. I LOVE trying to automate my character in Medievia. Unfortunately, I'm not very good at it.
I'm trying to get an Opal Ring in the Graveyard with high stats (silver pendants too) so I wrote a script to autokill the monsters (using triggers) and now am trying to make him move around instead of just standing there.
yes, that's right. Before, he would just stand there and wait for monsters to enter the room. I even got him to follow the vampire bats and apparitions to induce some movement.
Now I want to make him walk around randomly without leaving the graveyard. Also, I don't want him to go up or down. The problem is that he won't change directions. He just starts marching one direction and won't ever change. I'm sure I need to change a number of things.
Here's what I have so far. Feel free to be as constructively critical as u want. TIA!!!
Code: |
#CLASS {AutoMove|AutoWalk}
#VAR PossibleDirections
#VAR ChosenDirection
#VAR DirectionCount {0} {0}
#ALIAS ClearDirections {#VAR DirectionCount 0;#DELITEM PossibleDirections North;#DELITEM PossibleDirections East;#DELITEM PossibleDirections South;#DELITEM PossibleDirections West}
#KEY {ALT-CTRL-K} {#SA Count;#SA @DirectionCount;#SA Possibilities;#SA @PossibleDirections;#SA Chosen;#SA @ChosenDirection}
#ALIAS PickDirection {#WA;#VAR ChosenDirection {%item(@PossibleDirections,%random(1,@DirectionCount))}}
#TR {^+--------------~[The Northeastern Corner of the Graveyard~]---------------+} {#SA NE;#WA 999;ClearDirections;#VAR ChosenDirection {%item("South|West",%random(1,2))}}
#TR {^+--------------~[The Southwestern Corner of the Graveyard~]---------------+} {#SA SW;#WA 999;ClearDirections;#VAR ChosenDirection {%item("North|East",%random(1,2))}}
#TR {^+--------------------~[The Entrance to the Graveyard~]--------------------+} {#SA S;#WA 999;ClearDirections;#VAR ChosenDirection North}
#TR {^Obvious exits:$} {#GAG;ClearDirections;PickDirection}
#TR {^North - *} {#ADDITEM PossibleDirections North;#ADD DirectionCount 1}
#TR {^East - *} {#ADDITEM PossibleDirections East;#ADD DirectionCount 1}
#TR {^South - *} {#ADDITEM PossibleDirections South;#ADD DirectionCount 1}
#TR {^West - *} {#ADDITEM PossibleDirections West;#ADD DirectionCount 1}
#TR {^A bat leaves %1.} {stand;#GAG;%1}
#TR {^An apparition of mist leaves %1.} {stand;#GAG;%1}
#TR {^A zombie leaves %1.} {stand;#GAG;%1}
#TR {^A spectral wraith leaves %1.} {stand;#GAG;%1}
#TR {^The ghost of a soldier leaves %1.} {stand;#GAG;%1}
#TR {^An animated skeleton leaves %1.} {stand;#GAG;%1}
#TR {^A* has arrived.} {stand;#GAG;l;#GAG}
#TR {^The * has arrived.} {stand;#GAG;l;#GAG}
#CLASS 0
#CLASS {AutoMove|AutoWalk|Move}
#ALARM "Walking" %random(5,9) {@ChosenDirection}
#CLASS 0
#CLASS Move 0 |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Nov 05, 2004 8:22 am |
This #ALIAS can be shortened:
Code: |
#ALIAS ClearDirections {#VAR DirectionCount 0;#VAR PossibleDirections {}} |
I don't see why #WAIT is needed in this alias:
Code: |
#ALIAS PickDirection {#VAR ChosenDirection {%item(@PossibleDirections,%random(1,@DirectionCount))}} |
These 2 triggers should be able to be eliminated entirely:
Code: |
#TR {^+--------------~[The Northeastern Corner of the Graveyard~]---------------+} {#SA NE;#WA 999;ClearDirections;#VAR ChosenDirection {%item("South|West",%random(1,2))}}
#TR {^+--------------~[The Southwestern Corner of the Graveyard~]---------------+} {#SA SW;#WA 999;ClearDirections;#VAR ChosenDirection {%item("North|East",%random(1,2))}} |
#WAIT should not be used in triggers ever. There is a document in the support library about it.
Code: |
#TR {^+--------------------~[The Entrance to the Graveyard~]--------------------+} {#SA S;ClearDirections;#VAR ChosenDirection North} |
Of course this will cause a conflict when the 'Obvious exits' trigger fires. I would suggest turning that trigger off with #T- then back on with an #ALARM.
How can this "PickDirection" when no PossibleDirections are set?
Code: |
#TR {^Obvious exits:$} {#GAG;ClearDirections;PickDirection} |
Try moving the PickDirection into your movement #ALARM.
The use of %1 is not supported in trigger patterns. Adjust all these triggers to:
Code: |
#TR {^A bat leaves (%w).} {stand;#GAG;%1}
#TR {^An apparition of mist leaves (%w).} {stand;#GAG;%1}
#TR {^A zombie leaves (%w).} {stand;#GAG;%1}
#TR {^A spectral wraith leaves (%w).} {stand;#GAG;%1}
#TR {^The ghost of a soldier leaves (%w).} {stand;#GAG;%1}
#TR {^An animated skeleton leaves (%w).} {stand;#GAG;%1} |
Minor syntax correction in your movement alarm:
Code: |
#ALARM "Walking" {*{%random(5,9)}} {@ChosenDirection} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|