![]() |
|
|
#1 |
|
Registered User
Join Date: Jan. 10th, 2002
Location: Colom
Posts: 2
|
Hi everybody so far, this is my first post, with my first real problem. I'm really newbie to UnrealScript What I want to acomplish is a triggable ZoneInfo subclass. I mean: a ZoneInfo that can be activated/deactivated by a trigger, something like PressureZone but modifiyin gravity, so if you activate the trigger, the ZoneInfo gravity affects the player This is one of my attemps, it doesnt work at all /------------------------------------------------------------- class TriggableZone expands ZoneInfo; var() bool bZoneEnabled; //Zone is activated or not function Trigger( actor Other, pawn EventInstigator ) { if( bZoneEnabled ) { //If already activated, deactivate! bZoneEnabled = false; return; } else { //Activate the Zone bZoneEnabled = true; if (DamagePerSec != 0) bPainZone = true; } } // When an actor enters this zone. event ActorEntered( actor Other ) { if( !bZoneEnabled ) { //This is what I added (Zhark) //If the zone is not enabled (trigger-activated), it won't affect anybody return; } else { //Proceed as normal ZoneInfo ![]() Super.ActorEntered(Other); } } I know this is a lame question, with a very bad coding. ![]() I really don't know enough of UnrealScript, any suggestion, tip, help will be very appreciated. Thanks |
|
|
|
|
|
#2 |
|
Shiit
Join Date: Dec. 19th, 2000
Posts: 168
|
A much easier solution would be to just change the bGravityZone bool. This is what it'd look like:
function Trigger( actor Other, pawn EventInstigator ) { Super.Trigger(Other, EventInstigator); bGravityZone=!bGravityZone; // Toggles special gravity on/off } Um... I don't quite know whether you should toggle it in the Trigger function, or turn it on in there and turn it off in the Untrigger function. |
|
|
|
|
|
#3 |
|
Do this:
Add a variable to the new class like this: Code:
var (GravityTrigger) vector NewGravity; Code:
function Trigger( actor Other, pawn EventInstigator )
{
ZoneGravity = NewGravity;
}
function UnTrigger( actor Other, pawn EventInstigator )
{
ZoneGravity = Default.ZoneGravity;
}
I used untrigger, but if you want to toggle it you can write: Code:
function Trigger( actor Other, pawn EventInstigator )
{
if(bToggle)
{
//Toggle it
bToggle = False;
ZoneGravity = Default.ZoneGravity;
}
else
{
//Toggle it
bToggle = True;
ZoneGravity = NewGravity;
}
}
__________________
|
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Jan. 10th, 2002
Location: Colom
Posts: 2
|
Hey buds thanks a lot!
Look you made my smilie change I'm gonna try the new code right now... Without your help I could've been needed weeks to figure it out ('cause I first have to learn UnrealScript) As soon as I finish my level, I'll let you know! See ya |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|