News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 10th Jan 2002, 02:59 AM   #1
zhark
Registered User
 
Join Date: Jan. 10th, 2002
Location: Colom
Posts: 2
Unhappy Need help creating a ZoneInfo subclass!!


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
zhark is offline   Reply With Quote
Old 10th Jan 2002, 08:27 AM   #2
Shiit
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.
Shiit is offline   Reply With Quote
Old 10th Jan 2002, 11:03 PM   #3
Brood_of_Evil
Selene's martyr
 
Brood_of_Evil's Avatar
 
Join Date: Nov. 3rd, 2001
Location: Look outside your window!
Posts: 147
Do this:

Add a variable to the new class like this:
Code:
var (GravityTrigger) vector NewGravity;
And add this code:
Code:
function Trigger( actor Other, pawn EventInstigator ) 
{ 
     ZoneGravity = NewGravity;
}

function UnTrigger( actor Other, pawn EventInstigator ) 
{
     ZoneGravity = Default.ZoneGravity;
}
That way you can set the new gravity in the editor in defaultproperties without having to compile the whole class again.
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;
     }
}
Either way works fine
__________________
Brood_of_Evil is offline   Reply With Quote
Old 11th Jan 2002, 06:37 AM   #4
zhark
Registered User
 
Join Date: Jan. 10th, 2002
Location: Colom
Posts: 2
Talking

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
zhark is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer