Hey folks,
I've been working on a serious project for quite some time now and I've been writing a lot of scripts lately.
I wanted to share some of those scripts , as well as new ones I write from time to time.
I hope you find these useful and if you have any questions,don't hesitate to ask.
I'll start off with something simple.
----------------------------------------------------------------------------------------
Game Timer saved in a variable
----------------------------------------------------------------------------------------
Q:Why is this useful?
A:The idea for this came from Bootlicker's "Run" game.I thought to myself,wouldn't it be nice if instead of a few messages on the screen based on timergreater conditions,you have the actual time on the screen and have it at your disposal the whole time.
So this script helps achieve that.Using any mod's variable print functions,you can show on the screen the current play time.
Using external scripts,you can add time penalties whenever you want and affect the player's performance.
So anyway , here's 2 versions of the script (1 for 1.18+ and Project Blue , and one for RPG Mod).
1.18+ and PB :
;Artificial Intelligence Script
;Header
desc = Game Timer with variable storing
;Triggers
;COMPATIBLE with STOCK FPSC 1.17+ and Project Blue
;---------------------Developer notes begin here--------------------------
;Very simple timer which writes the current time played in a variable in seconds.Could be easily adjusted to write after fractions of a second.
;Ideal for survival games as well as games with achievements.
;---------------------Actual script begins here------------------------
:state=0:dimvar=play_time,setvar=play_time 0,state=1
:state=1:timerstart,state=2
:state=2,timergreater=1000:addvar=play_time 1,state=1
;Example - show text after 10 seconds (uncomment the row below)
;:vargreater=play_time 10:fpgcrawtext=Current play time is 10 seconds.
;End of Script
RPG Mod :
;Artificial Intelligence Script
;Header
desc = Game Timer with variable storing [RPG Mod]
;Triggers
;COMPATIBLE with RPG Mod
;---------------------Developer notes begin here--------------------------
;Very simple timer which writes the current time played in a variable in seconds.Could be easily adjusted to write after fractions of a second.
;Ideal for survival games as well as games with achievements.
;---------------------Actual script begins here------------------------
:state=0:rpg_newvar=play_time,rpg_initvar=play_time,state=1
:state=1:timerstart,state=2
:state=2,timergreater=1000:rpg_addvar=play_time 1,state=1
;Example - show text after 10 seconds (uncomment the row below)
;:rpg_varisgreaterthan=&play_time 10:fpgcrawtext=Current play time is 10 seconds.
;End of Script
To use it,place it as a main script in a trigger zone or dynamic light.
To show the current time on the screen , you'd have to use the appropriate commands for the mod you are using (the basic logic is - :always:print timer variable here).The stock engine does not support it currently as far as I know (If it does,someone correct me)
----------------------------------------------------------------------------------------
Bonus - 5 Second penalty after killing a friendly character :
----------------------------------------------------------------------------------------
;Artificial Intelligence Script
;Header
desc = Add 5 second penalty after killing a certain entity [friendly]
;Triggers
:state=0:addvar=play_time 5,state=1,suspend,coloff
;End of Script
The script above must be applied to the destroy script of a character.
----------------------------------------------------------------------------------------
Poison Gas Zone [rough draft]
----------------------------------------------------------------------------------------
When within a 5 segment radius,the player is prompted to use the [V] key and put on a gas mask,otherwise he starts to lose health when within that radius.
;Artificial Intelligence Script
;Header
desc = Poison Gas [5 block radius]
;Triggers
;COMPATIBLE with STOCK FPSC 1.17+ and Project Blue
;---------------------Developer notes begin here--------------------------
;Poison Gas deadly range [5 segments].
;---------------------Actual script begins here------------------------
:state=0:dimvar=gas_mask_on,setvar=gas_mask_on 0,state=1
:state=1,plrdistwithin=500:timerstart,state=2
:state=2,timergreater=1500,varequal=gas_mask_on 0:plraddhealth=-5,state=3
:state=3,varequal=gas_mask_on 0:timerstart,state=4
:state=4,varequal=gas_mask_on 0,timergreater=1000:state=1
:always,varequal=gas_mask_on 1:state=1
:always,scancodekeypressed=47,varequal=gas_mask_on 0:setvar=gas_mask_on 1
;End of Script
Can be placed in a trigger zone and accompanied by a particle effect,simulating the poison gas.
I'll be updating this thread frequently,so stay tuned
.
PC Specs:Windows 7 Ultimate 64-bit,Intel Core i7 960 @ 3.20GHz,NVIDIA GeForce GTX 480,12GB RAM,2x Western Digital 997GB HDD