Hyper.nl Unreal Services Forum Index Hyper.nl Unreal Services
The forum of Hyper.nl Unreal Services and the semi-offical resource for Winged Unicorn's Unreal mods
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Yes I really do suck at unrealscript...

 
Post new topic   Reply to topic    Hyper.nl Unreal Services Forum Index -> HelpDesk
View previous topic :: View next topic  
Author Message
Cheese



Joined: 30 Mar 2006
Posts: 79
Location: ...YES

PostPosted: Sat Jul 29, 2006 12:45 am    Post subject: Yes I really do suck at unrealscript... Reply with quote

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
View user's profile Send private message
[B@D]Thug



Joined: 07 Oct 2005
Posts: 315

PostPosted: Sat Jul 29, 2006 2:02 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address MSN Messenger
Cheese



Joined: 30 Mar 2006
Posts: 79
Location: ...YES

PostPosted: Sat Jul 29, 2006 2:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Hyper



Joined: 24 Jan 2004
Posts: 1227
Location: Middelburg, The Netherlands

PostPosted: Sat Jul 29, 2006 2:55 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
SoulReaver



Joined: 15 May 2004
Posts: 162

PostPosted: Sat Jul 29, 2006 12:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cheese



Joined: 30 Mar 2006
Posts: 79
Location: ...YES

PostPosted: Sat Jul 29, 2006 7:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
SoulReaver



Joined: 15 May 2004
Posts: 162

PostPosted: Mon Jul 31, 2006 8:48 pm    Post subject: Reply with quote

... until it hits a wall or an enemy ...

this is what you wanted not? i actually didnt read the script.
_________________
Before asking, try the Unreal wiki here.
------------------------------
New UT3 Community site.
Back to top
View user's profile Send private message
Cheese



Joined: 30 Mar 2006
Posts: 79
Location: ...YES

PostPosted: Mon Jul 31, 2006 9:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Hyper.nl Unreal Services Forum Index -> HelpDesk All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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