View previous topic :: View next topic |
Author |
Message |
Bob360 Rusty Vet
Joined: 25 Mar 2003 Posts: 33
|
Posted: Wed Apr 02, 2003 9:20 am Post subject: no movement in order to run a script |
|
|
i need a way to make it so a script wont run if the character (during this part of the game your character is an npc) is moving...
the way it is setup...
your playing basketball and you press A to shoot but if you are moving it makes it so the ball wont dissapear so i need to make it so you have to stop and shoot inorder to shoot and also your character is an npc that you control (because your playing a game within a game). and i cant change the fact that the character is an npc |
|
Back to top |
|
 |
Aethereal SHUT UP. Elite Designer


Joined: 04 Jan 2003 Posts: 928 Location: Gone! I pop in on occasion though.
|
Posted: Wed Apr 02, 2003 11:01 pm Post subject: |
|
|
if(npc is walking(mynpc)==false) then(do stuff). _________________
 |
|
Back to top |
|
 |
Bob360 Rusty Vet
Joined: 25 Mar 2003 Posts: 33
|
Posted: Thu Apr 03, 2003 9:30 am Post subject: |
|
|
damn it!!! that wont work because my script is based off of what i learned from looking at james side scroll(sets the characters pixel) ... any other suggestions (JAMES HELP ME) |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Thu Apr 03, 2003 6:33 pm Post subject: |
|
|
That ought to work though. Although I'm quite sure you're using heroes and not NPCs to move the character around, right?
It's basically what Aeth typed, but a little differently.
if (hero is walking (me) == false) then (do stuff)
That ought to work. |
|
Back to top |
|
 |
Blazes Battles Inc. I'm a chimp, not a
Joined: 25 Jan 2003 Posts: 505
|
Posted: Thu Apr 03, 2003 8:20 pm Post subject: |
|
|
For pixel moving, just see if they are holding down the move button.
if (key is pressed (thekeytheypresstomove)) then () else() _________________ Preserve OHR history! Do it for the children! |
|
Back to top |
|
 |
Guest
|
Posted: Fri Apr 04, 2003 9:19 pm Post subject: |
|
|
Thank's ill try these and get back to you |
|
Back to top |
|
 |
Bob360 Rusty Vet
Joined: 25 Mar 2003 Posts: 33
|
Posted: Fri Apr 11, 2003 7:41 am Post subject: |
|
|
Its still wont WORK!!!! ARRRRRRGGGGG!!!! the problem is that the npc moves is still moving when the key is nolonger pressed... |
|
Back to top |
|
 |
Gizmog1 Don't Lurk In The Bushes!

Joined: 05 Mar 2003 Posts: 2257 Location: Lurking In The Bushes!
|
Posted: Sat Apr 12, 2003 7:04 am Post subject: |
|
|
I think I know what's happening. The npc keeps moving, because he's been told to, probably. Like, let's say, I hold the left key down for 5 seconds. Everytime the script runs through blah, blah blah blah if keysipressed, blah blah blah wait (1) it tells that npc to walk one more space left. But, it's going to add up, so if it's been told 5 times, and only walked 3 spaces, it'll keep on going. You need to add a wait for npc somewhere, to keep the script from starting to check again, before he's stopped moving. And that should do it. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Apr 18, 2003 6:57 pm Post subject: knowing if an NPC is moving using side-scroll.hss |
|
|
In a normal game, you can use the "hero is walking ()" and "NPC is walking()" plotscripting commands to know if a hero or NPC is already moving. However, if you are basing your plotscript on side-scroll.hss , then the normal movement has been overriden, and those commands will not help you.
Look in side-scroll.hss where it says:
define constant(100,Xv) # vars 100 to 399 are X velocity
define constant(400,Yv) # vars 400 to 699 are Y velocity
Xv and Yv are used for a "fake array" that holds the X and Y velocity of each NPC on the side-scrolling map. If the NPC's X velocity is 0 then that means it is not moving left or right. If an NPC's Y velocity is zero, that means it is not jumping or falling right now.
The tricky part is knoeing how to read and write the values in this "fake array". lets look at the code in side-scroll.hss for walking left and right:
#walking
if (want left, xor, want right) then(
if (want left) then(
# normal walking
write global(xv+player,read global(xv+player)--3)
if (read global(xv+player) <= -6) then(write global(xv+player,-6))
)
if (want right) then(
# normal walking
write global(xv+player,read global(xv+player)+3)
if (read global(xv+player) >= 6) then(write global(xv+player,6))
)
)
to set a value in a fake array, you say:
write global(first ID + this ID, value)
and to read a value from a fake array, you say:
read global(first ID + this ID)
But that is too confusing. That is too much like programming. Let me give you what you REALLY want, which is a nice easy way to know if an NPC in your side-scroller is moving or not.
define script(autonumber,SSNPC is moving,1,0)
script, SSNPC is moving, who, begin
if(read global(Xv+who)==0,and,read global(Yv+who)==0)
then(return(false))
else(return(true))
end
Just add that to your script, and use "SSNPC is moving()" in an "if" to know whether or not the NPC you are working with is moving. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Apr 18, 2003 6:59 pm Post subject: |
|
|
Wow. <pre> tags come out really ugly on this board. I should have used bbcode.
Code: |
define script(autonumber,SSNPC is moving,1,0)
script, SSNPC is moving, who, begin
if(read global(Xv+who)==0,and,read global(Yv+who)==0)
then(return(false))
else(return(true))
end
|
|
|
Back to top |
|
 |
Bob360 Rusty Vet
Joined: 25 Mar 2003 Posts: 33
|
Posted: Tue Apr 22, 2003 3:20 am Post subject: |
|
|
Thank you James...
This thing has been irratating me for SOOOOOOOOOOOOOOOO LOOOOOOOOOONNNNNNNNNNNNGGGGGGG!!!!....
This makes it look and run alot more smoother... :> |
|
Back to top |
|
 |
|