How to make weapons lean on walls (would that include to spawn without weaponbase?)?

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

Crossfire

New Member
Mar 18, 2000
4
0
0
Oslo, Norway
Hi all :)

I want to do what is shown on the screenshot (from a level I did for the original UT) in UT2004. It can be done right? I think that is much more nice looking than the big weaponbase thing. Please help :)

weapon.jpg
 

Bot_40

Go in drains
Nov 3, 2001
2,914
0
36
York, UK
Possibly either with a custom coded weapon base to spawn the weapon at that angle and offset to the side, then just set bHidden = true so it hides the base itself.
Or alternatively it's possible to place the weapons on their own without the bases apparently though this is supposed to cause AI issuses (but epic are yet to back this statement up)
 

Dennis Grass

New Member
Nov 3, 2004
9
0
0
Germany
mitglied.lycos.de
Hello!

I was just searching the web for a way to get rid of the rotating pickup because I want to lean the weapons on walls, too. So I found this thread. Unfortunately without an answer... :(

But Bot_40's idea is great and a good point to start. So I did a little UScript for a new xWeaponBase class without rotating pickups.
I know this thread is old and maybe you have already found a way to do it, but anyway, here is how i do it now.

At first goto the Actor Class browser, highlight xWeaponBase and click the New Script button. As package name use MyLevel so the new class will be stored within your map package. Enter MyxWeaponBase as name for the new class.

Put the following code into the new class:

//========================================================
// MyxWeaponBase.
//========================================================
class MyxWeaponBase extends xWeaponBase
placeable;

var(PickUpBase) rotator SpawnRotation; // access via the Properties
var(PickUpBase) vector SpawnLocation; // access via the Properties

function SpawnPickup()
{
if( PowerUp == None )
return;

Super.SpawnPickup();

myPickUp.SetRotation(SpawnRotation); // synchronize rotated position of PickUp and Base
myPickUp.SetLocation(SpawnLocation); // synchronize vector position of PickUp and Base (pivot position)
myPickUp.SetPhysics(PHYS_None); // kill this annoying rotation
}


Compile it and the new class MyxWeaponBase appears in the browser. Place it in your map, set it up as you like and set Advanced, bHidden to True so the base cannot be seen in-game. Look at the code, there are two new variables you have to set up manually in the MyxWeaponBase properties:

Set Pitch, Roll, Yaw of PickUpBase.SpawnRotation to exactly the same values as in PickUpBase.Movement.Rotation.
Do the same with the PickUpBase.SpawnLocation vector values and PickUpBase.Movement.Location.
(Sorry, this has to be done manually because i just cannot find the corresponding WeaponBase actor via UScript :mad: If someone knows, please post)
So location and rotated location of the spawning weapon will be exactly the same as of the base.

Now it's a little tricky to get the right position of the weapon because you cannot see it in the editor. After setting up SpawnRotation and SpawnLocation the pivot location of the spawning weapon is the same as the WeaponBases pivot location. The weapons rotation is also synchronized with the bases rotation. So you can orientate to the WeaponBase. (Just leave the Bases bHidden to true an run your map to check the base and weapon position.)

Ok. It's not fully automatic. But it works (UT2004 v3323). :D

English is not my mother language. I hope you understand what I wrote.

Greetings
Dennis
 

XepptizZ

What are you lookin at...
May 17, 2004
486
0
0
35
In solitude
Bases of any kind should've been totally optional IMO, It's just more fun and original to make your own right?
 

ReD_Fist

New Member
Sep 6, 2004
1,404
4
0
64
Michigan
Just make a new class name under the weapon

then rightclick and edit the propeties of the new named weapon you added.

if you can't find any of the things you need to modify ,type this in on the command bar at bottom of editor

editactor class=myclassicsniperrifle

(or whatever you named it)

then just pick your class in "pickups" not "xweaponbase" to the base you add to map.
wich is hidden in advanced,
Need any help let me know.
 

Dennis Grass

New Member
Nov 3, 2004
9
0
0
Germany
mitglied.lycos.de
Oops. The code I posted was tested careless. :D
The spawning weapon collides with the world and always gets "pushed away" form BSP (and static meshes?) for about 30 units or so. That made placing them near walls impossible.
Here it is fixed and fully automatic (if u like):

Code:
//========================================================
// MyxWeaponBase.
//========================================================
class MyxWeaponBase extends xWeaponBase
	placeable;

var(PickUpBase) bool bUseCustomSpawn; // allows u to spawn the pickup at a location (and rotation) away from its base
var(PickUpBase) rotator SpawnRotation; // effective if bUseCustomSpawn is True
var(PickUpBase) vector SpawnLocation; // effective if bUseCustomSpawn is True

function SpawnPickup()
{
    if( PowerUp == None )
        return;

	Super.SpawnPickup();

	myPickUp.bCollideWorld = False; // stop colliding with world, so spawning near (sure, even inside) walls is possible

	if (bUseCustomSpawn == True) // use user input for the pickups rotation/location
	{
		myPickUp.SetRotation(SpawnRotation);
		myPickUp.SetLocation(SpawnLocation);
	}
	else // synchronize the pickups rotation/location to its base
	{
		myPickUp.SetRotation(Rotation);
		myPickUp.SetLocation(Location);
	}

	myPickUp.SetPhysics(PHYS_None); // kill rotating animation

	bHidden = True; // hide the weaponbase in-game
}

I just wanted to correct the code.

ReDs way has the advantage you can see the weapon inside of UnrealEd. This makes placing them right easy. So you don't have to run the map over and over again to see where the weapon actually spawns.
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
hey, i already made custom placable weapons for one of my maps, 2on2chizra, its at nali city. theiir in the mylevel package, just load the map and load yours, they extend pickup.:) no need for code, realy.
 

Dennis Grass

New Member
Nov 3, 2004
9
0
0
Germany
mitglied.lycos.de
SoH_Ghost3021 said:
hey, i already made custom placable weapons for one of my maps, 2on2chizra, its at nali city. theiir in the mylevel package, just load the map and load yours, they extend pickup.:) no need for code, realy.

I took a look at your map, SoH. It is just the best way to do get rid of these weaponbases and placing the weapons is very easy. And without any code...I go crazy it's that simple! Thank you very much for this! :)