At its most basic level, to shoot the terrorist in the manner you describe would only need the shooting stuff (Animate Jack firing gun, Animate terrorist falling down dead etc) into the interaction editor when you use the gun inventory object on the terrorist character. If this is the case, then player.ActiveInventory will be required.
Code: ags
Assuming iGun is the Script-o-name of the gun in question. Also, that int [is_enemy_alive] is a variable you'll see in a moment.
As for the terrorist shooting the character, again, I can give a simple idea. If you simply have a confrontation and you had a split second or two to fire before you got killed, then you can use timers.
After the confrontation sequence has happened, you'd call SetTimer(timer number, how long it lasts). Also, in that room script, you'd have the IsTimerExpired function in the repeatedly_execute block. When the timer expired, the enemy would shoot. So:
Code: ags
The [is_enemy_alive] condition would be required to stop the enemy shooting you after you've killed him. You change that in the function when you manage to kill him. Needless to say, you'd need to set up a variable of that name and make sure that it starts off with a value of 1.*
But this idea is very simlistic and would most likely be used for a one-shot kill on either side. If you had more in mind a shooting-gallery-type section, or basically something other than what I have descibed that would be more complex (But perfectly do-able). I'm sure someone else will have such an idea in mind
EDIT: * Yeah, if the variable is declared in the global script, but needed in the room script, then you'll need to import it in the script header, and export it from the global script. See the manual for more.
// Global Script File
int is_enemy_alive = 1;
some_global_function_a(){
Ã, Ã, if (player.ActiveInventory == iGun) {
Ã, Ã, Ã, // Do stuff
Ã, Ã, Ã, // Shoot enemy
Ã, Ã, Ã, is_enemy_alive = 0;
Ã, Ã, }
}
Assuming iGun is the Script-o-name of the gun in question. Also, that int [is_enemy_alive] is a variable you'll see in a moment.
As for the terrorist shooting the character, again, I can give a simple idea. If you simply have a confrontation and you had a split second or two to fire before you got killed, then you can use timers.
After the confrontation sequence has happened, you'd call SetTimer(timer number, how long it lasts). Also, in that room script, you'd have the IsTimerExpired function in the repeatedly_execute block. When the timer expired, the enemy would shoot. So:
function the_confrontation() {
Ã, Ã, ...
Ã, Ã, ...
Ã, Ã, ...
Ã, Ã, SetTimer(x, time)
}
function repeatedly_execute() {
Ã, Ã, if (IsTimerExpired(x) == 1 && is_enemy_alive == 1) {
Ã, Ã, Ã, // Do stuff
Ã, Ã, Ã, // Shoot player
Ã, Ã, Ã, ...
Ã, Ã, Ã, ...
Ã, Ã, Ã, // Death
Ã, Ã, Ã, // Cancel next season
Ã, Ã, }
The [is_enemy_alive] condition would be required to stop the enemy shooting you after you've killed him. You change that in the function when you manage to kill him. Needless to say, you'd need to set up a variable of that name and make sure that it starts off with a value of 1.*
But this idea is very simlistic and would most likely be used for a one-shot kill on either side. If you had more in mind a shooting-gallery-type section, or basically something other than what I have descibed that would be more complex (But perfectly do-able). I'm sure someone else will have such an idea in mind

EDIT: * Yeah, if the variable is declared in the global script, but needed in the room script, then you'll need to import it in the script header, and export it from the global script. See the manual for more.