Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Tha2ohSIX on Mon 21/04/2003 12:42:51

Title: Wanna shoot gun by pressing key
Post by: Tha2ohSIX on Mon 21/04/2003 12:42:51
Hey... in my game I've got it where when you click the gun in the inventory on another character it runs an animation of the main character shooting.  How do i make it so you can equip the gun and have it say a message like "the gun is equiped". then you would be able to press a single key, like control or spacebar to shoot the gun?

Question 2: I have animations of the other characters dieing for when they get shot, but i dont know how to run them like halfway through the shooting animation. Can anyone please help me out?
Title: Re:Wanna shoot gun by pressing key
Post by: Scorpiorus on Mon 21/04/2003 19:14:53
QuoteHey... in my game I've got it where when you click the gun in the inventory on another character it runs an animation of the main character shooting. How do i make it so you can equip the gun and have it say a message like "the gun is equiped". then you would be able to press a single key, like control or spacebar to shoot the gun?
It depends on how you want to organize it. Do you have a custom inventory GUI? Can you provide a bit more information on how you suppose to equipe it? You can choose bullets inv item and click it on gun for example or ...?

QuoteQuestion 2: I have animations of the other characters dieing for when they get shot, but i dont know how to run them like halfway through the shooting animation. Can anyone please help me out?
You can try this:

AnimateCharacter(KILLER, ......);
while (character[KILLER].frame < 7) Wait(1);
AnimateCharacterEx(VICTIM, ......, blocking=1);


The script starts the second animation just after KILLER's frame is 7.

-Cheers
Title: Re:Wanna shoot gun by pressing key
Post by: Tha2ohSIX on Wed 23/04/2003 11:37:22
hey thanks for all the help.  I just tried the script below and it freezes the program right when i try to use the gun on the NPC.

 // script for character1: Use inventory on character

SetCharacterView (EGO,3);
SetCharacterView (JACKO,6);
AnimateCharacter (EGO,0,5,0);
while (character[EGO].frame < 4) {
AnimateCharacterEx (JACKO,0,5,0,0,0);
}
ReleaseCharacterView (EGO);


Also I don't really know what i'm gonna do for the inventory.  I want a stats gui that you can click on, then it brings up a stat screen where you can load ammo and equip the guns.
Title: Re:Wanna shoot gun by pressing key
Post by: Gilbert on Wed 23/04/2003 11:53:27
I'm not quite sure, but try this:

SetCharacterView (EGO,3);
SetCharacterView (JACKO,6);
AnimateCharacter (EGO,5,0,0);
while (character[EGO].frame < 4) Wait(1);
AnimateCharacterEX (JACKO,5,0,0,0,1);
ReleaseCharacterView (EGO);



BTW are you sure you put the loop number, etc in right order?
Title: Re:Wanna shoot gun by pressing key
Post by: Scorpiorus on Fri 25/04/2003 21:01:31
QuoteSetCharacterView (EGO,3);
SetCharacterView (JACKO,6);
AnimateCharacter (EGO,5,0,0);
while (character[EGO].frame < 4) Wait(1);
AnimateCharacterEX (JACKO,5,0,0,0,1);
ReleaseCharacterView (EGO);
Yep, you need Wait(1), as Gilbert pointed out.


QuoteAlso I don't really know what i'm gonna do for the inventory. I want a stats gui that you can click on, then it brings up a stat screen where you can load ammo and equip the guns.
Do you have something done already? You can use GUI buttons to reload the gun etc. Actually I don't fully understand about the exact view/style of that GUI.

-Cheers