[Solved]MonsterhuntCTG : postion weapons forced :

Discussions about Coding and Scripting
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

[Solved]MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

we would like to be able to force the position of certain weapons in MonsterhuntCTG how can I do that?
Shot00254.png
You do not have the required permissions to view the files attached to this post.
Last edited by Letylove49 on Tue Feb 24, 2026 2:13 pm, edited 2 times in total.
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3369
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MonsterhuntCTG : postion weapons forced :

Post by Barbie »

Move existing weapons? Maybe so:

Code: Select all

local Actor A;

	if (FindActorByName('Ripper12', A, 'Ripper'))
		A.SetLocation(vect(-9616, -3002, -203));
function FindActorByName()

Code: Select all

function bool FindActorByName(name ActorName, out Actor FoundActor, optional name ActorTag) {
local Actor A;

	foreach AllActors(class'Actor', A, ActorTag)
		if (A.Name == ActorName)
		{
			FoundActor = A;
			return true;
		}
	warn(ActorName @ "not found");
	return false;
}
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

Thanks Barbie,

i have the function findActor on MH2Base
and added the code on my weapons ;

Code: Select all

 function setHand(float Hand)
{

local Actor A;

	if (FindActorByName('MH2Rifle', A, 'Sniperrifle'))
		A.SetLocation(vect(-9616, -3002, -203));
	Super.SetHand(Hand);
	if ( Hand == 1 )
	{
		Mesh = mesh(DynamicLoadObject("Botpack.Rifle2mL", class'Mesh'));
		MultiSkins[0] =Texture'MH2GoldCTGv6b.Rifle.AA';
		MultiSkins[1] =Texture'MH2GoldCTGv6b.Rifle.SR';
                MultiSkins[3] =Texture'MH2GoldCTGv6b.Skins.Rifle2d';
    }
	else
	{
		Mesh = mesh'Rifle2m';
		MultiSkins[0] =Texture'MH2GoldCTGv6b.Rifle.AA';
		MultiSkins[1] =Texture'MH2GoldCTGv6b.Rifle.SR';
                MultiSkins[3] =Texture'MH2GoldCTGv6b.Rifle.Rifle2d';
	}
}
but i get Missing ) in If. i don't understand why i got this error.
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3369
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MonsterhuntCTG : postion weapons forced :

Post by Barbie »

It looks like the function FindActorByName(...) in line 3 of your above code snippet is not known. If you want access is from different classes, you may define the function as static.
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

ok. thanks

Code: Select all

 	if (FindActorByName('MH2Rifle', A, 'MH2RifleHUDMutator'))
what i must put on paramettre 3 ?

1= weapons classs in my case is MH2Rifle
but i don't know what i must put in 3.
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3369
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MonsterhuntCTG : postion weapons forced :

Post by Barbie »

Open map in UnrealEd, select that weapon, press F4 for window "Actor Properties", and use what is given at Object>Name and Events>Tag for function FindActorByName().

But your compiling problem has nothing to do with that.
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

ok thanks so i have dot that on my weapon class MH2Rilfe.uc

Code: Select all

 	if (FindActorByName('MH2GoldCTGv6b.MH2Rifle', A, 'None'))
but i don't see where ) is missing . i have 2( and 2). why i got this error ?
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3369
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MonsterhuntCTG : postion weapons forced :

Post by Barbie »

Maybe an example will help: in map MH-BattleCrypt.unr is a ShockRifle buried in a stair and I want to lift it up a bit with code while the map is loaded.
I open the map in UnrealEd and look at the properties of the shockrifle:
MH-BattleCrypt_in_UnrealEd.jpg
When the map is loaded, the following code is executed:

Code: Select all

	if (FindActorByName('ShockRifle0', A, 'ShockRifle')) // stucks in stairway
		A.SetLocation(vect(-171, 94, 680));
You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

i have open the weapoins poperty i got this:
property MH2Rilfe.png
and i have added this variable : var bool FindActorByName;

and i still get the same error.

i want to forced on center. ( position Left, Center, Right, hidden)
You do not have the required permissions to view the files attached to this post.
Image
Image
Letylove49 aka Alicia
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 767
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England

Re: MonsterhuntCTG : postion weapons forced :

Post by UT Sniper (SJA94) »

I think she might be talking about the weapon hand position not a certain weapon on a map.
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

UT Sniper (SJA94) wrote: ↑Sat Jan 17, 2026 12:19 am I think she might be talking about the weapon hand position not a certain weapon on a map.
Yes is that i would like to do.
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3369
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MonsterhuntCTG : postion weapons forced :

Post by Barbie »

Letylove49 wrote: ↑Sat Jan 17, 2026 10:34 am
UT Sniper (SJA94) wrote: ↑Sat Jan 17, 2026 12:19 am I think she might be talking about the weapon hand position not a certain weapon on a map.
Yes is that i would like to do.
Do I have a flashback here? :omfg:   
Auto merged new post submitted 2 minutes later
Yes, see thread weapons position
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 537
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: MonsterhuntCTG : postion weapons forced :

Post by Letylove49 »

Barbie wrote: ↑Sat Jan 17, 2026 5:35 pm
Letylove49 wrote: ↑Sat Jan 17, 2026 10:34 am
UT Sniper (SJA94) wrote: ↑Sat Jan 17, 2026 12:19 am I think she might be talking about the weapon hand position not a certain weapon on a map.
Yes is that i would like to do.
Do I have a flashback here? :omfg:   
Auto merged new post submitted 2 minutes later
Yes, see thread weapons position
it seemed to me that I had already made a post on this subject but I didn’t find it. I must not have looked well. I will continue on the old Topic.
For the error I get when I try to compile " i get Missing) ) in If. because otherwise I cannot move forward in my project as long as I get this error. and I don’t know how to correct it, so I really need a solution. This positioning project is really important for us.
Image
Image
Letylove49 aka Alicia