1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Spawning Projectile Onto Weapon

Discussion in 'Programming' started by Lulolwen, Jan 1, 2005.

  1. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    Is there a way to spawn a projectile and hold it in/on the weapon before the FireClass is activated, and when the Fire is animated either have that projectile shoot or have it disappear? I'm making a crossbow with an open top and if there's no arrow there I think it'll be a little suspicious :).
     
  2. porkmanii

    porkmanii New Member

    Joined:
    Sep 9, 2004
    Messages:
    129
    Likes Received:
    0
    Doesn't the ChaosUT2 Crossbow have an arrow on the model?

    In Unreal (1), the muzzle flashes (for the Stinger, at least) were done by making them a part of the model (but out of sight inside the gun). Whenever the gun was fired, the muzzle flashes were moved into sight (and into position), as part of the firing animation.

    The UT2003 Translocator's beacon wasn't part of the weapon model. Instead, it was a seperate Actor (that looked like a Translocator beacon), which was spawned and attached to the Translocator whenever the beacon was recalled, and destroyed whenever the beacon was placed/fired out of the gun.

    There's definitely a way to make the arrow visible before it is fired, but it would probably be best if the arrow was represented by a seperate Actor (or part of the model), rather than a projectile (up until it is fired, at which time the arrow on the model is hidden and a projectile is spawned).
     
    Last edited: Jan 3, 2005
  3. Ghost3021

    Ghost3021 Registered Hobbit

    Joined:
    Nov 21, 2004
    Messages:
    586
    Likes Received:
    0
    i agree with porkmanii in fact i had to attach a emmiter to my weapon model for looks and stuff...i attached it to a special bone i made in 3ds..
     
  4. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    pork - Looked at the CUT2 Crossbow, they cheaped out & hid the arrows in a crease of the bow (no disrespect meant to Chaotic Dreams.)

    SoH_Ghost - What kind of emitter did you use, and if it was custom, could you please post the code?

    Also, could use some help distinguishing the code in the Translocator that spawns the fake beacon from the rest.
     
    Last edited: Jan 3, 2005
  5. Ghost3021

    Ghost3021 Registered Hobbit

    Joined:
    Nov 21, 2004
    Messages:
    586
    Likes Received:
    0
    actualy, the code could be modified(with only slight tweaks) to work with Object...code...here it is!
    Code:
    var emitter effect;
    var sparkgun p;
    function prebeginplay()
    {
    If effect==none
    
    effect = Spawn(class'customsparx', p,, P.Location, P.Rotation);
    p.AttachToBone(effect, 'sparxbone');
    }
    
    i think thats it...might have some bugs. after finaly finding it, i memorized it but rathor poorly. there will be bugs....if not lemme know ued is down right now(what to feed it now...my little bro or cat?)
     
    Last edited: Jan 3, 2005
  6. [SAS]Solid Snake

    [SAS]Solid Snake New Member

    Joined:
    Jun 7, 2002
    Messages:
    2,633
    Likes Received:
    0
    That method is okay, but a much better method is to have the model meshes as a rigid skeletal mesh. When the weapon is fired, the bone is scaled down to 0.0, which also shrinks the polygons attached to that particular bone (much how xPawn dismembers). No need to spawn anything in with this method.
     
  7. porkmanii

    porkmanii New Member

    Joined:
    Sep 9, 2004
    Messages:
    129
    Likes Received:
    0
    I can't find it. I guess I must have been mistaken.

    Whatever the case, I spawned and attached a fake beacon to the first-person model of my UT2003-style Translocator, just because I thought it'd look better :). Whenever the beacon is fired the "dummy beacon" is hidden, and when the beacon is recalled the "dummy beacon" is shown again.

    Solid Snake's method is probably better, but in my case it was not possible because I was not using a custom mesh.
     
  8. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    Snake - Tried the scale technique, but it didn't work. Any other ideas?
     
  9. Ghost3021

    Ghost3021 Registered Hobbit

    Joined:
    Nov 21, 2004
    Messages:
    586
    Likes Received:
    0
    *ahem* try my idea? it might work?!no?
    heck it worked for me just extend StaticMeshActor and change under display in default properties u default mesh ect just try my way plz :)
     
  10. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    How would I attach the StaticMeshActor to a bone? Something like...
    Code:
    Spawn(class'WeaponSMActor');
    AttachToBone(WeaponSMActor, 'bone');
    Also, could I just set something in the spawning function like... to keep the rotation of the character/gun?
    Code:
    WeaponSMActor.Rotation=P.Rotation
     
    Last edited: Jan 5, 2005
  11. Ghost3021

    Ghost3021 Registered Hobbit

    Joined:
    Nov 21, 2004
    Messages:
    586
    Likes Received:
    0
    no, to keep teh rotation of attached actor. oh, just change some of the obove to match your actor's name. and yes, u got it right...i think. u need teh rotation code.
     
  12. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    Having an issue with my spawn code...

    Code:
    simulated function EarlyProjSpawn(Pawn P)
    {
        if ( MyWeaponFire.bIsFiring != False )
            Tick;
            // Included the tick because I want a delay until the reload part of the
            // firing anim kicks in, any other ways?
            Spawn(class'StaticMeshActor');
            StaticMeshActor.StaticMesh='MyWeaponSM.MyGroup.MyMesh';
            AttachToBone(StaticMeshActor, 'spawn');
            StaticMeshActor.Rotation=P.Rotation
    }
    Should this be a function or simulated function? I thought it should be simulated because it happens in realtime, but maybe I was mistaken. My compiler says there's a "Bad or missing expression in If" right at the top.
     
  13. Ghost3021

    Ghost3021 Registered Hobbit

    Joined:
    Nov 21, 2004
    Messages:
    586
    Likes Received:
    0
    im not sure realy what teh difference between a function and simutlated function is...i just do regular function and it works fine. leme think on this....
     
  14. Fragorl

    Fragorl New Member

    Joined:
    Dec 24, 2004
    Messages:
    17
    Likes Received:
    0
    Try "if (MyWeaponFire.bIsFiring)" ?
     
    Last edited: Jan 6, 2005
  15. Lulolwen

    Lulolwen The One And Only

    Joined:
    Sep 11, 2004
    Messages:
    10
    Likes Received:
    0
    Tried several different ways of phrasing. There is a bIsFiring, isn't there? I thought there was.

    Also, what is the function to have an idle time? Tick isn't working, maybe PlayIdleAnim or something similar?
     
    Last edited: Jan 7, 2005

Share This Page