Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Projectile (shoot from position) height

#1
Does anyone know of a way to adjust the enemy projectile height?

I made a helicopter and altered it's +y axis (so it flies in the sky, above the terrain).
Looks good but when it fires/shoots a projectile, the bullet sprite starts near the floor. 

Any way to adjust projectile height so it fires from the models position (in the air)?
*As a last-resort, I could make a large projectile sprite with lots of blank-space at the bottom.

Thanks.

https://www.dailymotion.com/video/x9edj32
How scripting looks to dyslexics:       if the statement below = "true"
                                                         then the statement above == $false           {Else the game will crash
Reply

#2
Cant seem to load the video but what level is the enemy on? Is it the same as the player?
If it bleeds, We can kill it.
Reply

#3
(02-15-2025, 09:31 AM)Pixelwolf Wrote: Cant seem to load the video but what level is the enemy on? Is it the same as the player?

Shame the video doesn't work - although there's no projectile in the video anyway, just to demo/showcase the copter model.
Yes, enemy is on ground-floor, same as the player.

It doesn't look too bad, but it would look better if the enemy projectile was a little bit higher.

*Just out of interest, I tried redrawing the sprite (large transparent square with smaller projectile at center-top), I expected to be a good compromise - but with a larger sprite, the projectile collides with the floor as soon as it shoots.
How scripting looks to dyslexics:       if the statement below = "true"
                                                         then the statement above == $false           {Else the game will crash
Reply

#4
Makes sense, collision of the projectile is determined by the size of the sprite so if it is to big it will touch the ground and destroy it
If it bleeds, We can kill it.
Reply

#5
(02-16-2025, 07:22 PM)Pixelwolf Wrote: Makes sense, collision of the projectile is determined by the size of the sprite so if it is to big it will touch the ground and destroy it

I just got this from asking chat gpt. Does it look legit or is it way out there?...

VP said:
In "efpse ce" game engine, I have a 3D model attached to a 2D enemy sprite. The helicopter fires a projectile at the player. The helicopters height is fixed at 240 but the projectile fires from the 2D sprite position, instead of the 3D model's position. How do I just adjust the projectile's height to 240?

ChatGPT said:
Got it! If the helicopter is already firing a projectile and you just need to adjust the projectile's height to a fixed value of 240, you can simply adjust the projectile's Z-position after it has been fired.

Assuming that the projectile has already been spawned and you're just looking to modify its height, you can use a script to update the projectile's Z-position directly.

Here's an example of how you can adjust the projectile's height to 240 after it has been fired:
Script to Adjust Projectile Height to 240

// Set the fixed height for the projectile
map.fixedHeight = 240

// Get the current position of the projectile
entity check position Projectile $map.projectilePosX $map.projectilePosY $map.projectilePosZ

// Adjust the Z-position (height) of the projectile to the fixed value (240)
entity move Projectile $map.projectilePosX $map.projectilePosY $map.fixedHeight

Explanation:

    Set Fixed Height: The variable map.fixedHeight is set to 240, which is the height you want the projectile to always be at.

    Get Current Position: The script retrieves the current X, Y, Z position of the projectile using entity check position.

    Update Z-Position: The entity move command is used to update the Z-position (height) of the projectile, setting it to 240, while keeping the X and Y positions unchanged.

    To add this script to your game in Easy FPSE Editor, follow these steps:
1. Create a Script File

    Open a text editor (like Notepad or Notepad++), and paste the script into the editor.
    Save the file with a .script extension. For example, you might name it HelicopterProjectileHeight.script or another name based on your needs.
    The script file should be saved in the Data/Scripts directory of your project.

2. Script File Location

    Make sure the script is saved in the correct location within your project directory. The directory should be ProjectFolder/Data/Scripts.
    If the folder doesn't exist yet, you will need to create it.

3. Triggering the Script

    You need to trigger the script either by a map event or through the helicopter's actions. You can do this by linking the script to the helicopter's shooting action or through a trigger event.

    To link the script to an action (like shooting the projectile), use a trigger or attach it to the helicopter's behavior through the appropriate event in your game.

For example:

    If the script should run when the helicopter fires a projectile, ensure the trigger is set in the helicopter's behavior to call this script.

4. Testing the Script

    After saving the script and linking it to the appropriate entity (the helicopter's shooting behavior), test the game.
    Play the game and check if the projectile's height is set correctly to 240.

5. Debugging (if necessary)

    If the script doesn't work as expected, double-check the following:
        Ensure that the name of the projectile entity is correct. If the entity is named something different, replace "Projectile" with the correct entity name.
        Verify that the script is properly triggered during gameplay (i.e., when the helicopter fires the projectile).
        Check the logs or debug console for any error messages that might provide more information on what went wrong.

6. Repeat the Process as Needed

    If any adjustments or refinements are needed (like adding more logic to the script), update the script in the text editor and re-save it.
    Reload the game or trigger the script again to see if the changes work.

By following these steps, the script should be integrated into your game, and the projectile should correctly adjust its height to 240.
How scripting looks to dyslexics:       if the statement below = "true"
                                                         then the statement above == $false           {Else the game will crash
Reply

#6
In theory yes but that also depends on if you can move the projectile position with a script after it has been fired. I do not know a way that it would be possible but then again there are a number of undocumented things in the engine still.
If it bleeds, We can kill it.
Reply

#7
(02-17-2025, 08:59 AM)Pixelwolf Wrote: In theory yes but that also depends on if you can move the projectile position with a script after it has been fired. I do not know a way that it would be possible but then again there are a number of undocumented things in the engine still.

I see. Thanks for the info!

In that case, I guess it would be better for me to temporarily raise the helicopter's Ypos, each time it fires a projectile, rather than struggle to find a way to adjust the projectile-height after it's been fired. Same difference really.

I'll work towards that instead. Nice one.
How scripting looks to dyslexics:       if the statement below = "true"
                                                         then the statement above == $false           {Else the game will crash
Reply

#8
Sounds like an interesting work around and could also visually make the gameplay pretty cool
If it bleeds, We can kill it.
Reply

#9
(02-18-2025, 07:04 PM)Pixelwolf Wrote: Sounds like an interesting work around and could also visually make the gameplay pretty cool

Yes, thank you! I actually just realised a potential way to do it - but I think I like the idea of the copter lifting up to fire..
   
How scripting looks to dyslexics:       if the statement below = "true"
                                                         then the statement above == $false           {Else the game will crash
Reply

#10
Yep that should work. Good to see some one has added to the wiki considering I haven’t been about on efpse for a few months
If it bleeds, We can kill it.
Reply



Forum Jump:


Users browsing this thread:
7 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016