Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Making Protective Armour - Group Discussion

Author
Message
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 16th Jan 2009 05:28
First of all, there isn't anyway to make a script that will actually allow an easy way to do this.

However, now with variables one can emulate this possibility, although it isn't a way one would like to do it.

We need to make either global or local variables equal to a piece of armour that the player will pick up. When the player picks up that particular armour, then we set the variable to the number that represents the armour. Then we need to modify scripts where the entity is shooting at the player. For example: chase10.fpi. You might want to give the script a new name so that you can keep the original intact.

Here is an example:

Find the following line in the script. It has "useweapon" within it.

:state=1,ifweapon=1,plrdistwithin=400,plrcanbeseen=46,rateoffire:animate=1,rotatetoplr,freeze,useweapon,rundecal=6

Now follow the line with this.

:state=1,varequal=1,ifweapon=1,plrdistwithin=400,plrcanbeseen=46,rateoffire:plraddhealth=1
:state=1,varequal=2 . . . plraddhealth=3
:state=1,varequal=3 . . . plraddhealth=5

You will notice that we can't "protect" the player but we can add a certain amount of health back to the player. You will have to experiment as to how much health to add. Some armour will have little health added while other armour will have a lot of health added.

For those who are not used to scripting this might be confusing. However, for those who are understanding this even a little, perhaps you can give more suggestions regarding this technique or maybe you have another idea altogether.


__________________________________________________________
Make life a little easier and use FPI Editpad for your sctripting needs.
Now with Line Numbers in version 3.3.0.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 16th Jan 2009 07:02 Edited at: 16th Jan 2009 07:13
I can't find the thread now, but I had suggested this same thing to someone about body armour.
That a variable could not only be the armour, but allow for a range of protection.
I was going to add the health back just like you are suggesting here. (only way I could think of too)
The idea was to decrement the armors value when the enemy deals damage to the player, so the armor would wear out.

I'll find the thread again sooner or later, but yeah body armour can be done now with variables.
That is why I never got around to it though... I didn't feel like editing all of the people scripts.


Quote: "First of all, there isn't anyway to make a script that will actually allow an easy way to do this."


There has to be an easier way.
If only we can set up a holder for the players health as to compare it for changes.
Then it could be done in a single script instead of in every one of the enemies script.
The line limit for FPI scrits puts a hamper on using a straight forward approach.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 16th Jan 2009 07:11 Edited at: 16th Jan 2009 07:15
Thanks CE. If you find it could you put a link to it here so it would be easier to find for others who would be searching this subject/topic.

I even tried to do a google search but the problem is that it searches the entire TGC board and all the forums so it is difficult to go through all that was found.


Edit

I hope there can be an easier way.



__________________________________________________________
Make life a little easier and use FPI Editpad for your sctripting needs.
Now with Line Numbers in version 3.3.0.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 16th Jan 2009 07:17 Edited at: 16th Jan 2009 07:25
Quote: "Thanks CE. If you find it could you put a link to it here so it would be easier to find for others searching this subject/topic"

I probably will never find it because it was someone elses thread and I can't remember who or the title.

Anyway, your explination covers it as well as what I had said before, because I never went into detail.

Might as well start from scratch in this thread since it does have the proper title for searches.

Quote: "I hope there can be an easier way."

Well, easier meaning less scripts to edit maybe, but not easier when it comes to the logic. (it might be harder there)
I mean, the logic is not that bad except for the workarounds for comparing two variable's values.
I can try to work something out again for armour for a different method while you work on this one, okay?

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 16th Jan 2009 19:13
OK will work on it some. Comparing two variables. Hmmmm? Yup will take some extra lines of script.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 16th Jan 2009 21:29
Does anybody (Plystire?) know the difference between the commands

shootplr and useweapon?



__________________________________________________________
Make life a little easier and use FPI Editpad for your sctripting needs.
Now with Line Numbers in version 3.3.0.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 17th Jan 2009 05:09
shootplr runs the shoot.fpi script and useweapon makes the entity use a weapon if they have one.

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Jan 2009 17:55 Edited at: 17th Jan 2009 18:15
I thought of an easier way Flatlander

Simply have the body armour fill their health and keep it full until the flag changes.

:state=1,activated=1,plrhealthless=500:plraddhealth=1

Then a timer or other trigger can set the flag.

If we do not want to fill their health then we need to read the players health by finding the difference in it and 500.
We can do that by incrementing the players health while also incrementing two other variables.
Once obtain the difference then we use one of those two variables to decrement the players health back.
Another state checks the remaning variable's value and assigns players health accordingly to maintain that number.
This way is complicated and probably buggy, so the best solution is to fill the health on pick up and keep it full while the vest is on.
We could still do the intial health thingy to reset the health back when they take it off.
Anyway, this method would not require the editing of any enemy scripts.

I'll start on this method right away and here is how it will work. (in theory)

We have a Body Armour entity as a pickup that runs a single script.

Once we obtain it, then the body armour has a key to toggle it on or off. (with HUD indicator)

When it's on you have full health, and that doesn't change until you take it off. (or when it wears out if on a timer)
When you take it off, then your health returns to the amount of health you had when before you put it on, and you start taking damage again if shot.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 17th Jan 2009 19:07 Edited at: 17th Jan 2009 19:55
Always can count on you, CE.

Every Saturday morning I have brunch with a good friend. Today was not a very good day in the sense that my thinking ability (communication) was down. This is the handicap I have since the stroke and TIAs. Although I still had a great time as he is very patient with me. So, a lot of the time I just can't think things through too deeply anymore. Or, it takes me a lot longer to do so. I still seem to have the ability to get things started quickly though.

Looking forward to what you come up with.

I was playing around with your puppet script and camera lift script and hopefully will respond in the appropriate thread soon.

Addendum:

RE: timer

I can't remember for sure but is it true that the timer is global and therefore if one is using it for an entity over a longer period of time, you would not be able to use the timer for something else? I use the timer a lot but they are in sequence and never conflict because this is how I thought it worked. For example you sometimes need a timer to make sure enough time has elapsed if using the scancodekeypressed condition so that the internal variable would be reset. I know ply's mod has available entity timers so that more than one entity at a time can have a timer for it. I'm not using Ply's mod right now because of internal bug fixes in the newer versions. Ply's mod uses v1.07 source code so is buggy (not his fault - his code is not buggy).

I do like that idea of the armour concept and it conforms to how a lot of super armour works in games. Your health is not affected at all by an enemy's shots until you lose the armour. Going back to the health prior to getting the amour would be a good plan in game design I guess.

My perception (because I'm not a gamer) was not very realistic or with enough understanding for gaming and was trying to do it the hard way anyway by replacing the health with that which was lost programmatically. Keeping it at full health which is 500 would definitely be easier.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 17th Jan 2009 21:31
Quote: "I can't remember for sure but is it true that the timer is global and therefore if one is using it for an entity over a longer period of time, you would not be able to use the timer for something else?"


Conjured came up with a way to use the global timer in conjunction with variables to produce some pseudo-timers. They wouldn't be as accurate at counting milliseconds, but they'd do the job for things like whole seconds or even half-seconds.


For health, to keep the script to a minimum on line count, I'd suggest simply forcing the player's health back to it's maximum value while armor is active. To keep player's from taking advantage of this "heal", don't give them the option of turning it off and then back on.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Jan 2009 21:36
Quote: "I can't remember for sure but is it true that the timer is global and therefore if one is using it for an entity over a longer period of time, you would not be able to use the timer for something else? "

Yeah the timer is global, but I have made a multiple timer script for the stock engine.
So, lots of things can have separate timers without a mod, but there is a minor setback.
Right now the multiple timer script is set up for only five timers and each of them are on one second intervals. (have to read in whole seconds)
That would not be a problem for the body armour, but some timers need to determine fractions of a second.
The script I made can be easily moidified to do tenths of a second by removing one zero, but then you have to read in increments of tens instead of ones to determine full seconds.
Anyway, not trying to confuse you here, because that multiple timer script is simple.
So, check it out.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Jan 2009 21:38 Edited at: 17th Jan 2009 23:25
Quote: "don't give them the option of turning it off and then back on."

lol
Your post wasn't there when I posted...took awhile for me to gather my thoughts.

My idea was for takiing it off is this...

Yeah you have X seconds of armour life available, so taking it off allows you to save it for later.
That way, you only put it on and use it when you need to.
While you have it on the time remaining elapses.
While you have it off the timer for the armour pauses.

That gets tricky though because technically the timer still keeps going.
We have to read its value and save it in another variable so we can set it back when its put back on. (just like the health)

OOPS! sorry for the double post.
Don't feel bad flatlander, my thoughts get cloudy too but I have never had a stroke so I have no excuse.

I think it is all doable, so I'm going to get started now. (I nodded out earlier, sorry)


Edit
Okay guys & gals...
I have the basic functionality down now, so you can pick it up and toggle it on and off.
I have it squeezed into 27 lines, which included a comment for every state!
However I am doing the increments/decrements by 1 so it takes forever, and I need to add 10 to 20 lines to streamline that process.
So, we should have everything but the timer worked out in less than 50 lines.

So far its working great so I'll keep you posted.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 17th Jan 2009 23:31
Cool, CE.

RE: your multiple timers

Well, this is how my brain works. I even posted to your thread. Now I have put the scripts in FPI EditPad and saved them so I now have them available when I'm looking at what scripts I have. Also, I put all the comments in the reset timers script so I can remind myself how to use them.

Plystire, thanks for the comments. I was wondering if you were going to find this thread.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Jan 2009 23:42 Edited at: 18th Jan 2009 01:11
Thinking about the timer when its off made me think about extended periods of time.
So, I think it would be best to have it put a max time on the timer so it would still decay if they left it off too long.

Yeah, thanks Plystire and I agree about the cheating aspect.
The only reason I want the ability to take it on or off is that I like to create as much interaction with the user as possible. (choices vs. limitations)

Edit
I added 18 lines to this and now the increment/decrement is working better.
I'm going to add a few HUDs for this now, and then work on the timers.

2nd Edit
Oh my, the HUDs really set it off.
I made a HUD for the body armour on as a semi-transparent shield that overlays the players health HUDs. (my hud stinks (temp) but the effect is nice)
I also added a HUD that fades out for taking off the armour that lets you know the health is being restored.
The eyehud doesn't let you forget, so I added that message because I didn't want them freaking out about that.

Now, for the timer. (To be continued...)

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 18th Jan 2009 01:05
Yea, (pumps arm up and down), cool huds possibly included.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Jan 2009 03:32 Edited at: 18th Jan 2009 03:53
Quote: "cool huds possibly included"

Are you making them, because I whipped mine up as temps so I could get back to scripting. (so my HUDs are only examples because they stink)

Anyway....TADA!

I am finished, and it works exactly as I had planned, toggle, HUDs, timer, and all.

When you pick up the armour, it automatically equips and displays a hud showing its full.
While equipped it decays every 5 seconds through 6 stages to give you 30 seconds or so of body armour. (this can be easily adjusted to suit your needs)
When unequipped, your health is restored and it decays every 30 seconds for the same six stages. (giving you 3 minutes plus to hang on to it (adjustable))
Every stage has a separate HUD that shows the armour level decreasing.
When it runs out your health is restored and the HUD disappears.
The decay level HUDs are displayed the whole time, until the time has expired.
A quick glance at the health tells you whether it is on or not. (500 means its on and anything less means its off)
And yes, while unequipped the player does take damage.

I am so happy with the results that I am almost tempted to make a thread for it, rather than listing it in this discussion.
I thought that might be better so it will be easier to give support. (that way I won't get confused about questions for other scripts posted here)
What do you think FlatLander, you won't be mad if I make a separate thread and link to it from here will you?


Edit
By the way, my version came in right around 100 lines (99 if I didn't miscount) not counting the blank spacer lines between states.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 18th Jan 2009 04:14
Quote: "Are you making them, because I whipped mine up as temps so I could get back to scripting. (so my HUDs are only examples because they stink)"


Oh, I thought you were going to tweak them. Well, I don't have a decent armour image. So, if you can send it to me I'll see what I can do. Or is it the original image that stinks. However, I'll bet you a dollar to a donut that your hud is extremely adequate anyway.

Quote: "What do you think FlatLander, you won't be mad if I make a separate thread and link to it from here will you?"


I absolutely will not be mad. Thanks for asking but I'm a very flexible kind of guy. Besides you had already taken over this thread. So, start the new thread already I wanna see the code. And even if nobody is responding to this thread I bet there are a lot more people interested in it.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Jan 2009 04:39 Edited at: 18th Jan 2009 04:46
Quote: "Besides you had already taken over this thread. So, start the new thread already I wanna see the code. And even if nobody is responding to this thread I bet there are a lot more people interested in it."

Taken over?

I was just trying to participate in the discussion by sharing my two cents on the subject.
This Body Armour is something I had been tossing around in my head since v1.09. (I had originally intended this for sale)

Sorry, I wasn't trying to be pushy or 'take over' the thread or anything.
I just finally got motivated enough to sit down and see it through.

Maybe I am the reason people are not responding? (I thought more people would have been kicking in ideas too)

I'll post the script and temps HUDs now if you guys want, but I really need to make a model for the pick-up item. (and a hud for the "You Picked Up Body Armour" message)
The only thing with posting them now is that you will need to use some other entity for the pick up.
I mean, you will see how it works, but you will be picking up a battery instead of a body armour object.

Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 18th Jan 2009 04:59
If you want I'll make a quick body armor model for you CE. 007 style maybe? similar to attached pic was what i was thinkin of.

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Jan 2009 05:38
Quote: "If you want I'll make a quick body armor model for you CE. 007 style maybe?"

That would be excellent. (I was imagining 007 body armour when I thought about it)
Put it in the Models & Media titled "Body Armour" or something. (there is only 1 match for that in the search)
That way I will have the script in the script forum linking to your model and you can have the model linking to the script maybe?
Then we can have the body armour in both forums without it being a double thread because your model and my script are separate things by different people.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 18th Jan 2009 05:40 Edited at: 18th Jan 2009 05:45
Quote: "Taken over?

I was just trying to participate in the discussion by sharing my two cents on the subject."


I was kidding CE. I didn't mind that at all! See the LOL funny face? It's just that you were doing all the work and I was now eating your dust. True but just being funny. Your two cents worth was worth a lot more than two cents.

Quote: "Sorry, I wasn't trying to be pushy or 'take over' the thread or anything.I just finally got motivated enough to sit down and see it through. "


I didn't think you were pushy. I thought it was great that you got so enthused with it since I was having trouble wrapping my head around it. And, you were not taking over the thread anyway because it was all on-topic.

Quote: "This Body Armour is something I had been tossing around in my head since v1.09. (I had originally intended this for sale)"


I'm willing to buy it the whole ball of wax as it were.

Quote: "I'll post the script and temps HUDs now if you guys want, but I really need to make a model for the pick-up item. (and a hud for the "You Picked Up Body Armour" message)
The only thing with posting them now is that you will need to use some other entity for the pick up.
I mean, you will see how it works, but you will be picking up a battery instead of a body armour object."


The script was what I was really interested in. I could eventually come up with all the other stuff that needs to come with it.

Do what you feel is right for you. As I said, I'm flexible.

How much would you sell just the script?

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Jan 2009 05:46
Quote: "How much would you sell just the script?"

Nothing
It is FREE now.
I just finished an example (place holder) for the pick up HUD. (bodyarmourpickedup.dds)

I'll ZIP it all up and post it in a few minutes. (need to type the instructions for setup, etc)

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 18th Jan 2009 05:54 Edited at: 18th Jan 2009 05:55
Quote: "Nothing
It is FREE now."


You are too kind. I am serious. That is very generous of you. All the younger people on limited budgets will also be grateful. Thanks. You are the man. King of scripting. Well, Plystire is too. He mods and helps, you provide full scripts for the stock engine (this one and the store script and you have introduced me to some commands (camera lift and puppet scripts) that I did not really know how to use and now I do. I can go now go from there.

OK enough gushing and slobbering.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Jan 2009 06:00 Edited at: 18th Jan 2009 06:24
Quote: "You are too kind. I am serious. That is very generous of you. All the younger people on limited budgets will also be grateful. Thanks."

You are welcome and I hope they appreciate it because this is one of my best scripts.
Plystire has the advantage over me because he has dug into the source code, so he knows which commands do what and which descriptions are wrong.
Everything I do is from trial and error, so it takes a lot longer because of the test builds. (lots and lots of test builds)

Anyway, I have it zipped and here is the link to the Conjured Body Armour.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 18th Jan 2009 20:58 Edited at: 18th Jan 2009 21:05
Quote: "Plystire has the advantage over me because he has dug into the source code, so he knows which commands do what and which descriptions are wrong.
Everything I do is from trial and error, so it takes a lot longer because of the test builds."


I'm a very impatient person, lol. I dislike running test after test, which is why I initially openned up the source. I believe there was something rong with a script of mine way back when, and nobody had an answer to it, so I figured I'd pop out the source code and take a look see. Eventually I fixed the problem in the source myself (This was the V1 source), but quit when I realized there were many more extenuating problems that came with it.


I'll take a look at your armor script. I'm quite interested.


[EDIT]

Quote: "The only reason I want the ability to take it on or off is that I like to create as much interaction with the user as possible. (choices vs. limitations)"


At last!!! You understand the reasoning behind Ply's Mod!

[/EDIT]


The one and only,


Login to post a reply

Server time is: 2024-11-24 18:47:19
Your offset time is: 2024-11-24 18:47:19