 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Thu Jun 05, 2003 2:11 am Post subject: Jump script |
|
|
Quote: | script,Jump,Y,ID,begin #Script for jumping off ledges
suspend player
suspend obstruction
suspend hero walls
set hero speed(ID,10)
walk hero to Y(ID,Y)
set hero picture(ID,(get hero picture(ID))+3)
wait for hero(ID)
set hero picture(ID,(get hero picture(ID))--3)
set hero speed(ID,5)
resume player
resume obstruction
resume hero walls
end |
Okay.. Basically what this script is supposed to do is set the hero "ID" to a jumping pose and make it jump off a ledge or something to Y, upon reaching which the hero gfx is set back to the original walkabouts. Problem, obviously is that it doesn't work. Mostly I use this script with NPCs, whose script variable is set to the Y value in the script (ID is 0 in default), and basically it's not working for me, whether if I'm using the script from an NPC or calling on it in a story script. Funny thing is.. the script worked fine before I added in the ID variable.
Quote: | script,Jump,Y,begin #Script for jumping off ledges
suspend player
suspend obstruction
suspend hero walls
set hero speed(0,10)
walk hero to Y(0,Y)
set hero picture(0,(get hero picture(0))+3)
wait for hero(0)
set hero picture(0,(get hero picture(0))--3)
set hero speed(0,5)
resume player
resume obstruction
resume hero walls
end |
And no, I didn't forget to add the variable stuff to the define script thing. Any help on this would be thanked for. _________________ im realy ded  |
|
Back to top |
|
 |
Blazes Battles Inc. I'm a chimp, not a
Joined: 25 Jan 2003 Posts: 505
|
Posted: Thu Jun 05, 2003 8:01 pm Post subject: |
|
|
You're using arguments up there to make the script an actual command, if I'm not mistaken. Well, if you put in the number of the hero you want to use in as the argument, it will not change the graphics of that hero, but the graphics of the hero who is in the party in the #th position. In the script in all places you used 'ID,' switch 'ID' to 'find hero (ID)'. Also, in the script, 'ID' is an argument, not a variable, so you don't need 'ID' defined as a variable at all. Having it as one may actually mess up the script, I'm not sure. _________________ Preserve OHR history! Do it for the children! |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Thu Jun 05, 2003 11:20 pm Post subject: |
|
|
Yeah, but the default argument for ID is 0, which should be the same as if I used "me", shouldn't it? _________________ im realy ded  |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Jun 06, 2003 1:15 am Post subject: Re: Jump script |
|
|
Sephyroth wrote: |
Okay.. Basically what this script is supposed to do is set the hero "ID" to a jumping pose and make it jump off a ledge or something to Y, upon reaching which the hero gfx is set back to the original walkabouts. Problem, obviously is that it doesn't work. Mostly I use this script with NPCs, whose script variable is set to the Y value in the script (ID is 0 in default), and basically it's not working for me, whether if I'm using the script from an NPC or calling on it in a story script. Funny thing is.. the script worked fine before I added in the ID variable.
|
I can explain this particular wierdness.
You trigger this script from NPC's mostly, right? Soy you talk to an NPC, and it trigger's the script, and it uses the NPC's script argument as the Y value. so far so good.
...except it doesn't work. Why? because the second argument, the hero's ID numbe ris NOT really being left blacnk. it is not defaulting back to 0 (or me)
This is because any script triggered from an NPC automatically gets the NPC's ID number as its second argument.
So any script called from an NPC is effectively the same as:
Code: |
script name (npc's script argument,NPC reference(the NPC you talked to))
|
There are a couple ways to fix this problem. One is to hard-code 0 or "me" into the script. That is nice and easy, but you lose the ability to make other hero's jump if you want to.
Another method is to add a dummy argument:
Code: |
script,Jump,Y,dummy,ID,begin #Script for jumping off ledges
suspend player
suspend obstruction
suspend hero walls
set hero speed(ID,10)
walk hero to Y(ID,Y)
set hero picture(ID,(get hero picture(ID))+3)
wait for hero(ID)
set hero picture(ID,(get hero picture(ID))--3)
set hero speed(ID,5)
resume player
resume obstruction
resume hero walls
end
|
that works, but it is kinda tacky.
What I think I would do personally, is to write a second wrapper script, like so:
Code: |
script,Leader Jump,Y,begin
jump(Y,me)
end
|
And use that once for any situation where a jump is triggered by talking to an NPC. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can 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
|
Powered by phpBB © 2001, 2005 phpBB Group
|