Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - hawanja

#1
fabulous, works like a charm. Thanks very much.

Now I have to make weapons, and figure out a way to "arm" them. I suppose you'd do this through global variables and setting views. I'll post the whole thing once it's finished so you may all share my combat system.
#2
Hey guys, I have a WORKING simple combat system that where you click on the enemy and the hero throws a punch. I have the code under "any click on character," however it doesn't work when the cursor is in Walk mode. How do I change it so that it does?

I'd like to have it so that when you click on the zombie the hero throws a punch, even in Walk mode. As it is it only works in the other modes, which means you have to cycle through to the walk mode to move and then back to any other mode to fight, which works okay, it's just akward (plus the zombie gets many free hits while you're fiddleing with the mouse trying to cycle back to hit him.) I suppose I could put it under a key press, I'd just much rather not involve the keyboard if possible.


Here's my code, if anyone's interested. Once I figure out how to arm weapons I'll post the whole thing so that other noobie people like myself can use it.

   

// script for character3: Any click on character


if (character[BIFFY].x > character[ZOMBIE].x){
    SetGlobalInt(15,1);//hero's attack variable
    AnimateCharacter (2,5,3,0);//hero throws punch
    PlaySound (7);} 

if (character[BIFFY].x < character[ZOMBIE].x){
    SetGlobalInt(15,1);//same as above but the punch is in the other direction
    AnimateCharacter (2,4,3,0);
    PlaySound (7);}

#3
Never mind guys, I got it working. I'm going to put in weapons, then I'll post the whole thing.
#4
okay, I'm making progress. I want it really simple, so that whne you click on the bad guy (ZOMBIE), your character throws a punch and the zombie takes damage. Also, the Zombie walks around randomly and takes swipes at you. Pretty simple.

In the room script I have:

// room text script file


function room_a() {
Ã,  // script for room: First time player enters screenÃ,  Ã, 

if (character[BIFFY].prevroom == 8){
Ã,  FollowCharacterEx (ZOMBIE,BIFFY,5,0);} }//zombie charges the player, BIFFY

function room_b() {
Ã,  // script for room: Repeatedly execute
Ã, 
if ((AreCharactersColliding (2,3)==1) && (GetGlobalInt(15)==1)){
Ã,  Ã,  Wait(2);
Ã,  Ã,  AnimateCharacterEx (3,5,5,0,0,1); // animate blocking
Ã,  Ã,  SetGlobalInt(10,GetGlobalInt(10)-10);//player takes damage
Ã,  Ã,  AnimateCharacterEx (2,6,3,0,0,1);//zombie attack animation
Ã,  Ã,  character[BIFFY].x-=10;//player is "knocked back" a few pixels
Ã,  Ã,  MoveCharacter(ZOMBIE,189,146);}}//zombie moves away and attacks again

This part works like a charm. I'm having problems getting the player to connect with any hits on the zombie.

So in my "any click on character" section of the zombie I have:


if (GetGlobalInt(16)==0){//If the zombie's health is zero
Ã,  Ã,  Ã,  FollowCharacter(ZOMBIE, -1); // stop following anyone
Ã,  Ã,  Ã,  AnimateCharacterEx (ZOMBIE,7,0,0,0,1);//zombie death animation
   Ã,  Ã,  }Ã, 
Ã, 
if (character[BIFFY].x > character[ZOMBIE].x){//this is so the player punches in the right direction
Ã,  Ã,  SetGlobalInt(15,GetGlobalInt(15)+1);//set punching variable +1
Ã,  Ã,  AnimateCharacter (2,5,3,0);//player takes a swing left
Ã,  Ã,  Wait(1);
Ã,  Ã,  SetGlobalInt(15,GetGlobalInt(15)-1);//set punching variable back to 1
Ã,  Ã,  }Ã, 

if (character[BIFFY].x < character[ZOMBIE].x){//same as above but player swings in other direction
Ã,  Ã,  SetGlobalInt(15,GetGlobalInt(15)+1);
Ã,  Ã,  AnimateCharacter (2,4,3,0);
Ã,  Ã,  Wait(1);
Ã,  Ã,  SetGlobalInt(15,GetGlobalInt(15)-1);
Ã,  Ã,  Ã, }

if ((AreCharactersColliding (2, 3)==1) && (GetGlobalInt(15)==2)){
Ã,  Ã,  Ã, SetGlobalInt(16,GetGlobalInt(16)-1);//if characters are colliding and punching variable is 2 zombie takes damage
Ã,  Ã,  Ã, AnimateCharacterEx (3,8,1,0,0,1);//zombie damage animation
Ã,  Ã,  Ã, character[ZOMBIE].x+=10;//zombie is knocked back a few feet
Ã,  Ã,  Ã, SetGlobalInt(15,GetGlobalInt(15)-1);}//hero's punch is set back to 1



I had the player hitting the zombie fine, until I put in the part under repetedly execute so the zombie could fight back. So I know the above code works, there's just something I'm doing wrong. Dam global variables make my head hurt. I think the repeatedly execute is overriding the click on character part, anybody have any suggestions?
#5
Worked like a charm! Fabulous.

One more thing, the zombie dies and just disappears, I'd like it if he leaved a body behind, so I figure that I could have a room turn on an object (the dead zombie) at the exact place where the zombie eats it. Any ideas how to do this? I have it turn on the object, but it appears where I place it in the room.

Thanks for your help above.
#6
I have a scene where a player walks into a room and is attacked by a zombie. I've got it so the player takes damage and can kill the zombie by clicking on him, so far it works fine. However I've got a few problems:

the zombie attacks with FollowCharacterEX with eagerness set to 0, (which is under "first time player enters screen)which works fine, however after your kill it and the zombie goes to the death animation, it continues to follow you out of the room. Is there a way to turn FollowCharacterEX off? I tried this:

if (GetGlobalInt(16)==0){
   SetCharacterView (ZOMBIE, 9);
   StopMoving (ZOMBIE);
   character[ZOMBIE].room=-1;
      }
Where 9 is the dead zombie frame, and globalint 16 is the zombie's health, of course. But it doesn't work. The zombie stops moving in the room with the fight, but when you leave the room it's dead corpse follows you.


2nd question:

The zombie damages the player when two conditions are met, when characters are colliding and when the attack variable is zero. Here's my pathetic noobie code:

// script for room: Repeatedly execute
if ((AreCharactersColliding (2,3)==1)&& (GetGlobalInt(15)==0)){
  StopMoving(ZOMBIE);
  SetGlobalInt(10,GetGlobalInt(10)-10);
  AnimateCharacter (3,5,5,0);
  MoveCharacter(ZOMBIE,189,146);
  } 

It works okay, however the zombie's attack animation does not play. The hero takes damage (rather too quickly, need to fix that too) Globalint 15 is the attack variable, 2 and 3 are the hero and zombie charIDs respectively, globalint 10 is the hero's health. The idea is that the zombie will "collide" with the hero, take a swipe, do 10 points of damage, and then move away. Everything works except for the zombie's attack animation. Any pointers?
#7
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
#8
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
#9
So I should put this into the room script and not the zombie character script? I'll try that.
#10
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.
SMF spam blocked by CleanTalk