View previous topic :: View next topic |
Author |
Message |
Mortem Monkey

Joined: 19 Sep 2003 Posts: 19 Location: Deep in to the recesses of your mind.
|
Posted: Sun Oct 26, 2003 11:11 am Post subject: A bit o help if you please |
|
|
I've been trying to write a script that will walk an npc to a square next to your hero and then start a battle. The thing is I need this to work from five differant locations and I cannot figure out how to do this with scripts, short of writing five different ones. Can anyone help me?[/quote] _________________ If you don't believe that God has a sense of humor then you explain the french! |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sun Oct 26, 2003 11:13 am Post subject: |
|
|
Yeah, I'll help.
"n" means that you need to replace it with the proper number value.
First, you need to define two global variables. We'll call them position x and position y. This happens in the declarations at the top, right after you define your scripts...
Code: | global variable (n,position x)
global variable (n,position y) |
Then, you need a script that uses these to record the hero's position. This would go in the "eachstep script" space in the map properties. Don't forget to define this script.
Code: | script,position record,begin
set variable (poition x,hero x (0)) #recording the hero's x position into the position x global
set variable (position y,hero y (0)) #doing the same for y
end |
Then just use it.
Code: | walk npc to x (n,position x--1) # it subracts one so that the npc ends up right next to the hero instead of on top of him. If all goes well, it should end up one space to the left of the hero.
walk npc to y (n,position y)
wait for npc
fight formation (n) |
Now, this off course assumes quite a bit about the map the npc is on, so it might need a little tweaking to take into consideration the obstructions between the npc and hero, which side of the hero the npc is on, etc, but hopefully you get the general idea.
Last edited by Uncommon on Sun Oct 26, 2003 11:31 am; edited 2 times in total |
|
Back to top |
|
 |
Mortem Monkey

Joined: 19 Sep 2003 Posts: 19 Location: Deep in to the recesses of your mind.
|
Posted: Sun Oct 26, 2003 11:28 am Post subject: |
|
|
Thanks! If this works I'll put your name down in the credits as Plotscripting consultant. _________________ If you don't believe that God has a sense of humor then you explain the french! |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sun Oct 26, 2003 11:32 am Post subject: |
|
|
Shrug. Okay. Just remember what I said about how it might need a bit of tweaking depending on certain conditions. |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Sun Oct 26, 2003 11:57 am Post subject: |
|
|
A small pointer: You don't actually need the variables. Just use the herox(who) and heroy(who) functions, as they return the value that you want. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sun Oct 26, 2003 4:07 pm Post subject: |
|
|
Well, I suppose that's true, too. |
|
Back to top |
|
 |
|