[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Dual Assault Rifles - how's it done?  XML
Forum Index -> UnrealScript, Coding, Mapping, and 3rd party Mods
Author Message
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

I can't figure out how to successfully "give" (IE, using "GiveTo") a second Assault Rifle to a player and have it result in wielding dual assault rifles. What it usually results in is a 2 rifle stack in the weapon slot.

Anyone know how this is actually done?

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
Continuum

Wicked Sick!
[Avatar]

Joined: 03/09/2005 05:20:36
Messages: 479
Location: Indianapolis, Indiana
Offline

Not sure how its done but I do believe that the GiveTo() will attatch the weapon to BoneWeapon (which is on the right hand) so I'm assuming there is another function that attatches it to the other hand (Bip01 L Hand). If I remember correctly some models (magdelina and effigy) dont have that bone so never display a 2nd assault rifle.

Might be able to call modify pawn and use the attatchtobone method.

also I'm thinking either Bip01 or L Hand get parsed off on importing a skeleton (Ued Animation Browser can show & list all bones for a skeleton the way it is ingame though)






Current WIP:
Skins:
[Email]
KohanX

Godlike

Joined: 03/04/2006 13:40:23
Messages: 350
Offline

bDualMode?

Picking up an Assault Rifle results in dual-wielding, but why is this? This is because directly giving a player an Assault Rifle does not call the HandlePickupQuery() function as a pickup does. Everything that handles the conversion from single- to dual-wielding is inside HandlePickupQuery().

HandlePickupQuery() really doesn't do much on its own. Its primary function (no pun intended) is to set bDualMode to True if you already have an Assault Rifle. That and playing the sound and attaching the mesh to the player's left hand. Regardless, it is the key to success.

So if you're making some mutator that starts players off with dual Assault Rifles, have it set bDualWield (better yet, have it call 'HandlePickupQuery(class);' exactly like that), and double the starting ammo amounts if you wish.

Hope I helped . And now my ego's flaring because I'm helping a superior >.<
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Thank you very much - while that wasn't *exactly* the answer, it did give me something to google to head in the right direction.

In case you look at the developer's thread ...

I can't set "bDualMode" directly as the variable is an "RPGWeapon", and the bDualMode boolean is specific to Assault Rifles. So if I take a "generic" weapon/RPG weapon and try to reference bDualMode directly, the compiler will bomb.

However, the "Loaded()" function which exists in Weapon is (re?)defined in AssaultRifle to set bDualMode to true.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
KohanX

Godlike

Joined: 03/04/2006 13:40:23
Messages: 350
Offline

So call Loaded().

But why can you call a redefined function, and not a new variable? Would AssaultRifle(WeaponVar).bDualMode not work?
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

KohanX wrote:
But why can you call a redefined function, and not a new variable? Would AssaultRifle(WeaponVar).bDualMode not work? 

I did call "Loaded()".

In the function being modified in DruidLoaded, there's a variable for multiple weapons that's referenced ... so instead of trying to some how pull an "AssaultRifle" type (or casting), it's easier to reference a more "generic" type of variable and use an existing function to do the change.

I'm not so sure your syntax would work ...

EDIT: My mind didn't arrange that so well the first time ... let me try again.

First, in DruidLoaded where I'm making the change, the object we're modifying is not specifically an "AssaultRifle" but more generically "RPGWeapon" (which I think is just a child class of "Weapon"). I would guess that the "Weapon" class has a predefined "Loaded()" - so it can be called in "any" RPGWeapon object. It has be redefined in AssaultRifle to set bDualMode.

On the other hand, bDualMode does not exist in the generic "Weapon" (or "RPGWeapon") class (only specifically in AssaultRifle), so you can't reference it as a variable to a generic "RPGWeapon" object - the compiler will barf.

There may be a way to "declare" or "cast" an object as a specific (in our case, AssaultRifle) child class, but I'm not aware of how and the idea leaves me with the feeling that it could lead to evil things if I tried to do it and ran into a situation where we weren't talking about an AssaultRifle.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
KohanX

Godlike

Joined: 03/04/2006 13:40:23
Messages: 350
Offline

Why, it would be very simple. To cast something as an assault rifle, you would just say AssaultRifle(GeneralVar).AssaultRifleSpecificVariable. If the GeneralVar is not an Assault Rifle or subclass thereof, it is treated as None, so it would merely have a warning saying that the variable does not exist.

That is why we put the following lines:
Code:
 local Weapon W;
 local AssaultRifle AR;
 
 // Code that grabs a weapon and puts it into W goes here
 
 AR = AssaultRifle( W );
 if ( AR != None ) // If it *is* an AR or subclass thereof
 {
     AR.bDualMode = true; // Or whatever.
 }


Therefore, it will not hit any snags saying that a variable does not exist, because it will only *try* to access the variable if the class exists in the first place. It's done all over the place; you'll probably notice it a lot more often now that I've explained it.
 
Forum Index -> UnrealScript, Coding, Mapping, and 3rd party Mods
Go to: