attach actor to another actor, clean way?
-
- Experienced
- Posts: 111
- Joined: Tue Jul 29, 2014 9:35 pm
- Personal rank: Who knows.
- Location: NC
attach actor to another actor, clean way?
hey ut99 community and brilliant minds, I'm working on a small mod/mutator that incorporates the need for one actor to take on the location of another actor, precisely like the CTFflag to a pawn when the pawn is carrying it. however, through class digging and codex clicking and scrolling, I cannot fully find how the CTFflag attaches smoothly to the player. the pawn class does include a carriedDecoration variable tho the only accessible way to change it is by changing it directly, tho I do not think that this is how the CTFflag attaches to the player. perhaps the evil setbase()? just need to be pointed in the right direction on how the CTFflag works and I can continue from there and rework it for my own use. thanks guys for your help in advance
-
- Godlike
- Posts: 10537
- Joined: Wed Jul 15, 2009 11:36 am
- Personal rank: coffee addicted !!!
- Location: Cologne, the city with the big cathedral.
Re: attach actor to another actor, clean way?
Well, did you look into the flag code?
Another idea... in Food Fight we have a game mode called Burger-CTF (you have to carry a burger to the enemy flag) The picked up Burger-Bomb is attached like the flag to the bag of the carrier. And the FF-source is free to use and available on our Moddb page (click banner in my signature).
Another idea... in Food Fight we have a game mode called Burger-CTF (you have to carry a burger to the enemy flag) The picked up Burger-Bomb is attached like the flag to the bag of the carrier. And the FF-source is free to use and available on our Moddb page (click banner in my signature).
-
- Godlike
- Posts: 2999
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: attach actor to another actor, clean way?
Have a look at CTFFlag Touch() function. The core of it is
Test map attached where you can carry a barrel.
Code: Select all
function Touch(Actor Other) {
if ( (Pawn(Other) != None) && Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) )
{
Pawn(Other).MoveTimer = -1;
Pawn(Other).PlayerReplicationInfo.HasFlag = self;
}
}
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
-
- Experienced
- Posts: 111
- Joined: Tue Jul 29, 2014 9:35 pm
- Personal rank: Who knows.
- Location: NC
Re: attach actor to another actor, clean way?
Ok the hasFlag variable, can't believe I missed over that. Thanks for the help guys and your example Barbie
-
- Godlike
- Posts: 5498
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: attach actor to another actor, clean way?
Lately I have been rechecking some of the UScript side of things, and I cannot believe how messy Epic's code was.
For instance, this HasFlag property, not only is not a boolean as you would normally expect from the name, it accepts any decoration to be used as a flag.
It may come in handy for you now to do that attachment easier, but it doesn't make it any more right.
Having that said, attaching one actor to another "cleanly" can be done in a few ways, it all comes down to exactly the kind of actor you want to attach to what.
If it's a decoration to a pawn, like the flag, yeah, this solution probably suffices, however in other cases you have things like Physics=PHYS_Trailer for example which makes an actor fully attached to its owner actor, such as the shield belt effect for example.
For instance, this HasFlag property, not only is not a boolean as you would normally expect from the name, it accepts any decoration to be used as a flag.
It may come in handy for you now to do that attachment easier, but it doesn't make it any more right.
Having that said, attaching one actor to another "cleanly" can be done in a few ways, it all comes down to exactly the kind of actor you want to attach to what.
If it's a decoration to a pawn, like the flag, yeah, this solution probably suffices, however in other cases you have things like Physics=PHYS_Trailer for example which makes an actor fully attached to its owner actor, such as the shield belt effect for example.