Scripts / Questions on entities shooting at each other

Author
Message
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 31st Aug 2014 17:33
I would like to make an entity shoot at another. Say one Combat Soldier shooting at another.

Two issues arise.

1. Implement the results of a hit. This should be easy. With some scripting I can check if the shot hit the target and decrease its health with SetEntityHealth(e,v).
2. Make the shooting VISIBLE. I have no idea how to make this happen. I would expect that the command FireWeapon(e) should produce a flash and/or smoke, much like when the entity fires at the player. But this doesn't work for me, i.e., including a FireWeapon(e) in my script only produces said effects when the entity is facing the player. I suspect it is required to also use some additional commands, such as "ai_combat_mode[e] = what???" but I could not figure it out from looking at the standard scripts.

Any help will be appreciated

Thn


The issue really is how to make this firing VISIBLE in the engine. The results of firing (i.e.,

Whereof one cannot speak thereof one must be silent
tomjscott
User Banned
Posted: 31st Aug 2014 17:44
I'm not so sure you can make it happen exactly as you intend. I'm working on this issue as well and I talked to Lee and SC about it. It seems that there is a lot of magic going on behind the scenes that may make it impossible to use existing functions such as FireWeapon and get the desired results. It would seem that complete custom scripting is required at this point. If I end up solving this challenge then I will be sure to share.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 31st Aug 2014 18:23
@tomjscott

Sounds good and I am always looking forward for some of your code magic. Here are some related thoughts.

1. One way to do this is to have some kind of missile emitted from the shooter's gun, like a bullet. Doable with the current FPSCR lu
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Aug 2014 19:10
as tom said they currently can't shoot unless at the player but you are correct in that you can do it via a seperate object (i.e. bullet) placed in front of the entity and then do your own checks for if it hits something

i saw some decals in lee's last blog (friday) so i think they will be placable in 1.009 maybe
no idea about the animation on the guns as such but you can call character animations so you should be able to call the firing animation

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 31st Aug 2014 22:19
You can use animated sprites for the muzzle flash, but you would have to move them in script to the gun point and make them visible when the weapon fires. But as talked about in another thread, animated sprites just play in a loop and there is no guarantee that when you make it visible that it'll be at the start of the animation. This is all very tricky and complicated in the current engine.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 1st Sep 2014 05:36
decals / animated sprites --> where are the commands for these? I can't see them in global.lua. Am I missing something obvious?

Whereof one cannot speak thereof one must be silent
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 1st Sep 2014 14:54
Some sort of animated gif attached to the weapon, would be nice and simpler.
The script responsible for firing the weapon, also load the gif Animate, each time the weapon is fired.

3com
PM
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 1st Sep 2014 16:38
@3com (and the rest)

Ach Ja!!!! Have an object (textured by a gif / whatever) positioned at the muzzle of the weapon and keep it always hidden except for a few cycles after the weapon is fired!!!

I think this will work.

Thn

tomjscott
User Banned
Posted: 1st Sep 2014 16:40
Quote: "Some sort of animated gif attached to the weapon, would be nice and simpler.
The script responsible for firing the weapon, also load the gif Animate, each time the weapon is fired.
"


The problem is that you can't attach anything to anything at the moment. You'll have to write a script to update the muzzle flash's position every time the character moves or rotates. Yep, you have to figure out a way to keep it's rotation aligned as well. Not as trivial as it may seem.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 1st Sep 2014 18:26
I agree.
But it will come.

3com
PM
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 1st Sep 2014 19:10
Quote: "The problem is that you can't attach anything to anything at the moment. You'll have to write a script to update the muzzle flash's position every time the character moves or rotates. Yep, you have to figure out a way to keep it's rotation aligned as well. Not as trivial as it may seem."

I think I know how to do that. Doesn't seem too hard with the 1.0085 functions and if I change position/orientation only when the "flash object" becomes visible, it will not even add too much computation.

What I know zilch about is the animated gif's. More specifically, how to texture an object with an animated gif. Any pointers to this?

Thn

Whereof one cannot speak thereof one must be silent
tomjscott
User Banned
Posted: 1st Sep 2014 19:15
Quote: "What I know zilch about is the animated gif's. More specifically, how to texture an object with an animated gif. Any pointers to this?"


Not so sure a gif is the answer here. Animated sprites use dds files, which are atlas textures. I just did a quick write-up the explaines the gist of doing animated sprites in the following thread:

http://fpscrforum.thegamecreators.com/?m=forum_view&t=209688&b=1

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 2nd Sep 2014 07:22
@tomjscott: good job with the tutorial ... still, skimming through it, it seems to be over my head. I guess I will wait for a couple more versions of FPSCR, hoping that "3rd person firing" will appear in the function set.

Thn

tomjscott
User Banned
Posted: 2nd Sep 2014 17:10
Quote: "1. One way to do this is to have some kind of missile emitted from the shooter's gun, like a bullet. Doable with the current FPSCR lua functions, but a little too complicated and would probably not look that good."


I was thinking of doing this using a ray cast function that traces from the shooting entity's position/rotation to the target's position. If there is an intersection within a certain tolerance then you can randomize a hit percentage and then apply damage. The only problem is that bullets can go through obstacles and cover. The more I get into this, the more I see just how many functions we need added to Lua in order to do this properly. There are complex, tedious ways that I can even account for obstacles and walls, but I'm wondering just how far I'm willing to go to get this to work in the current engine. At the moment, I'm just working on polishing my comp entry instead and waiting on 1.009 to see what I can take advantage of in that version.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Sep 2014 18:19
yh at the very least we need an actual collision detection

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 2nd Sep 2014 18:26 Edited at: 2nd Sep 2014 18:28
Quote: "yh at the very least we need an actual collision detection"




I actually have a complex method of getting at this through scripting and my Omega Core plugin, but it's just that, complex. And I don't really know if I want to do that. I'd rather ask Lee if he can add some Lua functions for ray casting and collision information.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071
kehagiat
10
Years of Service
User Offline
Joined: 16th Jul 2013
Location:
Posted: 2nd Sep 2014 19:00
@smallg + @tomjscott

Exactly my feelings.

Somewhat more generally: it seems to me that FPSCR is slowly building up to break through some kind of usability barrier. 1.008/1.0085 added some very essential scripting functions but had a performance dec
tomjscott
User Banned
Posted: 2nd Sep 2014 19:19
Quote: "I am more interested into Third Person Simulation Creator. But I guess I am in the minority here."


I'm with you on this as well. I submitted my suggested commands to Lee that would allow me to make a 3rd person controller, but Lee is focused on performance right now and won't even consider the new commands right now. So, we are stuck for now with first person.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0071

Login to post a reply

Server time is: 2024-05-03 11:00:06
Your offset time is: 2024-05-03 11:00:06