help with simple fighting system

Started by hawanja, Sat 22/05/2004 07:22:12

Previous topic - Next topic

hawanja

Hi guys, I'm making a game called "Brain muncing freaks." I what I want is for when you click on the zombie character, the hero (biffy) goes through a punching animation, and if they are colliding during the animation the zombie loses a hit point. I want to do this with click on any character.

Biffy (player) is character 2

So in the zomibe (character 3)  interaction I have :

  // script for character3: Any click on character

//the punching animation
AnimateCharacter(2,8,1,0);
biffpunch+=1;

// sets a timer which returns biffpunch to 1
if (biffpunch==2){
     SetTimer(1,40);{
    biffpunch-=1;}}

//if biffpunch is 2 and characters are colliding, the zombie loses a hit point
if ((AreCharactersColliding (2, 3)==1) && (biffpunch ==1))
{zombiehealth-=1;}

//and of course here the zombie dies
if (zombiehealth ==0){
  AnimateCharacter (3, 6, 3, 0);}

The game saves without any errors, however when I try to test it I get this message:


Error: prepare_script: error -2 (no such function in script) trying to 'run room_a' (Room 9)

where room 9 is of course, the room with the zombie in it.

any suggestions on what I'm doing wrong?

I would also like to change the player character animation so he's punching at the zombie. I used to know how to do this, just forgot. Something like

if {character.x>character.x} then
animatecharacer(blah blah blah);

any help would be appriciated.

Pumaman

Have you been manually editing the room script at all? Load room 9 into the editor, press the "Interactions" button on the Room Settings pane, and make sure there is actually a script there for each "Run script" interaction you have.

hawanja

So I should put this into the room script and not the zombie character script? I'll try that.

Pumaman

No, the error looks like a function is missing from the room script - have you been manually deleting things from there? Don't add it in, just check that the room interactions are ok, like I said

hawanja

I moved the two characters to a different room and it worked fine. But I can't see what's wrong with room 9.

Thanks

Pumaman

Have you done what I suggested? Do all the room interactions in room 9 have a script correctly associated to them? Can you open all the scripts there in the ediotr?

hawanja

Yeah, I figured out the problem in room 9. I had a (crappy) QFG style fighting system before but was unhappy with it, and had a repeatedly execute command  in room 9. Forgot to delete it and that was causing the error. But it's fixed now.

Thanks for your help

SMF spam blocked by CleanTalk