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 / Re-appearing characters for better performance

Author
Message
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 21st Jul 2011 16:49 Edited at: 22nd Jul 2011 01:13
Hi guys,

i talked with ched80 about this before and trying around with this for a time now.

its about story-characters that you have/want to visit more than 1 time. normally you will trigger the character, mainscript starts (lets say a shopseller-character), you do your things and go into other map areas. when the character is set up that you can visit him again (buy other items for example), the character will stay on the map and sometimes eat performance without doing anything usefull. pb-mod does this on its own i heared, but fpsc vanilla has some problems and calculate the character even when it should not, ending in a decrease of performance. no good.

here is a solution i worked on to destroy the character when you leave his place and reappears when you enter his place again.
its very simple concept using variables and nearly endless cloning.

i have attached the neccessary files you need for a little demonstration.

open a map with heavy performance and place a character(with waypoints to get the sample working) in a place where you can see framelags when character is placed. check performance and frames with normal appearing so you have some numbers to check.

- name character "quester", then exchange the appear- and mainscript to the attached ones "appearchar1.fpi" and "mainchar1.fpi". setup the character as showed in the jpg-file in the attached folder.

- build a triggerzone anywhere on the map and set mainscript
"varzone1.fpi"

- build a triggerzone for defining the area where you want trigger the character and set mainscript "charzone1.fpi"

thats it. when you enter area, character appears and runs his mainscript. when you leave the charzone1, characters dissappears (> framerate increase), reappearing again when you enter the zone again.

i dont check the time how long the 100.000.000 copies last, but it should be a few hours, so enough to get through your whole level 10 times^^

some limitations at the moment:

not usable for: characters that should be shot. char gets destroyed when plr leaves zone, so when enters again, a new copy of the char appears with full life. when char gets shot to death, a new copy will appear instantly.

not usable for: plr-multilife setups, char will be permanently dead when map get restarted after plr looses a life. same for restarting saved games i think, but did not test it.

not usable for: ragdoll/leavecorpse-destroy scripts, dead character has to be destroyed completely so the next copy can be spawned.



i will work on with this and see if i can do it also for leavecorpse-deaths, should work with defining variables for different actions inside the destroy-script.
oh, i set the mainscript up as a follow-waypoint to see some performances, but you can set up any mainscript you want, simply set up the varset-lines into your script and it works. so you can also trigger differnt performances with varzones to change behavior with each time you enter the zone again. play around with this, it works as a normal character in the above described limits.

its a good one for me for rpg-elements, i hope it will help some of you.


gz

maho

Attachments

Login to view attachments
bruce3371
14
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 21st Jul 2011 17:14
Sounds very usefull. I have a question; can this be made to work with entities other than characters?

For example, I have an airlock scripted in one of my levels, with combat on the other side. If I die and respawn at the start of the level, I can't get back through the airlock. So can I use/adapt these scripts to 'reset' the airlock so that I can use it again?

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 21st Jul 2011 17:22
Yes, I see that you could to an extent use this to make clones. Great work.


Cheers.

God help me, Please.
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 21st Jul 2011 17:29 Edited at: 21st Jul 2011 17:33
@bruce3371:

post problem and the triggerscript of your airlock in a thread, i am sure anybody will help you. depends on how you trigger the action.
bruce3371
14
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 23rd Jul 2011 01:04 Edited at: 23rd Jul 2011 01:10
Thanks, but I don't have a problem - I was merely asking if the script could be adapted to be used with entities other than characters.

BTW, I'm not asking for the adapted script to be written for me, I only require a yes or no answer; I'll do the adaptations myself (with credit given to yourself for the original script of course)

maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 23rd Jul 2011 03:50 Edited at: 23rd Jul 2011 04:16
@bruce:
oh, ok.

yes, but the clones and so the whole entity will be destroyed at restart of the level, so it doesnt work for the dying-sample you talked above,sorry. but post your airlock-script in a thread please, i think you can control it with vars so it will work everytime. show us.

@all:
yes, sure you can use this method with every clonable entity that uses appear/mainscripts and can be activated, so nearly all nonstatic objects.

i didnt think so far and havent check, but with simply set up appearscript and mainscript like the sample above, it should work for whole room enteriors appear and reappear with a single trigger.
i only saw the big performance-problem with character-calculation, but you are right. could be that this will be a realy big performance saver especially for smaller systems to create big levels. it will be a beast of work for scripting and naming, but it should work.


wow, thank you for pushing my mind in this direction,bruce. i will test it when i got time for (will be fun ) and work for destructable variants of this.

feel free to do this own your own, people.


only problem still remaining until tgc will change this is the automatic clone destruction when restarting the level. we cant do anything against this i think.

someone any ideas how to deal with this?
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 23rd Jul 2011 12:35
I've managed to alter the spawning code via my FPSC mod (see ched's mod) to do what you want and a but more.

The code is available to everyone so it all depends on whether TGC decide to incorporate it or not.

maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 23rd Jul 2011 17:53 Edited at: 23rd Jul 2011 17:54
@ched80: great news. lets see what tgc will do.

tested noncharacter-entities and yes, works as with npcs. now i will do a big reappearing stockroom. my system is too powerfull to see changes in performance with only non-npc-nonstatics, but i will upload it when done, eventually anyone here with lower system can test.
technotdc
13
Years of Service
User Offline
Joined: 13th Apr 2011
Location:
Posted: 23rd Jul 2011 22:36 Edited at: 24th Jul 2011 00:55
Hi ......


I used your scripts for re-spawn my zombies (to create a infinite zombie zone)



http://www.youtube.com/v/1-FiF-nj8gk



because they don't shoot...

any help for the zombi character attack ????

(I just only want when they are close ,remove me health.....don't worry animation )


PD -I'm trying edit your charmain1 script (whith plrdistwithin and plraddhealth commands) but i can't do

PD2 -the original main script for zombie is zombie_apocalypse\zombie1.fpi



(sorry my bad english...)

thanks ¡¡¡¡¡
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 24th Jul 2011 02:54 Edited at: 24th Jul 2011 02:59
do it the other way. make a copy of the original zombie script and add

:varequal=char1 0:destroy
:varequal=char1 1:state=0

on top of the script right before the first state=0. use the copied file with this inserted snippet instead of my mainscript,should work then as the original zombie but with my trigger. as said, you can do this with every mainscript you want to use.
technotdc
13
Years of Service
User Offline
Joined: 13th Apr 2011
Location:
Posted: 24th Jul 2011 16:01
maho76......yes......it work now


did not work the first time ,but I have changed the state of the zombie1.fpi script and now work


Thanks

Login to post a reply

Server time is: 2024-11-24 06:52:36
Your offset time is: 2024-11-24 06:52:36