Thread View: alt.games.unreal
2 messages
2 total messages
Started by Goldenpi
Sun, 15 Aug 2004 12:23
Script Q on triggers
Author: Goldenpi
Date: Sun, 15 Aug 2004 12:23
Date: Sun, 15 Aug 2004 12:23
65 lines
2698 bytes
2698 bytes
Im having trouble with a piece of code. When triggered, this should
create an item. Instead it creates two. At first I thought this was due
to a barrel being released on both entering and exiting the trigger
radius, but even when I trigger it using a mover the same occurs.
As the class is supposed to be spawning an item which triggers this
object when destroyed, the effect is obvious.
//=============================================================================
// ASThrower
//=============================================================================
// Sort of an enhanced version of the fireshow. Throw anything,
adjustable direction, random factors, etc.
class ASThrower extends effects;
var() Class<Actor> throwme;
var() int speed;
var() float randomfactor;
var() name objEvent;
//Auto State Animate
//{
function Trigger( actor Other, pawn EventInstigator )
{
local Actor thrown;
thrown = spawn(throwme);
thrown.SetPhysics(PHYS_Falling);
thrown.Velocity=(vector(Rotation)+(randomfactor*VRand()))*speed;
//this adds a random factor to the direction.
thrown.Event=objEvent;
}
//}
defaultproperties
{
speed=9800
randomfactor=.5// 0 to 1. 0 is no variation. 1 is maximum safe
variation. Higher is unpredictable, may fly backwards.
//Set very high for an effectively unidirectional
throw.
objEvent=none //Event to set on created objects - used when the
destruction of one object should trigger creation of the next.
bDirectional=true
throwme=class'fireworkbase'
bStatic=False
DrawType=DT_None
bHidden=True
bNetTemporary=False
RemoteRole=ROLE_None
Style=STY_Masked
DrawType=DT_Sprite
Texture=Texture'UnrealShare.Effects.SmokePuff43'
}
Re: Script Q on triggers
Author: Goldenpi
Date: Sun, 15 Aug 2004 13:47
Date: Sun, 15 Aug 2004 13:47
89 lines
4119 bytes
4119 bytes
Doesn't matter. The problem wasn't in this class, but in another
unrelated class elsewhere on the test map, which was intercepting the
trigger somehow and repeating it after two seconds - its supposed to be
for timeing, dont know how it managed to get tangled in this, some kind
of conflict with its superclass functions I think.
If you wondering what this is for, Im adding more classes to UTAllSorts,
a set of general utilities Im making while I learn the skills needed for
a more ambitions project I currently have mothballed. These are
target-shoot classes. Targets (subclasses of decoration which give a
point when destroyed), launchers, timing equipment. I want to encourage
a style of gaming where the targets are not other players. The targets
are currently barrels, but when complete will be available in a variety
of sizes and score values. Im currently working on a nice particle-burst
explosion effect.
I would be intrested if anyone has a player-protector mutator or object,
just something to stop players killing each other so they can
concentrate on the targets.
Goldenpi wrote:
> Im having trouble with a piece of code. When triggered, this should
> create an item. Instead it creates two. At first I thought this was due
> to a barrel being released on both entering and exiting the trigger
> radius, but even when I trigger it using a mover the same occurs.
>
> As the class is supposed to be spawning an item which triggers this
> object when destroyed, the effect is obvious.
>
>
>
>
>
> //=============================================================================
>
> // ASThrower
> //=============================================================================
>
>
> // Sort of an enhanced version of the fireshow. Throw anything,
> adjustable direction, random factors, etc.
>
> class ASThrower extends effects;
>
> var() Class<Actor> throwme;
> var() int speed;
> var() float randomfactor;
> var() name objEvent;
>
> //Auto State Animate
> //{
>
> function Trigger( actor Other, pawn EventInstigator )
> {
> local Actor thrown;
> thrown = spawn(throwme);
> thrown.SetPhysics(PHYS_Falling);
> thrown.Velocity=(vector(Rotation)+(randomfactor*VRand()))*speed;
> //this adds a random factor to the direction.
> thrown.Event=objEvent;
> }
>
>
> //}
>
>
>
>
> defaultproperties
> {
> speed=9800
> randomfactor=.5// 0 to 1. 0 is no variation. 1 is maximum safe
> variation. Higher is unpredictable, may fly backwards.
> //Set very high for an effectively unidirectional
> throw.
> objEvent=none //Event to set on created objects - used when the
> destruction of one object should trigger creation of the next.
> bDirectional=true
> throwme=class'fireworkbase'
> bStatic=False
> DrawType=DT_None
> bHidden=True
> bNetTemporary=False
> RemoteRole=ROLE_None
> Style=STY_Masked
> DrawType=DT_Sprite
> Texture=Texture'UnrealShare.Effects.SmokePuff43'
> }
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads