Looking for alternative Teamcannon actor.
-
- Masterful
- Posts: 716
- Joined: Mon Jan 05, 2009 8:08 pm
- Personal rank: Banished member
Looking for alternative Teamcannon actor.
Hello,
Last night I spend almost 2 hours trying to find a working actor that I need. I'm using an AttachTag method.
I have a LoopMover that is endlessy triggered. What I want is some sort of actor that has the same properties as a TeamCannon, but is not a "pawn".
The problem with all actors that are under "PAWNS", they only move 1 key point, then freeze on that keypoint.
All other actors like DECORATION / INVENTORY ITEMS, are working fine. They follow the mover every keypoint perfectly.
Under "effects" I found :
ArrowSpawner - but that doesn't do any damage, and doesn't follow player.
Mortar spawner - it comes close, and is fun, but it doesn't shoot straight.
BoulderSpawner - but those are not what I need.
Is there a actor like TeamCannon that follows the player, shoots at them , wherever they go?
Edit: I prefer using something stock in the engine, unless it's not possible.
Last night I spend almost 2 hours trying to find a working actor that I need. I'm using an AttachTag method.
I have a LoopMover that is endlessy triggered. What I want is some sort of actor that has the same properties as a TeamCannon, but is not a "pawn".
The problem with all actors that are under "PAWNS", they only move 1 key point, then freeze on that keypoint.
All other actors like DECORATION / INVENTORY ITEMS, are working fine. They follow the mover every keypoint perfectly.
Under "effects" I found :
ArrowSpawner - but that doesn't do any damage, and doesn't follow player.
Mortar spawner - it comes close, and is fun, but it doesn't shoot straight.
BoulderSpawner - but those are not what I need.
Is there a actor like TeamCannon that follows the player, shoots at them , wherever they go?
Edit: I prefer using something stock in the engine, unless it's not possible.
This member can only post when permitted.
-
- Godlike
- Posts: 9341
- Joined: Thu Jun 30, 2011 8:12 pm
- Personal rank: God of Fudge
- Location: Palo Alto, CA
Re: Looking for alternative Teamcannon actor.
After a fashion... TeamMonsters can be sorta fun if used properly (attached the .u file).
There's also this · viewtopic.php?f=34&t=11779

There's also this · viewtopic.php?f=34&t=11779

You do not have the required permissions to view the files attached to this post.
http://unreal-games.livejournal.com/

Smilies · viewtopic.php?f=8&t=13758medor wrote:Replace Skaarj with EvilGrins
-
- Masterful
- Posts: 716
- Joined: Mon Jan 05, 2009 8:08 pm
- Personal rank: Banished member
Re: Looking for alternative Teamcannon actor.
Good idea, but same problem. Doesn't work. Thanks though.
The shitty thing is I know zero about coding.... maybe that's a part i should learn someday.....
I'm struggling to see the difference / missing link that between them is.
The shitty thing is I know zero about coding.... maybe that's a part i should learn someday.....
I'm struggling to see the difference / missing link that between them is.
This member can only post when permitted.
-
- Godlike
- Posts: 1963
- Joined: Sat Sep 17, 2011 4:32 pm
- Personal rank: Dame. Vandora
- Location: TN, USA
Re: Looking for alternative Teamcannon actor.
It can be made using codes from the default engine but it'll be a custom script (subclassing in other that is not a pawn) and it can be MyLevel'd or not, depending on how you want it to be made... but that's as far I can acknowledge despite not doing enough coding practice.
Thought sharing this would give other the idea to make it if they know how to do it easily. If not, we'll have to start working on one altogether
& I don't mind starting out carrying this process and I may not get everything right but other can make the changes.
Thought sharing this would give other the idea to make it if they know how to do it easily. If not, we'll have to start working on one altogether

-
- Godlike
- Posts: 2644
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: Looking for alternative Teamcannon actor.
I didn't find the reason why for example a TeamCannon is not moved if attached to a Mover by TeamCannon.AttachTag == Mover.Tag. In StationaryPawn.uc I found But overriding that function and setting another value for Velocity did not change anything.
A possible approach with brutal violence is polling Mover's location and setting TeamCannon's location accordingly. But I'm not satisfied with this solution, because software should be event-driven and not do resource intensive polling. Because it should be attached to a constantly moving mover, it would be ok using the resource intensive Tick() function in this case.
Usage: Give the Mover an unique Tag and set MovableTeamCannon.TeamCannon.MyMoverTag to this Tag.
Test map with MyLevel'ed MovableTeamCannon attached. Improvements welcome.
Code: Select all
simulated function AddVelocity( vector NewVelocity ) {
Velocity = vect(0,0,0);
}
A possible approach with brutal violence is polling Mover's location and setting TeamCannon's location accordingly. But I'm not satisfied with this solution, because software should be event-driven and not do resource intensive polling. Because it should be attached to a constantly moving mover, it would be ok using the resource intensive Tick() function in this case.
Code: Select all
class MovableTeamCannon expands TeamCannon;
var(TeamCannon) Name MyMoverTag;
var Mover MyMover;
var vector MoverOffset;
event PostBeginPlay() {
// Find my mover:
if (MyMoverTag == '')
{
Disable('Tick');
return;
}
foreach AllActors(Class'Mover', MyMover, MyMoverTag)
break;
if (MyMover != None)
MoverOffset = MyMover.Location - Location;
else
Disable('Tick');
}
event Tick(float DeltaTime) {
if (MyMover.Location + MoverOffset != Location)
SetLocation(MyMover.Location - MoverOffset);
}
Test map with MyLevel'ed MovableTeamCannon attached. Improvements welcome.
You do not have the required permissions to view the files attached to this post.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
-
- Masterful
- Posts: 716
- Joined: Mon Jan 05, 2009 8:08 pm
- Personal rank: Banished member
Re: Looking for alternative Teamcannon actor.
Thank you very much Barbie, will try it out. 

This member can only post when permitted.
-
- Godlike
- Posts: 2644
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: Looking for alternative Teamcannon actor.
I did an error: Instead of it has to be (Notice the - instead of +)
Code: Select all
if (MyMover.Location + MoverOffset != Location)
Code: Select all
if (MyMover.Location - MoverOffset != Location)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
-
- Godlike
- Posts: 3770
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Looking for alternative Teamcannon actor.
Your going to need to create a new class combining stationary pawn and team cannon. The nulling of AddVelocity in stationary pawn is going to mess up everything when you attempt to move this. If Barbie doesn't have time let me know and I'll do it for you. I'd get it tonight but I'm really tired, been scripting all day.
So long, and thanks for all the fish
-
- Godlike
- Posts: 6313
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Looking for alternative Teamcannon actor.
Actually... all is a bit wrong. Cough Barbie, first of all MOVER is moving actor VIA AttachTag and not reversal, is Mover.AttachTag = Actor.Tag and mover is indeed an AttachMover I have used only default stuff for Moving... a book like a plane in "bombingyard" and a sort of knife in "CTF-A_Trn" demo map or such. Dynamic things have to be tested ON-Line - in MH-TrainCommando some dynamic sounds are operated by a "Book" attached to an AttachMover because... AmbientSound is crapped On-Line at movement being supposed to be a static thing (Epic specific awesome deals) and for sure Mover is transporting Actor not reversal.Barbie wrote:I didn't find the reason why for example a TeamCannon is not moved if attached to a Mover by TeamCannon.AttachTag == Mover.Tag.
This thing with tick I think is way expensive. Engine is moving actor on a movable base (AttachMover) as long as actor is not bStatic and doesn't have that many things in common with addvelocity. Actually a "knife" child is not pushed by something doing damage but that thing can be moved by Mover...
All testing is required because Cannon having this Mover(base) will change base when it do spawns its own base screwing things (I guess). All this setup needs a check and also Net testing.
Edit:I did a little test - like I said, cannon will discard Mover(base) going messed up.
[attachment=0]Cannon.jpg[/attachment]
Here I would do a "tracker" attaching All Cannon crap to mover... LATER and using even a common Mover for this task...
However, by doing checks to Cannon, it is changing whatever Physics to None in state deactivated happening after 6 seconds and this will not be helpful - mover(Base) is being discarded. And then, we need to do a child cannon overriding default cannon habits and "SetBase" setup. And later cannon probably will not be nice because it has to change physics according to combat... so definitely will be required a tick operated by Cannon requiring other cannon type than default and quitting Base deals.
To summarize not all Actors are intended to be attached by a Mover as being their Base, some of them are changing physics and then they are losing this Base, all these having not many common things with AddVelocity. I did not check a cannon taking in account "BaseChange()" event, probably this is a cheap solution for re-attaching cannon back to base when physics are changed - but will require testing of course for being in proper timing and... if "BaseChange()" will get called.
You do not have the required permissions to view the files attached to this post.
-
- Experienced
- Posts: 134
- Joined: Mon Nov 24, 2014 9:27 am
Re: Looking for alternative Teamcannon actor.
As we know, animations (and that includes movers) is done by linear interpolation which increments the step with a factor of time rather than a constant frame value (We can't assume that we're Vert-synced).
It also means that the progress (or location) is incremented each tick according to delta time as such:
Where Distance' (vector prime notation) is the distance between the start vector and end vector (keypoints) (EndLocation - StartLocation).
Now the problem I can see with your solution Barbie is that it all depends on what actor is being updated first.
If the mover is being updated first, and then the cannon then it's fine, but if say the cannon would be updated first and then the mover, the cannon would be slacking behind with one frame. How noticable that is all depends on your framerate and the Distance' but I thought I should point it out. In terms of efficiency there is pretty much no overhead, maybe cache MyMover.Location. The reason why this doesn't have extra overhead even if it's a bruteforce technique is because the mover is also operating on Tick() and thus calling SetLocation on the Attached object from the mover, or vice versa doesn't matter, the only overhead is the extra function frame of calling Tick() in the cannon as well.
Of course, attaching an object to a mover should mean that the object has no physics altering its location.
It also means that the progress (or location) is incremented each tick according to delta time as such:
Code: Select all
DeltaDistance = (Distance' * (DeltaTimeMs / TotalTimeMs))
Now the problem I can see with your solution Barbie is that it all depends on what actor is being updated first.
If the mover is being updated first, and then the cannon then it's fine, but if say the cannon would be updated first and then the mover, the cannon would be slacking behind with one frame. How noticable that is all depends on your framerate and the Distance' but I thought I should point it out. In terms of efficiency there is pretty much no overhead, maybe cache MyMover.Location. The reason why this doesn't have extra overhead even if it's a bruteforce technique is because the mover is also operating on Tick() and thus calling SetLocation on the Attached object from the mover, or vice versa doesn't matter, the only overhead is the extra function frame of calling Tick() in the cannon as well.
Of course, attaching an object to a mover should mean that the object has no physics altering its location.
-
- Masterful
- Posts: 716
- Joined: Mon Jan 05, 2009 8:08 pm
- Personal rank: Banished member
Re: Looking for alternative Teamcannon actor.
I thank you all for your input and commentary. What barbie made for me, is good and helped me. The MovingTeamCannon is following the mover perfectly.
I can release a quick ingame video what i mean. What I do understand that this actor is actually pressing the engine with more fuel than necessary ? Do I read that correct ????
All the code and scripting talk is hocus pocus for me.
Like I said before, maybe i should try to learn a little bit about it.
But, can somebody try to explain to me, in plain simplified english, why TeamCannon does not move along the mover properly?
I thank you all again for your efforts, especially barbie

I can release a quick ingame video what i mean. What I do understand that this actor is actually pressing the engine with more fuel than necessary ? Do I read that correct ????
All the code and scripting talk is hocus pocus for me.

But, can somebody try to explain to me, in plain simplified english, why TeamCannon does not move along the mover properly?
I thank you all again for your efforts, especially barbie

This member can only post when permitted.
-
- Godlike
- Posts: 6313
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Looking for alternative Teamcannon actor.
TeamCannon moving to state idle is changing Physics to NONE (free levitate) even if previously has NONE as well. Changing physics make cannon (any pawn I guess) to leave any possible Mover-Base - else if Base would not be possible to be left, no Pawn could jump from Lifts ever - because Pawn traveling with Lift is the same as Cannon attached to Mover - Both of them have a Moving BASE.Terraniux wrote:But, can somebody try to explain to me, in plain simplified english, why TeamCannon does not move along the mover properly?
I could attach some decorations, some smoke-spawner, mortarspawner, these have to be checked for their bMovable=True and bStatic=False - it doesn't seems to be a need for bCollideActors, AttachMover is moving them if they doesn't operate any Physics related changes.
Perhaps we need to start a topic with a few U files containing some MH stuff for being MyLevel-ed with "Obj Load" directive without any compilation. U files are going to have things needed but which doesn't exist in stock (swjumppad, custom cannons, Navigation stuff, lights, several pawns, fixes related to Skaarj, etc.) and mapper will happily use them from Actor browser without pumping brains through the head.
Edit: Right now I thought at a solution, more exactly what I would do - because I don't think I would need a TeamCannon.
Taking a decoration supporting mesh change and putting cannon's mesh over it. Then add there a mortarspawner or whatever boulderspawner - they can be triggered normally. This is the simplest way, using default stock stuff. All these are going to look like a cannon firing boulders or whatever mortars.
Last edited by sektor2111 on Fri Sep 15, 2017 9:34 pm, edited 1 time in total.
-
- Masterful
- Posts: 716
- Joined: Mon Jan 05, 2009 8:08 pm
- Personal rank: Banished member
Re: Looking for alternative Teamcannon actor.
OK, I understand a little bit better now. Thank You. If it matters, I added a video here.
Some actors I forgot to add, (which are working like the mortor and such) are missing, but you get what i mean.
The moving Teamcannon is from Barbie. All actors present have the AttachTag has the mover.
h9bTQwbF134
Some actors I forgot to add, (which are working like the mortor and such) are missing, but you get what i mean.
The moving Teamcannon is from Barbie. All actors present have the AttachTag has the mover.
h9bTQwbF134
This member can only post when permitted.
-
- Godlike
- Posts: 2644
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: Looking for alternative Teamcannon actor.
Polling is just an inefficient method: imagine your handy had no bell - you have to look all few minutes if there is a call or SMS or whatever and because most of the times there will be nothing, you waste time with that.Terraniux wrote:What I do understand that this actor is actually pressing the engine with more fuel than necessary ?
Same is with the Tick() function: It looks about 30 times per second if the Mover has moved, and if so, the TeamCannon' location is updated. That's not really stress for the machine but a lot of unnecessary functions calls.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
-
- Inhuman
- Posts: 958
- Joined: Wed Mar 31, 2010 9:02 pm
- Personal rank: I am quite rank.
- Location: MrLoathsome fell out of the world!
Re: Looking for alternative Teamcannon actor.
Exactly correct Barbie.
If you look at some of my old junk code, the last few projects I did where this would be an issue all have a config var so the user/admin can
set the polling rate to suit both the needs of their gametype and their hardware.
In some mutators I had them detecting how many times event X had been polled without any action needed, and after Y number of executions
the code would throttle down the rate of those checks, and turn it back up to full speed as soon as something happened. Repeat.
Not the ideal solution, but it seemed to work well for the most part. Cuts back on the unnecessary functions calls a LOT.
*This probably wont help the OP much until they do spend at least some time looking at Uscript, but I had to post this anyway.
Kickass thread. Everybody's replies have been awesome.
If you look at some of my old junk code, the last few projects I did where this would be an issue all have a config var so the user/admin can
set the polling rate to suit both the needs of their gametype and their hardware.
In some mutators I had them detecting how many times event X had been polled without any action needed, and after Y number of executions
the code would throttle down the rate of those checks, and turn it back up to full speed as soon as something happened. Repeat.
Not the ideal solution, but it seemed to work well for the most part. Cuts back on the unnecessary functions calls a LOT.
*This probably wont help the OP much until they do spend at least some time looking at Uscript, but I had to post this anyway.
Kickass thread. Everybody's replies have been awesome.

blarg