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 / Regeneration Script

Author
Message
Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 28th May 2008 22:32
Hi,

I've been playing around with the new varibles and have come up with this script. Basically it restores 1 point of health to the player up to the maximum approximately every 6 seconds. Hope it's useful.

To use, simply place it in a dynamic object, set the object to "Always Active" and you're up and running.

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 29th May 2008 01:45 Edited at: 29th May 2008 01:52
This is what Scene Commander's script looks like...

;Artificial Intelligence Script

;Header

desc = Health

;Triggers


:state=0,globalvar=10,setvar=0:state=1
:state=1:incvar=1
:state=1,vargreater=300:plraddhealth=1,setvar=0

;End of Script



...I don't know how to break this to you, but that is not exactly the right way to use that variable.
Your script doesn't use a timer, so the six seconds thing is only happening because the specs on your system take it that long to run.
You don't need variables to increment the players health every six seconds.

:state=0:timerstart,state=1
:state=1,timergreater=6000:plraddhealth=1,state=0

I'm not trying to be mean; just trying to help.

Don't forget to visit Conjured Entertainment

Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 29th May 2008 09:49
Always happy to take advice Conjured Entertainement, so no offence taken.

The main reason I was using the variables is I'm already using a timer script in the game I'm writing and there was some conflict, however, I agree your version is better.


Thanks for advice through.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 2nd Jun 2008 16:34 Edited at: 2nd Jun 2008 16:52
Quote: "The main reason I was using the variables is I'm already using a timer script in the game I'm writing and there was some conflict"


Oh, I see now.
Yes, having only one timer has always plagued the stock engine.
The only alternatives were to either modify the engine or use someone elses modded engine.

I have been playing around with an idea for the timer to make it several instead of one, but by using scripts instead of a modded engine.

I am working on a one second system, that increments various variables by one each second.
That way each variable becomes a timer and they all will work without conflict.
The timer script would simply increment all ten variables by one each second using our existing timer.
Any variable (timer) could have a different value than the other ones, and all would increment in sync.
To reset one of the timers you would simply reset that variable's value to zero.
I'm thinking maybe 10 timers should be enough to start with.

I think that multiple timers are possible with the stock engine thanks to the new variables in v109.
Of course, the timer script would have to cap the timer's values and reset them to zero to avoid the timer sending the variables out of range.
But checking for a value greater than 999998 would be a simple way to avoid the user's scripts from failing to reset the timers.

Any thoughts?

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 2nd Jun 2008 23:49 Edited at: 2nd Jun 2008 23:50
You know, if we were allowed to set one variable to that of another variable (I.e. Var1=Var2) then you could set up the "timer system" you have going to only use one variable for holding the time and do what programmers do to capture time increments:

- Set Var1 to Time Var
- Check if TimeVar-Var1 is greater than what you were waiting for

Man, wouldn't that be easy? Oh well, perhaps in a later update.


Or, Lee could just do what all the modders have done to conquer this problem and create local timers for each script. So far, I think Empty's Mod and my own Mod have done this. Not sure of any others that have, though.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 2nd Jun 2008 23:55 Edited at: 3rd Jun 2008 00:32
Well I just thought that this is an easy was to create ten global timers that work on single second intervals using only one timer.

I know this will work with the stock engine (v109+), so I am going to script it for my self if no one else wants it.

Quote: "I.e. Var1=Var2"

lol
I figured out a way to do var1=var2-var3 (or var1=var3-var2 depending on which var is bigger between var2 and var3) using v109.
So, I can do subtraction with the stock engine even though the engine doesn't support it.
More is possible with work arounds than most people take the time to imagine.
You guys are DBPro experts so you can mod the engine.
I rely on FPI and the new variables have set me free!

Quote: "You know, if we were allowed to set one variable to that of another variable (I.e. Var1=Var2) then you could set up the "timer system" you have going to only use one variable for holding the time and do what programmers do to capture time increments"

WE CAN set one variable to another!
It just takes three variables to do it, but the third one of those can be local.

In a way I am doing what programmers do to capture time, but in a slightly different way.
Instead of letting the one timer keep going and going; I reset mine every second.
Instead of assigning a counter variable to equal the timer; I use the timer to assign all the timer variables at once every second.
No more need to do a subtration of the nowtime-starttime variables each time I use them like programmers do.
This method sets the timer variable desired to zero at start, then checks for the value to reach its stop amount.
It is the same method but modified to eliminate the subtraction call. (I can do the subtraction but it requires more code)

Don't forget to visit Conjured Entertainment

Pride
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Eastern USA
Posted: 3rd Jun 2008 00:31
Or look here:
http://forum.thegamecreators.com/?m=forum_view&t=120919&b=23

,
==Pride


Formerly MeZo
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Jun 2008 00:34
@Pride

He said he is already using his timer for something else.
That is why he wanted to use the variables instead of the timer.

Don't forget to visit Conjured Entertainment

Pride
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Eastern USA
Posted: 3rd Jun 2008 00:39
Ah, damn, last time I only read the thread half-way through again.

Sorry then, I'm not sure how to work around that...


Formerly MeZo
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Jun 2008 00:45
Quote: " I'm not sure how to work around that"

Then read the other half.

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 3rd Jun 2008 01:08
Quote: "More is possible with work arounds than most people take the time to imagine."


I'm with everyone in being glad that you're here for that.

I'd rather work on something that I haven't already accomplished in my mod. Rather than work with the limitations, I find ways to remove them in the source. It's honestly not that hard. Almost everything in my mod has been done in less than 50 lines of code. That's about 15 minutes worth of work.


If you rely so heavily on scripting, then I do hope you look towards Mods as a possibility once the migration is over with and the Mods are all based around the latest update again. I'd really like to see your innovations go to work with a scripting system that you don't have to spend time to work around all the time.


(That was a compliment, just in case you were wondering )


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Jun 2008 02:18 Edited at: 3rd Jun 2008 02:30
Quote: "I'd really like to see your innovations go to work with a scripting system that you don't have to spend time to work around all the time."

That's ok, I'll stick with the FPI until it dies.
The FPI language is just a babe, and growing all the time.

Quote: "If you rely so heavily on scripting, then I do hope you look towards Mods as a possibility once the migration is over with and the Mods are all based around the latest update again."

Yeah, I might play around with the source myself, eventually.
I'm just not confident enough with DBPro yet because I haven't spent enough time with it.
Until I do modify the source; I will keep having fun with the stock engine.
For now, these new variables should keep me busy for awhile.

Quote: "I'm with everyone in being glad that you're here for that."

Well I'm glad you guys are here to do the mods.
I wanted to back in the beginning, but the size of the source scared me into submission being new to DBPro.

Whether its through the use of a mod or v109; I think FPSC is ready to shine.

Don't forget to visit Conjured Entertainment

Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 3rd Jun 2008 04:54 Edited at: 3rd Jun 2008 04:54
Plystire - Isn't adding local entity timers really, really easy? Just add a timer variable to the entity type definition and an action and condition to go with it right?

I mean, if you look at some of my weapon modifications you have to wonder why Lee didn't put them in at some point. I mean, rate of fire. I hate the default rate of fire being so limited. All you have to do to actually change the rate of fire is edit 1 number in 2 lines. It's that easy. If you want to make it defineable in the gunspec (as I did) all you have to do is add a variable to the gunsettings type and the check for it where it reads the gunspec (and of course modify the two lines that have the actual time to read this variable).

It's amazing how easy it is to add or fix some things in this engine, to the point it isn't even funny

Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 3rd Jun 2008 15:07
Conjured

I agree that multiple timers would be easy enough to create and is a sensible idea, although unless I'm mistaken we're only allowed 100 variables, it seems a shame to have to tie up 10 or so of them when dedicated entitytimers would be such a useful update. I was a little surprised when the feature didn't make it's way into the variable update.

Plystire

I don't actually own a copy of DBP, but have been playing around with the trail version so can't comment on the ease of modding, although I've been very impressed with your work. I do however feel if the full source code for V2 is released, so we're all working to a standard, then the only way to create truly original games would be to alter the game engine. I do find myself frustrated sometimes that features that would be easy to achieve through simple coding are difficult/impossible to create otherwise.

Having said that I think that Lee has done some great work recently and the engine as a whole has leapt ahead in the last couple of months and look forward to what the next few months will bring.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Jun 2008 08:08 Edited at: 4th Jun 2008 08:09
@Conjured:

If FPI is a babe, then I do believe the modders have been giving it some serious steroids.

The source is surprisingly easy to modify for some little effects, once you know where everything is programmed. That may sound weird, but it's like Airslide mentioned. Entity timers LITERALLY require no more than 11 lines of code. And thsoe lines aren't even very long! Here, I'll show you:




Of course, where ever there's a "..." that means there's a bunch of code in between the lines. However, to add a script command, no matter what it is, is done the same way, altering the same spots, adding to the same sections. You do it once, you'll be able to do again even easier just as long as you remember where the lines went.

The above code is actually how I made the etimer commands in my mod. No more code was needed than what was shown.

It was unusually easy to do, and yet... Lee hasn't done it. I think everyone here who scripts absolutely NEEDS the entity (or "local") timers.

With that... I'm going to go ahead and say, "There's just some things that should be modded instead of worked around." I mean, aside from the time it takes to compile, modding the source for this kind of addition is WAY faster and simpler than working around it using the FPI language given to you.

Quite sad, really.


@Airslide:

Yes... yes it is.

No, it's not funny how simple it is to do some things that tons of people have wanted for a long time, and yet... we haven't seen it in any of the updates thus far.


@Scene Commander:

Originality comes in many forms in the gaming world, IMHO. Originality can come from your game idea or from your art style or from some specific gameplay mechanics that can still be achieved with the normal FPI language or even from the story you've given to your game. But... some gaming mechanics desired by many of the FPSC users here can only be achieved through modifying the source. In that sense, yes, they would have to alter the engine to make their original concept come true.

And yes, it is very frustrating indeed.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 4th Jun 2008 08:20
Quote: "There's just some things that should be modded instead of worked around"

I agree that modding is the way to go if you know how to do it.
Today I saw that 4 month old video showing off the water effects you pulled off with bouancy and current. Sweet.
I love the way Airslides Mod has the recoil on the gun so it changes the aim. Very realistic.
That realism in the firing of the weapons would be a better upgrade to the engine than entity timers.

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Jun 2008 11:42
You know what else is amazing?
That recoil takes about as much work as the entity timers do. Lol

If you think about the amount of time it takes to put the upgrades into the source, it's no longer a question of which one is a better choice for the upgrade. It suddenly becomes a question of "Why didn't EITHER of them get into one of the updates?"

If you're going to put one in, you might as well put in both, being as they are both very easy to accomplish. With just 5 minutes out of Lee's day, he could get 'em in there.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 4th Jun 2008 15:14 Edited at: 4th Jun 2008 15:17
Quote: "If you're going to put one in, you might as well put in both, being as they are both very easy to accomplish."


Well, there must be another reason he is ruluctant to do so.
Maybe they conflict with some other plan he has in mind.
If not, then I wish he would at least include the gun thingy, because that gives it a much more professional look and feel.
Just make it with a boolean flag so we can toggle it on and off for each level and everyone will be happy.
Did you guys make yours adjustable so you can set how much kick for each gun?

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Jun 2008 15:32
Quote: "Did you guys make yours adjustable so you can set how much kick for each gun?"


Yup.

If he has some plan that these interfere with, then i'd sure like to know what that is.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 4th Jun 2008 16:27 Edited at: 4th Jun 2008 16:29
Quote: "Yup."

Sweet!
Then I guess they could just set it to zero then instead of needing that toggle.

Quote: "If he has some plan that these interfere with, then i'd sure like to know what that is."

Well, the only thing that I can think of is that maybe he wants us to learn more about programming.
If these are so easy to do, then they do make great tasks for DBPro programmers to get experience modding code.
After all, this whole thing is to have fun, and to learn a few things along the way.
You know you guys have fun playing with the source.

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Jun 2008 20:19
I have fun playing with the source when I don't end up running into another one of those "God, **** it! Why did he do it like that?! That's absolutely retarded!" pieces of code.

(That's why Ply's Mod V1.07 is taking so long to come out. )


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Jun 2008 00:53 Edited at: 5th Jun 2008 01:01
Quote: "...when I don't end up running into another one of those "God, **** it! Why did he do it like that?! That's absolutely retarded!" pieces of code."

I run into those all of the time, but I have to say 'why did I' instead of 'why did HE'.
I sometimes stay in code for more than 20 hours at a time. (about 36 is my longest I think)
By the time I am finished I have forgotten what I started on, because I have written so much code, and changed so many things because of bugs.
It is usually working around bugs that makes my code so sloppy that it finally needs a complete rewrite to clean it up in the end.
Don't forget that code (even the v1) has had many bugs eliminated in it causing extra unplanned code and changes.

'Back in the day'; I would leave my code sloppy and never comment it just to make it harder for anyone trying to change it. (its mine mine all mine)
Now I want it well commented and as clean as possible for my own sake since my memory isn't what it was. (and to share it)

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Jun 2008 08:41
Quote: " I would leave my code sloppy and never comment it just to make it harder for anyone trying to change it."


You and Lee both, man.

The source isn't nearly as documented as I would like, but it still gives little tid bits of hints as to what's going on in any particular area. And at times, even the variables give you hints as to what's going on! Look at this variable I came across:



When I saw that, I was actually thinking "Wth?" Lol


And I hear ya when you say that you forget what you wanted to get done by the time you're done coding, lol, happens all the time. I hate bugs mainly because it distracts me from what I had in my head and then I forget where I was going with the task at hand. That's why i turned to writing it all down before I start coding.


The one and only,


Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 5th Jun 2008 10:11
I've always got the impression from Lee that he doesn't want to add any new features until V2, which I imagine would include entity timers, recoil, etc. I guess all we can do in continue to canvas him for the changes we'd all really like and hope he feels they are worth the effort.

Maybe what we need is a "modders" guide, similar to the FPS hints and tips. A list of known variable names, tips on changing/adding new scripting commands, etc. I for one would find this useful and I'm sure it would encourage others who haven't considered modding to give it a go.

Login to post a reply

Server time is: 2024-11-24 09:20:34
Your offset time is: 2024-11-24 09:20:34