|
Hyper.nl Unreal Services The forum of Hyper.nl Unreal Services and the semi-offical resource for Winged Unicorn's Unreal mods
|
View previous topic :: View next topic |
Author |
Message |
Cheese
Joined: 30 Mar 2006 Posts: 79 Location: ...YES
|
Posted: Sat Jul 29, 2006 12:45 am Post subject: Yes I really do suck at unrealscript... |
|
|
Code: |
class FJturret expands Projectile;
var int numblades, numexplo;
var() sound shootsound;
function PostBeginPlay()
{
local rotator RandRot;
Super.PostBeginPlay();
Velocity = Vector(Rotation) * Speed; // velocity
RandRot.Pitch = FRand() * 200 - 100;
RandRot.Yaw = FRand() * 200 - 100;
RandRot.Roll = FRand() * 200 - 100;
Velocity = Velocity >> RandRot;
PlaySound(SpawnSound, SLOT_Misc, 2.0);
Settimer(1.0,true);
}
Function timer()
{
if (Numblades <= 14)
{
Spawn(class'razorblade',,,location);
PlaySound(shootsound);
numblades++;
Settimer(0.3,true);
}
else if (numexplo <= 4)
{
numexplo++;
settimer(0.3,true);
}
else
{
Spawn(class'ballexplosion',,,location); // <-----HERE IT IS :(
Destroy();
}
}
simulated function ProcessTouch( Actor Other, Vector HitLocation )
{
local int hitdamage;
if (Other != Instigator && FJturret(Other) == none)
{
if ( Role == ROLE_Authority )
Other.TakeDamage(damage, instigator,HitLocation,
(MomentumTransfer * Normal(Velocity)), 'exploded');
Spawn(class'ballexplosion',,,location);
Destroy();
}
}
simulated function HitWall( vector HitNormal, actor Wall )
{
Super.HitWall(HitNormal, Wall);
PlaySound(ImpactSound, SLOT_Misc, 0.5);
mesh = mesh'Burst';
Skin = Texture'JArrow1';
SetPhysics(PHYS_None);
SetCollision(false,false,false);
MakeNoise(0.3);
PlayAnim ( 'Explo', 0.9 );
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
Spawn(class'ballexplosion',,,location);
Destroy();
}
simulated function AnimEnd()
{
Spawn(class'ballexplosion',,,location);
Destroy();
}
|
stupid code tag wont let me bold :p
For some reason (on internet play only) the projectile doesn't get destroyed.
The ballexplosion IS spawned. However, the projectile just keeps on going until it
hits a wall or an enemy.
ehhh.. what the hell? can someone please help with this?
(btw the remote role is ROLE_SimulatedProxy) _________________
Last edited by Cheese on Sat Jul 29, 2006 3:41 am; edited 1 time in total |
|
Back to top |
|
|
[B@D]Thug
Joined: 07 Oct 2005 Posts: 315
|
Posted: Sat Jul 29, 2006 2:02 am Post subject: |
|
|
Ive seen your mods when they turn out. Theyre pretty good in my opinion. I dont really think about the script work, Just what you can create. Maybe thats what people are after, Hopefuly. Keep trying till you get it. _________________ Improvements along the way friends and foes.
WebSite:www.freewebs.com/agressivetoys |
|
Back to top |
|
|
Cheese
Joined: 30 Mar 2006 Posts: 79 Location: ...YES
|
Posted: Sat Jul 29, 2006 2:19 am Post subject: |
|
|
Code: |
var int numblades, numexplo;
var() sound shootsound;
var bool bfell;
function PostBeginPlay()
{
local rotator RandRot;
Super.PostBeginPlay();
Velocity = Vector(Rotation) * Speed; // velocity
RandRot.Pitch = FRand() * 200 - 100;
RandRot.Yaw = FRand() * 200 - 100;
RandRot.Roll = FRand() * 200 - 100;
Velocity = Velocity >> RandRot;
PlaySound(SpawnSound, SLOT_Misc, 2.0);
Settimer(1.0,true);
}
Function timer()
{
if (Numblades <= 14)
{
Spawn(class'razorblade',,,location);
PlaySound(shootsound);
numblades++;
Settimer(0.3,true);
}
else if (numexplo <= 4)
{
numexplo++;
settimer(0.3,true);
}
else
{
if (!bfell) // <-------------LOOK HERE
{
Spawn(class'spriteballexplosion',,,location);
SetPhysics(PHYS_Falling);
bfell = true;
}
Gotostate('Boom');
}
}
simulated function ProcessTouch( Actor Other, Vector HitLocation )
{
local int hitdamage;
if (Other != Instigator && FJturret(Other) == none)
{
if ( Role == ROLE_Authority )
Other.TakeDamage(damage, instigator,HitLocation,
(MomentumTransfer * Normal(Velocity)), 'exploded');
Spawn(class'spriteballexplosion',,,location);
Destroy();
}
}
simulated function HitWall( vector HitNormal, actor Wall )
{
Super.HitWall(HitNormal, Wall);
PlaySound(ImpactSound, SLOT_Misc, 0.5);
mesh = mesh'Burst';
Skin = Texture'JArrow1';
SetPhysics(PHYS_None);
SetCollision(false,false,false);
MakeNoise(0.3);
PlayAnim ( 'Explo', 0.9 );
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
Spawn(class'spriteballexplosion',,,location);
Destroy();
}
simulated function AnimEnd()
{
Spawn(class'spriteballexplosion',,,location);
Destroy();
}
State Boom
{
Function Timer() // <--------- AND HERE TOO
{
Spawn(class'spriteballexplosion',,,location);
Destroy();
}
Begin:
settimer(1.0,true);
}
|
i fooled with it a bit(when it's done shooting it should explode
fall from the sky) and.. now it doesn't fall either. The explosion is spawned
where it's supposed to be after falling for some reason..
and btw setting the remote role any higher that
ROLE_SimulatedProxy just basically screws it up.
blah. does anyone know what the problem is?
@thug:thanks, but the thing is, this is the.. how you would say.. promotional weapon
for Uber5.. I need it to work properly, or else..well, it will be crap
EDIT: ok I added code hyper :p
EDIT2: It actually works perfectly in Single player, so I don't thnk
anything is wrong with the script itself.. _________________
Last edited by Cheese on Sat Jul 29, 2006 3:48 am; edited 3 times in total |
|
Back to top |
|
|
Hyper
Joined: 24 Jan 2004 Posts: 1227 Location: Middelburg, The Netherlands
|
Posted: Sat Jul 29, 2006 2:55 am Post subject: |
|
|
Cheese: Here is a small tip. Not for the UScript but for the forum. When you post things like source code, you might want to put it between. [code] tags.
When you do so, it looks the same as in notepad with the original lay-out.
If you want, use the edit button to replace the current blocks of source code in your messages with ones between the [code] tags. _________________ Alter your reality...forever.
Hyper.nl Unreal Services
unreal://hypercoop.tk |
|
Back to top |
|
|
SoulReaver
Joined: 15 May 2004 Posts: 162
|
Posted: Sat Jul 29, 2006 12:52 pm Post subject: |
|
|
normally it has to do with the role, normally if you make guns; locally they will work. but on a server they wont. usually then there is something wrong with the role.
also sometimes you need:
Code: | if ( Level.NetMode != NM_DedicatedServer ) |
and other NetMode checking.
well if im right, role_simulatedproxy makes both client and server run the script. _________________ Before asking, try the Unreal wiki here.
------------------------------
New UT3 Community site. |
|
Back to top |
|
|
Cheese
Joined: 30 Mar 2006 Posts: 79 Location: ...YES
|
Posted: Sat Jul 29, 2006 7:09 pm Post subject: |
|
|
Setting the role higher (ROLE_AutonomousProxy) will make
the projectile shoot 2 at a time instead of 1, and it won't move forward.
But it will explode properly. hmm..
I've put the "if ( Level.NetMode != NM_DedicatedServer )" into
the script, now on Internet play it just continues on until it hits a wall
or an enemy.
Well, It's not working perfectly, and.. I guess It won't be able to work perfectly. Oh well. It should suffice.
Anyways, thanks for the help. _________________
|
|
Back to top |
|
|
SoulReaver
Joined: 15 May 2004 Posts: 162
|
|
Back to top |
|
|
Cheese
Joined: 30 Mar 2006 Posts: 79 Location: ...YES
|
Posted: Mon Jul 31, 2006 9:04 pm Post subject: |
|
|
I had it explode in the air (once it's done shooting), then fall to the ground and blow up.
Don't get me wrong, it's okay when it doesn't, but exploding just gives it a cooler effect. _________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|