Spawning Projectile Onto Weapon

  • 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.

Lulolwen

The One And Only
Sep 11, 2004
10
0
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 :).
 

porkmanii

New Member
Sep 9, 2004
129
0
0
Australia, Qld
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:

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
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..
 

Lulolwen

The One And Only
Sep 11, 2004
10
0
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:

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
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:

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
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.
 

porkmanii

New Member
Sep 9, 2004
129
0
0
Australia, Qld
Lulolwen said:
Also, could use some help distinguishing the code in the Translocator that spawns the fake beacon from the rest.
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.
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
*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 :)
 

Lulolwen

The One And Only
Sep 11, 2004
10
0
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:

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
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.
 

Lulolwen

The One And Only
Sep 11, 2004
10
0
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.
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
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....
 

Fragorl

New Member
Dec 24, 2004
17
0
0
37
New Zealand
Lulolwen said:
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.

Try "if (MyWeaponFire.bIsFiring)" ?
 
Last edited:

Lulolwen

The One And Only
Sep 11, 2004
10
0
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: