[Project] Third Person Shooter

wingdnosring

New Member
Reaction score
16
Code:
Unit - Set (Last created unit) custom value 0 to Grenade Traj Distance

Sets the distance the Mssile travels every 0.03 seconds. Originally I had this decrease over time, but it was unnecessary, so now it remains constant.

Code:
Unit - Set (Last created unit) custom value 1 to 0.0
Unit - Set (Last created unit) custom value 2 to 0.0

1 was going to be used for drops in height, but I've since removed it, so just ignore it.

2 records the total distance of a grenade as it travels. So every 0.03 seconds it adds custom value 0 to itself.

Code:
Unit - Set (Last created unit) custom value 4 to (Grenade Traj Distance * (Grenade Traj Distance / 0.06))

The distance of the parabola's vertex.

Code:
Unit - Set (Last created unit) custom value 3 to (((Ground height at Shooter Positions[Grenade Traj Creation Loop]) + 0.6) + ((((Custom value 4 of (Last created unit)) * (0.0 - (Sin((Camera Pitch of Player(Grenade Traj Creation Loop)))))) / (90.0 + (Sin((Camera Pitch of Player(Grenade Traj Creation Loop)))))))

The height of the parabola's vertex.

Code:
Unit - Set (Last created unit) custom value 5 to (((0.6 + (Air height at Shooter Positions[Grenade Traj Creation Loop])) - (Custom value 3 of (Last created unit))) / (Power((0.0 - (Custom value 4 of (Last created unit))), 2.0)))

The parabola's width.

I have already changed 5 to be an absolute value, so the grenade trajectory is perfect if the player is looking upwards. But when he looks downwards, it gets stuck in the sand about a foot in front of him. So, there's still work to be done.

And I have no idea what that action you posted does :S.
 

onisagi

New Member
Reaction score
6
Wow... I still have no idea what you're doing... lol... btw that action i mentioned turns off HP bars.

Assuming you spawn any/all enemy units, you can call that to hide their hp bars with last created unit, or use it on your own player unit.

If there's an easier way to do this, i'd like to know too.
 

Dave312

Censored for your safe viewing
Reaction score
269
He has assumed that the arc to be traveled will follow the shape of a parabola (quadratic equation, y = ax^2 + bx + c). And in order to do this he has determined the distance the grenade is to travel and the height it will travel.

Personally I would do it how onisagi has mentioned. This makes it far easier to control the grenade's motion with simpler equations. The only thing you will need to do is use the camera's vertical angle to determine the throwing angle and somehow measure the power put into the throw. I suggest doing something like the longer the button is held down, then the more power is placed into the throw. If your confused about onisagi's equations, take a look at this diagram below. Just remember that the velocity will always remain constant in all directions except the vertical.
projectile_motion_picture.jpg
 
Reaction score
54
He has assumed that the arc to be traveled will follow the shape of a parabola (quadratic equation, y = ax^2 + bx + c). And in order to do this he has determined the distance the grenade is to travel and the height it will travel.

Personally I would do it how onisagi has mentioned. This makes it far easier to control the grenade's motion with simpler equations. The only thing you will need to do is use the camera's vertical angle to determine the throwing angle and somehow measure the power put into the throw. I suggest doing something like the longer the button is held down, then the more power is placed into the throw. If your confused about onisagi's equations, take a look at this diagram below. Just remember that the velocity will always remain constant in all directions except the vertical.

I don't mean to disrupt the flow of mathematics and goodness overall, and I'm not sure if it even applies... but have you guys considered using the data editor's Parabola mover?
 

onisagi

New Member
Reaction score
6
before i went into explaining a physics approach, i actually suggested something about marauder's attack. What i meant was to use the game's own weapons in the form of projectile attacks like the marauder's. But you can't really change those values while you're playing. The grenades or wutever will always be shooting as it is defined inside the mover.

If you implemented what i said instead, you'd be able to throw a grenade straight up and have it land back on top of you. It makes more sense as a 3PS/FPS. You may still be able to do this with movers, but i haven't seen it done yet. Doesn't mean its not doable, so time will tell.
 

onisagi

New Member
Reaction score
6
He has assumed that the arc to be traveled will follow the shape of a parabola (quadratic equation, y = ax^2 + bx + c). And in order to do this he has determined the distance the grenade is to travel and the height it will travel.

Personally I would do it how onisagi has mentioned. This makes it far easier to control the grenade's motion with simpler equations. The only thing you will need to do is use the camera's vertical angle to determine the throwing angle and somehow measure the power put into the throw. I suggest doing something like the longer the button is held down, then the more power is placed into the throw. If your confused about onisagi's equations, take a look at this diagram below. Just remember that the velocity will always remain constant in all directions except the vertical.
projectile_motion_picture.jpg


Replace the Y's with Z's (or the height). Because the XY plane is the floor itself, Z is into the air
 

wingdnosring

New Member
Reaction score
16
I don't mean to disrupt the flow of mathematics and goodness overall, and I'm not sure if it even applies... but have you guys considered using the data editor's Parabola mover?

I considered it, but I'm not familiar enough yet with the data editor to achieve what I needed to do. Can you have a grenade fly through a quadratic function, stick to a unit and produce the Reaper D8 charge sound, explode, damage area, and play an explosion sound?

My guess is that, you probably could, but I can't at this time :p.

Triggering allows for more customization too. The parabola is working now, so I don't think I'll redo the whole thing now...what I AM going to work on though is adjusting my current function so it's a little easier to control. It's great when aiming far away, but then when you switch from angle 360 to 1 there's a bit of a jump in range. Should be an easy fix.

I just added in the ability to stick grenades to cover and units.

[Edit]: Currently looking for a way to kill the particles generated from a single unit. Not sure it's possible yet. Also still trying to tackle the actor removal issue. Scopes don't seem to be what I'm looking for. There has to be a way to remove these damn actors after they're created! Once this issue is revolved, I think version 5 is ready to be uploaded.

I removed a small edge around the map as onisagi advised. Not only was he correct about it making the horizon line look better, it also made the fog I made a while ago appear out of nowhere. So yay, fog is working now...?

[Edit 2]: I decided the actor method was a waste of time, so I decided to try adding death animations to my projectiles. I went into the actor and specified the death models and such, but there's no visible effect. The GenericImpact model that I created is now listed as part of the Assault Rifle Missile, but as I said, there is no effect when the missile is killed.
 

onisagi

New Member
Reaction score
6
you have to look beyond just the actor, you have to look at the effects under the unit. Look under Units -> Raven -> Raven - Seeker (Launch missile)

see that its impact effect = Raven Seeker (damage)

if you keep tracing the steps you'll find that it has an impact model here:
Effects -> Raven - Seeker (Damage) -> Models -> Seeker Attack Impact
which uses "HunterKillerMissileImpact.m3" as its impact model.

Using the data editor is already very common place now. You can very well implement what you wanna do with only data editing and no triggers at all, i just thot you'd wanna have more control over trajectory and throw strength, which may also be possible thru the use of validators in the data module, but this gets more complicated and i dunno how to tell you off the top of my head. If you'd wanna try this way, take a look at seeker missile, and change its mover/effects to work the way you want it to.

Actor Scopes are just containers for actors. You set actors to it... and then delete the actors that are inside a specified actor scope.
I'll do a quick rundown on its usage. In this example, I'm going to be creating an actor right underneath my unit to simulate dust on the floor upon leaping my unit into the air (defy physics for half a second) and land.

Actor - Create actor model "Hallucination Death" at point (position of hero) <-- this is a bluish dusty effect model
Actor - Send message "SetScale 0.5" to actor (last created actor) <-- this makes the effect smaller
Actor - Kill actor model (last created actor) <-- this kills the model
Set "Actor" = (last created actor) <-- this sets your actor to a variable
Change Hero height to (height of hero + 1) over 0.5 seconds
Wait 0.5 seconds
Change Hero height to (height of hero - 1) over 0.5 seconds
wait 0.5 seconds
Actor - Kill actor scope (Actor scope for Actor) <-- this is garbage collection, killing the actor that was created, that doesn't have a model.

The last action you use "Actor Scope From Actor" under Actor Scope:, And set the Actor: to your "Actor" variable. So you only need to create an "Actor" variable to accomplish all this.
 

wingdnosring

New Member
Reaction score
16
Awesomeness. Man, you're like my official advisor here :). Clearly I'm already falling behind the rest of the modding community, since I only have a very basic understanding of the data editor. I still prefer triggering more things, simply because I feel I have more control over bullet variance, etc;

I am trying to implement the data editor a bit more with each step so I can learn it while working on a complex project, but the death animations were just annoying. I set them up exactly like the Ghost has its set up and yet no death anim would show.

I'll be uploading version five very soon.

[Edit]: Version 5 is now available for download!
 

wingdnosring

New Member
Reaction score
16
Hey guys, sorry to double post, but I have a question to ask that I think deserves its own post (besides, I'm not really spamming or anything, am I?). This question can be answered by anybody, but I would especially like to hear from Ancanus, since he seems to understand the data editor quite well.

I'm thinking that in version 6, it'll finally be time for enemies to fight back. I know, I know, they work just fine as target dummies :p, but why not add a bit of challenge in here? I think it will make the whole thing that much more interesting for people to test and it allows me to work out spawns, health regeneration, etc;

So my question is this: what method do you guys think will work best for allowing enemies to fire? Data Editor, or Trigger Editor?

If I were to do trigger, I would simply copy/paste the current user based bullet creation trigger, with some obvious changes. And instead of using booleans to detect Left Clicks, the events would be based off of enemy dummy attacks. As for giving each enemy different weapons, I would simply use custom values to detect weapon types, and by association, drops, as opposed to needing a custom made unit with a custom weapon for each enemy.

Really, both seem like equally good options to me. On the one hand, using the data editor gives me a chance to gain a better understanding of the way custom units/weapons work. On the other, I think triggers offer more variation, customization, and it might be easier and quicker, since I already have a similar trigger that can be copy/pasted and edited.

My biggest concern with the data editor is how much it can be customized (since I have absolutely no frame of reference here). Can missiles be changed to allow for significant variation? Can they be prevented from locking on to targets? Can they be destroyed easily upon impact with a cliff, wall, or cover? Can they detect proper unit height if I'm above or below opponents? Can the data editor alone force enemies to reload realistically?

Please answer quickly, as I'm rather excited to jump ahead with whatever method is recommended.
 
Reaction score
54
So my question is this: what method do you guys think will work best for allowing enemies to fire? Data Editor, or Trigger Editor?

I believe you should definitely give Data Editor a try, just for sake of learning it. However, I think it would be a mistake to limit yourself to one or the other...

Take in mind that people have had experience with the Trigger Editor for years now. Since the Data Editor is very new, most difficult questions you may have won't have a satisfactory answer. Your threads will consist either of 2 posts, both of which are yours desperately bumping; or of 50 posts, of forum members trying to figure it out.

My biggest concern with the data editor is how much it can be customized (since I have absolutely no frame of reference here). Can missiles be changed to allow for significant variation? Can they be prevented from locking on to targets? Can they be destroyed easily upon impact with a cliff, wall, or cover? Can they detect proper unit height if I'm above or below opponents? Can the data editor alone force enemies to reload realistically?

Personally, I believe that everything you stated is possible just with the data editor. However, for most of the points you asked, we still haven't found a satisfactory way to do them. This would be trivial to do with regions in the Trigger Editor, that's why you really shouldn't limit yourself to use the Data Editor exclusively.


All the things I know from the data editor I've learned from these forums: asking questions myself, people asking questions and then sorting them out themselves, or someone giving them a better solution. We are pioneers, of some sort... just by trying the data editor out, I feel you would be giving more to the community. =)



TL;DR: Use both.
 

wingdnosring

New Member
Reaction score
16
Love the pioneers reference. I used it myself to describe the modding community to a friend of mine a couple days ago.

Hmmm. I saw your old thread regarding making projectiles detonate upon reaching walls and it seemed to me that it never got solved satisfactorily. I even have the map that was uploaded there (the one with the stalker). The missiles weren't quite able to perform the actions I have in mind.

Having said that, I do want to learn a little more about the data editor before my trigger happy methods become completely obsolete...

Well, I'll use a mix, as you suggested. The bullet shooting and travel simply makes sense to trigger, since I already have that in place. But the rest I'll attempt to use the Data Editor for.

[Edit]: How do you get an angle between points for the Z axis? I can't seem to figure out how to do it without camera angles...:S
 

THUNDERPOWER

New Member
Reaction score
1
Nice map. Crazy triggering :p

I'm really interested in learning how you made your projectile system. I tried creating new projectiles and creating them via trigger, but it doesn't appear to work.
 

wingdnosring

New Member
Reaction score
16
Creating Your Own Weaponry

Step 1: The Data Editor

Search the data editor for "Assault"

In the unit category, you should see two custom units. One will be named Assault Rifle, the other Assault Rifle Missile.

Make a copy of each. For the Assault Rifle unit, you can create a custom actor or model if you wish, but since they're all just balls anyway, you could leave all that the same. Simply rename Assault Rifle to the name of your new weapon and proceed to the Missile.

The missile is a little more difficult. For each new missile, you need to change a) the name of the missile and all child data editor information (actors, models, etc; ) b) the model file that the model uses, and c) the time a model lasts for before it disappears, assuming it hasn't hit anything.

The first two should be easy enough to figure out, but the third (length of existence) is dictated by its behavior. In the case of the assault rifle, this behavior is called Assault Rifle MD. Within this behavior, you should see a value (assuming you aren't displaying things in table mode) called "Stats - Duration". Change that to the time (in seconds) you want the missile to last for.

Next, open up the Effects tab. Search for "Assault" again. You should see an effect named Assault Rifle (Damage). Duplicate it. There are only two values here that you need to change. First, change "Combat - Amount" to your desired damage per bullet. Second, change "Effect - Death" to your desired type. Note that in the beta most of these death animations don't work, but some (like fire or blast) are functioning fine.

Finally, open the Weapons tab. Search for "Cooldown". Copy/paste any of the custom weapons you see. Change the name and range to suit your liking.

Whew. As always, the Data editor section seemed a little long-winded, but it's really simple to do again once you've gone through that whole ordeal once. Now, we're moving on to triggers.

Step 2: Triggering

I've tried to make the triggering portion as simple as possible and will continue to make things easier over time. There are only two real things to keep in mind while triggering.

Go to the "Create Weapons" trigger. You will see seven actions and several comments. Create a new action. Search for "Create Weapon".

You should see a custom action that comes from the source TPSLib. Select it. Once it's added to the trigger, you will notice a ton of values that need to be filled in. Use the comments above to help you understand what each value does. After each value has been filled, your weapon should be working! Congratulations!

Creating Your Own Enemies

Step 1: The Data Editor

Create your enemy as you would any unit. This probably means you'll need a custom unit, actor, and model. Do NOT create a weapon for the unit (you can if you wish, but you'll see my reasoning later).

In order for my code to properly detect the height and width of each unit, you need to make a few alterations to your unit.

1. Go to the unit tab and select the enemy you've made for yourself.
2. Use the field search tab to find Radius. You should see several radius fields, but you want the one that is simply titled "Radius". (Not inner radius or anything like that). Change the Radius to the width of your unit. To put things in perspective, marines, ghosts, and zerglings are all 0.375.
3. Search for the "Supplies" field. Set the supplies to -10 times the height of your unit. As an example, marines are 0.9 tall, so their supplies are set to -9.
4. Give your unit the weapon you created earlier when making your own custom weaponry. My triggers will automatically detect your setting and give him the same weapon you would be using when selecting your wepaon. You may give him a 'real' weapon if you wish, but you should know that my library does not support this choice as of version 6. Version 7 will rectify this.


Step 2: The Trigger Editor

Once again, the trigger editor really only requires one line. My custom action titled "Set Enemy Weapon" allows you to pick a unit of your choice (or unitS via unit groups) and assign them one of your custom made weapons. The Identifier you used when creating your weapon is all you need to set. To see an example of what you need to do, go to the "Weaponry" folder. Select the "Set Enemy Info" trigger. You will see multiple comments and a couple of if/then/else statements. Copy/paste an if/then/else statement. Change the condition to match your new enemy. Next, go down to the action within your new if statement. Change the action to match the identifier of the weapon you wish to see them use.

Never change the custom value 1 or 2 on a cusotm enemy. The library makes use of these.

That's how my starting triggers have it set up, but you can use that custom action anywhere you please.

Creating Custom Terrain

This is fairly straight forward, but I feel I should cover it anyway. Terrainers need to keep two things in mind while creating terrain:

1. In order for players to be able to use cover, you MUST place Short Cover boxes (search among the destructibles) around the object you wish to use. You can see how they're placed in my sample map. Please bear in mind that anything the user can take cover on, they should also be able to shoot over. In version 7 I will be adding "Tall Cover", which allows users to cling to walls but not shoot over.

2. All destrucibles that you don't want players to shoot through need to have their Radius and Supplies assigned. See "Creating your own enemy" for more information on that.
 

wingdnosring

New Member
Reaction score
16
Here's my current issue. Since we have so many mathematicians here, I figured I could get some help here.

I'm having trouble setting the height of enemy projectiles when they are shooting up or down at a player's unit.

Here's what I have:

-Set the distance between target and origin
-I set the height difference between the player's unit and the enemy one
-I use Pythag like so: Square Root (height difference^2 + distance^2)
-Finally, I use the law of sines to find the angle of attack: (Pythag result * height difference) / sin(90)

All of that gives me the angle of attack. Or at least...it should. Next, I do this (ignore the red). ComputerHeightAngle[4] is the final result from above:

Unit - Change (Picked unit) height to (((Air height at Bullet_Temp_Creation_Point_Comp) + (0.6 + BulletHeightTempComp)) + ((((Custom value 2 of (Attacking Unit)) * 33.3) * (Sin((90.0 - (Asin(ComputerHeightAngle[4])))))) / (0.0 + ComputerHeightAngle[4]))) over 2.5 seconds

That should change the missile's height to an appropriate amount, but unfortunately, it goes sky high.
 

Dave312

Censored for your safe viewing
Reaction score
269
If your doing what I think you are trying to do, don't worry about pythag. Use this formula:
Angle = atan(Distance / Height difference)

You will need to use test if Height Difference is negative, zero, or positive. If Negative, they should be shooting downwards. If zero, they are shooting level. If positive they are shooting upwards. Just remember that if you don't perform this check, you will get errors when height difference is zero as you can't divide by zero.
 

wingdnosring

New Member
Reaction score
16
Yeah, if zero I simply skip out on the height changing line. Look above ^ I editted it slightly.

Where did you get that arctangent value from? I've never heard of doing it that way before.
 

Dave312

Censored for your safe viewing
Reaction score
269
It's just the basic Sine, Cosine and Tangent Ratios that works for a right angle triangle. Here are the basic rules.

So is it giving you the correct angle now? I'm unsure of how angle of attack is actually measured.
 

wingdnosring

New Member
Reaction score
16
It's the exact same. I would assume it's an issue with the my change height line action, since both of our solutions had the same result.

Do you see any problems with that? I'm wondering if I have 90- on the wrong angle.
 

Dave312

Censored for your safe viewing
Reaction score
269
I reckon it might have something to do with the (Custom value 2 of (Attacking Unit)) * 33.3 but I don't know what the custom value 2 is. Even if it is 1, that is still gonna put yr bullet really high up.

Actually can you define all of those terms for me? Then I could probably give you a better idea of what it could be.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top