2 Questions, about doubleclickrun, and footstepsound

Started by Minimi, Wed 26/11/2003 21:12:21

Previous topic - Next topic

Minimi

Hey, I have 2 questions, on wich I can't find an answer.

Question #1  :

Is it possible to script that on user double click with walk icon, then the player turns to run animation and increases speed? And same when you click ones, turn to walk animation.

Question #2 :

In the view of the walkanimation of my character, I play a sound everytime the feet touch the ground. But is it possible to change this sound with a scriptcommand further in the game? Like first, she is walking on carpet, but later on she walks in the snow, and it wouldn't be right, if the sound was the same!

MrColossal

#1
// begin footsteps

if (GetGlobalInt(222)==0){
footsteptype = GetRegionAt(character[EGO].x,character[EGO].y);
SetFrameSound(1,character[EGO].loop,3,footsteptype);
SetFrameSound(1,character[EGO].loop,7,footsteptype+1);
}
// end footsteps

this is what i have

first add an int footsteptype; in your main script and then add sounds for each region.

for me region 0 and 1 are nothing, 2 and 3 are normal walking sounds, 3 and 4 are walking on wood and 5 and 6 are walking on gravel. the reason the global int is there is if i every want to disable footsteps for the main character then all i have to do is set global int 222 to 1

only problem i see with this [which is new i don't remember this happening in my RON game] is that sometimes with a movecharacter command the footsteps don't sound
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Kweepa

Right off topic, but are you still working on that eric?
Me want.
Still waiting for Purity of the Surf II

Scorpiorus

Quote from: Minimi on Wed 26/11/2003 21:12:21Question #1  :

Is it possible to script that on user double click with walk icon, then the player turns to run animation and increases speed? And same when you click ones, turn to walk animation.

You can try the next method:

#define DELAY_TIMEOUT 7
function interface_click(int interface, int button) {
 if (interface == <some gui>) {
   
   if (button == <walk icon >) {
     
     SetMouseCursor(6);
     int double_click = WaitMouseKey(DELAY_TIMEOUT)*IsButtonDown(LEFT);
     SetDefaultCursor();
     
     if (double_click) {
       // run
       SetCharacterSpeed(...);
       ChangeCharacterView(...);
       
               
     } else {
       // walk        
       SetCharacterSpeed(...);
       ChangeCharacterView(...);
     }
   }

}

You can adjust DELAY_TIMEOUT depending on the double click time out you need. Also SetMouseCursor() is necessary to override the default wait cursor image. You can change it as well.

How does it go?

SMF spam blocked by CleanTalk