Script Resource

Creating new content for Trespasser!

Moderators: TresCom Support Team, TresCom Board Managers, TresCom Developers

Post Reply
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Script Resource

Post by RexHunter99 »

Hey guys, been a while.
Well after playing JPDS, and seeing all the great little things Draco and co have put in there (really well done guys) I thought I might replicate a few of the more interesting features. The first thing i attempted was the drinkable canteen and health system (with some overlay text to go with it)
This is the first time in a long while I've dabbled in TScripting events so it's like a breath of fresh air to me.

What exactly I will throw into this level isn't exactly known to me yet, but I will be posting a download to the minilev that contains all this for you to learn/judge.

Draco has pretty much opened the door for a thousand new possibilities and Trespasser no longer seems so static or linear to me. I'd love to make a level that's like an RPG with free-roam and a main story to play (if you choose) would be fun, but I'd have to get into Scripting again :)

Stay tuned fellows.
  • Food & Drink Script - Link
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: Script Resource

Post by RexHunter99 »

Food & Drink Script

Alright first upload. It's fairly simple actually, the way I've done it can be refined further (as TScript gurus will surely be able to do and point out) I can already see an improvement to be made, however that is irrelevant really.
What I've done is supplied three canteens, two of them heal you, the third will cause you to become irradiated, and you will slowly die of radiation poisoning (this is all best viewed with ATX HUD on or in a level with a working Anne tattoo) each canteen has it's own TScripted trigger (it has to have its own, I can't think of a way to globalise it) and performs a sequence of grouped actions.

Here's the Script itself:

Code: Select all

group Trig_PCanteen01Drink = {
    string Class = "CObjectTrigger"
    string A00 = "<INSERT INSTANCE NAME>"
    bool UseObject = true
    int ProcessStyle = 3
    int FireCount = 1
    group Action00 = {
        int ActionType = 34
        string OverlayText = "Drank: Water"
        float R = 0.000000
        float G = 1.000000
        float B = 0.000000
        float TextDisplayTime = 2.500000
        int TextPosition = 0
    }
    group Action01 = {
        int ActionType = 23
        string Sample = "DINO-CARN-SWALLOW"
        string Emitter = "Player"
    }
    group Action02 = {
        int ActionType = 17
        string ObjectName = "Player"
        float Damage = -10.000000
    }
}
This is an ObjectTrigger, which activates only when you use the instance specified by A00 and it fires once and never again. Actually now that I think of it, you can use FireCount to give items multiple uses. I believe ObjectTriggers only fire if you PickUp/PutDown/Use the item, so FireCount won't change unless you do one of those actions.
If the instance was used, Action00 is run which displays the text in green.
Action01 plays the swallow effect sound borrowed from the Carnivore swallow :)
Action02 heals the player, negative damage adds health.

Some more information as well, well suggestions.
AT #17 can modify a few different things. You can set the HitPoints value, MaxHitPoints, Regeneration (how much health regenerates over time, I believe 1.0 is 1 hp per second... which is the default IIRC, and 0.0 heals no hp over time.) and so on. You can do all sorts with just these values. Be creative :)

Also with the overlay text, it might be best to come up with a few different items, eg; good, mild, bad for instance. And colour code the overlay text. Green == Good, Orange == Mild, Red == Bad, this way, at a glance, players can easily tell if the effect was good or bad.

One thing I will say about this script is that Anne plays her "Ouch" VO and the screen flashes white (not so bad, I like the effect :P) ATX has a fix for this I believe, in the form of ATX AT #104 which allows you to modify the player's health without VO and effects.


Also as a final note, hopefully people remember my toxic gas trigger in beta-PF :) that was achieved via ActionType 17 ;) remember to experiment and be creative.

That's all for this post... might wrangle another interesting script tonight though. Thanks for reading folks.

EDIT:
Sorry, the forum tells me that we've reached the board attachment quota :/ So I uploaded it to mediafire:
http://www.mediafire.com/?q2nnt3i227d8r51

I might, in future, upload it to my webhost instead.
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
tatu
-=TresCom Website Manager=-
-=TresCom Website Manager=-
Posts: 5088
Joined: Fri Jun 24, 2005 9:40 pm
Antispam: No
Location: Sweden
Contact:

Re: Script Resource

Post by tatu »

This is great Rex. We need a topic where people can write and look for scripts, since it can take some time to actually learn how to make working scripts in Trespasser. Good work :)
Active project: Trespasser: Isla Sorna
Status:
BE-PH1: Released
PH2-IT: Pre-released
PL-SUM: In production

"...there used to be more benches, but InGen's workers removed them during the evacuation in the name of framerate."
User avatar
LtSten
Gallimimus
Gallimimus
Posts: 609
Joined: Fri Nov 27, 2009 8:28 pm
Antispam: No
Location: England, UK

Re: Script Resource

Post by LtSten »

tatu wrote:This is great Rex. We need a topic where people can write and look for scripts, since it can take some time to actually learn how to make working scripts in Trespasser. Good work :)
I agree, this is definitely a good idea Rex, it's useful for understanding more how scripting works, or how specific things can be done (which is its main intention).
I feel that over time this certainly has the potential to grow into a great resource.
Bringing TPA CRCs up the well, amongst other file format adventures.
Blender 3.0 TPM Plugin [Project GitHub]
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: Script Resource

Post by RexHunter99 »

Thanks :) I was hoping that this would become a repository of handy scripts and a learning resource.

I'm open to suggestion for scripts and events, Anna has already asked me if I could try out changing textures to give a level a different look based on wether it is raining or not. Definitely interested to try that, also wanting to try out a raining script.
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: Script Resource

Post by RexHunter99 »

<-Script/Instance reference

CMagnet
-------
By James Ogden (Rexhunter99)
--------------

Let's start with the most important part of this tutorial. The explanation.
What is a CMagnet classed instance? It is an instance that is invisible to the
player, but joins two objects togther. It defines special properties for
one of the joined instances to allow it to rotate, translate and break,
all three events will be explained further in later sections.

Simply, a CMagnet instance is a door hinge that can slide or rotate a door/instance.

There are many applications for CMagnet, however the most common one is for
doors. They have been used in other areas to provide objects that break when
damaged significantly, used ont he circling Pteranodon's in TC~Isle and are used
in weapons/special items Anne uses.

There is no known limit to how many times you can attach a magnet to an item.

Breakable items are best represented using CMagnet objects, instead of intricate
TScripting events.

The Slave instance MUST have physical attributes (physics/collisions)

If no Master is selected, the magnet is attached to the World (which never moves)

In theory, if you attached a moveable and collidable instance to another moveable and
collidable instance, the two instances could move while one rotates, allowing things
like car doors working on cars that move.
I have not tested this myself and I assume more experienced Scripters ahve attempted
this already and failed to produce the effect however it is very likely the
Developers intended for such real-life implementations to wokr at one stage.

------

TScript Values:
string Class; Must be "CMagnet"
string SlaveObject; Must be set to an instance name
string MasterObject; <Optional>Set to the owner of the Slave, eg; door frame.
int MinAngle; <Unused><Optional>Set to limit the rotation angle
int MaxAngle; <Unused><Optional>Set to limit the rotation angle
bool XFree; <Optional>True for X-Axis rotation
bool YFree; <Optional>True for Y-Axis rotation
bool ZFree; <Optional>True for Z-Axis rotation
bool XTFree; <Optional>True for X-Axis translation
bool YTFree; <Optional>True for Y-Axis translation
bool ZTFree; <Optional>True for Z-Axis translation
bool Breakable; <Optional>True to allow this magnet to break under pressure
float BreakStrength; <Optional>How much force must be applied to the SlaveObject for the magnet to break
float RestoreStrength; <Unknown><Optional>How much break strength restores over time? (1 == 1 unit per second?)

------
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Script Resource

Post by machf »

Hmmm... since you can create a Magnet with an ActionType and also destroy it by indicating tha name of the object it's fixed to, I think it's worth mentioning that destroying one will also destroy the rest of magnets the same object has...

Also: RestoreStrength isn't for Breakable mangets, it's for "hinge" ones (with XFree, YFree and/or ZFree set to true). Think "Western Saloon doors"...

XTFree, YTFree and ZTFree set to true act not upon the orientation of the magnet's axes, but the "world's" ones... keep that in mind. If you instance a magnet for a sliding door and then make a clone of said door and rotate it 90 degrees, the clone won't slide in a direction rotated 90 degrees to the original, it will slide in the same direction as the original (in other words, you won't be pushing it sideways, but forward or backward instead).

And sadly, no, you can't have moving cars with functioning doors so far... we've already tried. "Hinge" magnets are fixed to the "world".
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: Script Resource

Post by RexHunter99 »

machf wrote:Hmmm... since you can create a Magnet with an ActionType and also destroy it by indicating tha name of the object it's fixed to, I think it's worth mentioning that destroying one will also destroy the rest of magnets the same object has...

Also: RestoreStrength isn't for Breakable mangets, it's for "hinge" ones (with XFree, YFree and/or ZFree set to true). Think "Western Saloon doors"...

XTFree, YTFree and ZTFree set to true act not upon the orientation of the magnet's axes, but the "world's" ones... keep that in mind. If you instance a magnet for a sliding door and then make a clone of said door and rotate it 90 degrees, the clone won't slide in a direction rotated 90 degrees to the original, it will slide in the same direction as the original (in other words, you won't be pushing it sideways, but forward or backward instead).

And sadly, no, you can't have moving cars with functioning doors so far... we've already tried. "Hinge" magnets are fixed to the "world".
I thought that magnets that didn't have a master specified were attached to the world or the instance they were touching that is NOT their slave, otherwise the master is the specified instance in the value table. Anyway I mentioned theoretically as I recall I had tried doing this once with a car :P

Ahh ok, so RestoreStrength is the strength with which the hinge (XYZFree) returns to its original orientation.

Also what about havning a master magnet? A magnet that is the magnet of all instances of the object? IIRC it could be done :/
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Script Resource

Post by machf »

OK, now I realize I never uploaded the last updates to the T-script reference and the formats document... doing it now.
(And they are both from last year... go figure)
Actually, now that I see them, the Formats document had been updated back then (February 2010) but the T-Script reference wasn't (August 2010).
Take a look at the latter and you'll see some things about magnets...
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
LtSten
Gallimimus
Gallimimus
Posts: 609
Joined: Fri Nov 27, 2009 8:28 pm
Antispam: No
Location: England, UK

Re: Script Resource

Post by LtSten »

Thanks machf, interesting information there. That t-script reference is a brilliant resource...
Bringing TPA CRCs up the well, amongst other file format adventures.
Blender 3.0 TPM Plugin [Project GitHub]
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Script Resource

Post by machf »

RexHunter99 wrote: Also what about havning a master magnet? A magnet that is the magnet of all instances of the object? IIRC it could be done :/
Well, you can do it if you want breakable magnets or hinge magnets, or sliding doors that are all facing the same way, otherwise you just use individual magnets for each object...
LtSten wrote:Thanks machf, interesting information there. That t-script reference is a brilliant resource...
The way it's grown lately, I'm considering splitting it into three separate documents (general objects, triggers and actiontypes).Also planning to do a PDF version (in fact, I have one lying around), directly converted from the HTML one.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
LtSten
Gallimimus
Gallimimus
Posts: 609
Joined: Fri Nov 27, 2009 8:28 pm
Antispam: No
Location: England, UK

Re: Script Resource

Post by LtSten »

Splitting it into three may be a good idea - I'd say that in doing so you create more space to expand on any topics, if that makes sense. It'd also mean that its overall length isn't equal to 56 pages worth. I think, for us as a community, it probably wouldn't really make a difference, so if it makes managing the t-script stuff easier for you (so it's easier to edit, update, etc) then it might be worth it.

Just my thoughts! :)
Bringing TPA CRCs up the well, amongst other file format adventures.
Blender 3.0 TPM Plugin [Project GitHub]
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Script Resource

Post by machf »

Actually, it's easier to edit as a single page, but it would be easier to read as separate documents, IMO...
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14046
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: Script Resource

Post by Draconisaurus »

quite note to throw in here, for anyone reading to learn about magnets; the "transition-free" values (XTFree, YTFree, ZTFree) are extremely buggy and not dependable for anything but your basic up-and-down elevator-type object. things like sliding drawers or car seats are, regrettably, right out. look on Youtube for Tales from JPDS~Testing.
also as a general note, in most cases of an obj using free rotation, all submodels of the master object must have the same orientation as the master, and this will be used to reference which axis it rotates on. you may have noticed the crane arm in IJ does not rotate correctly; i fixed this in JPDS~Streams by bringing the crane arm + submodels into Max and manually rotating them all to 0,0,0, and rotating-snapping their meshes back into place within edit-mesh mode.
Post Reply