PDA

View Full Version : Please help a dumbassed mapper!!!!


Grazor
13th Nov 2001, 05:51 PM
Hi All,

Does anybody have or know of any code that would allow me to change the gravity in a zone mid game, from a trigger?

I am currently building an assault map where one objective is to blow up a gravity generator. This then triggers a change in gravity from normal to low.

I can only think of two ways to do this, both require scripting of a new zoneinfo actor.

1. add a bEnabled switch to the zoneinfo allowing it to be switched on and off

or

2. add an extra set of settings for the zoneinfo allowing you switch between.

However I know nothing about coding and may well be talking out of my ***insert body part of your own choice here***.

Can anyone help me?

Cheers

Brood_of_Evil
13th Nov 2001, 10:47 PM
Well I recall seeing a trigger called zone trigger in the "Triggers" section, maybe you can try that

tarquin
14th Nov 2001, 04:52 AM
ZoneTrigger is only used for specific things like WarpZones AFAIK.
Zones have a regular trigger too.

I'd say subclass ZoneInfo, and add a Trigger() function that changes the grravity value.

Grazor
14th Nov 2001, 09:12 AM
Thanks Tarquin,

I created a script for a GravZoneInfo actor as suggested, with a bit of help from Lode at http://www.planetunreal.com/lode/

//=============================================
// GravZoneInfo.
//=============================================
class GravZoneInfo expands ZoneInfo;

function trigger(actor Other, pawn EventInstigator)
{
ZoneGravity.X = 0;
ZoneGravity.Y = 0;
ZoneGravity.Z = -100;
}

Works a treat but I have to recompile everytime I want to change the ZoneGravity value.

Is there a way of changing it so that I can change the value from the properties box in the editor?

tarquin
14th Nov 2001, 10:25 AM
At the top of the class, after the class declaration add:

var() vector TriggeredGravity;

and then change the code in the function to:

ZoneGravity = TriggeredGravity ;

you can even get really fancy & make several versions of Trigger() for different states, for example if you want to be able to toggle the gravity, or have it trigger-controlled :D

Grazor
14th Nov 2001, 11:29 AM
Thanks Tarquin,

I understand the first bit, however you lost me here:

you can even get really fancy & make several versions of Trigger() for different states, for example if you want to be able to toggle the gravity, or have it trigger-controlled

I thought it is trigger controlled already?. In my test map I used a trigger to set off the gravity change or am I missing the point?

Can you give me an example please?, I'm no coder :D

EasyRaider
14th Nov 2001, 04:30 PM
You could do something like this to be able to trigger it on and off (not tested):

auto state NormalGrav
{
function Trigger (Actor Other, Pawn EventInstigator)
{
ZoneGravity = TriggeredGravity;
GotoState('LowGrav');
}
}

state LowGrav
{
function Trigger (Actor Other, Pawn EventInstigator)
{
ZoneGravity = default.ZoneGravity;
GotoState('NormalGrav');
}
}

tarquin
14th Nov 2001, 06:36 PM
Grazor, check out Tim Sweeney's document on UnrealScript -- that has a very good explanation of what states are and what they are for.

How you use states depend on what you are doing... okay, glib way of putting it....
Actors, like bots for example, have states that describe their behaviour.
Things like movers and triggers have states that are usually fixed and set by the mapper. In a way, it means a class of actor can have several uses. The best example is SpecialEvent, which, depending on which state the mapper sets it, is basically a fundamentally different object.

I was thinking of several states that allow the mapper to change the way the zone reacts to triggers. You could have "state TriggerToggle" that toggles between gravities when triggered.

By "TriggerControl" I meant like doors that open when you step into their radius, stay open as long as you stay there, and close as soon as you step out. I think the ones in CTF-Cybrosis][ do that. Sorry about the confusion. :)