News:

Login  |  Register

Author Topic: Mutators  (Read 4083 times)

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Mutators
« on: January 25, 2012, 10:33:16 PM »
Im not sure whether anyone actually ever come here anymore, but anyways.

So i use to make maps and change properties and such, just for fun. Recently i remembered that some servers for RC have mods that dont require downloading. I became intent on finding how. Since This place seemed to be the most likely candidate for an answer, I came here and found this: http://forums.sandcrawler.net/index.php?topic=1390.0

This, i figured, was how it was done. I followed what VI said and managed to make a mutator the worked well. It changed the default setting of different weapons, so as to un-noobify them.

Then after reading this:http://wiki.beyondunreal.com/Legacy:Fire_And_Forget_Self-Guided_Missile, I wanted to try it. So I took the code there, modified it and added it to the rocket launcher, but it didnt work. I never thought it would though so no big deal.

So my question is: Is there anyone at all who knows how to create new classes with a mutator, or even anyone that knows how to script for RC?

Sandcrawler

  • Administrator
  • Member
  • *****
  • Posts: 881
  • Karma: +16/-0
    • View Profile
Re: Mutators
« Reply #1 on: January 27, 2012, 08:47:31 AM »
I know there are a few people who have messed with RC Unreal script.

The best thing would be to find a tutorial that is in depth, (the rocket one was specific for UT) More than likely the only thing wrong in the rocket script you linked to is a few declarations of variables, and class names. (like the PAWN, probably others)

This is my super cool signature, if you think you can best it then make one and Personal Message it to me. :)

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #2 on: January 27, 2012, 07:03:51 PM »
Actually, I got the targeting part working. I heavily modified what was in that tutorial and actually managed to get it to target a pawn that has to smallest angle from the projectile. I know that part works because i have it output the name, dot product vector and location of the target. Now i have run into a problem. It wont rotate. I took the code from HomingMissle, but it wont work with my targeting code. From what i can tell it the RocketLauncher weapon targets a pawn then passes the pawn variable to the HomingMissile. This i all i do with my code.

Hopefully someone who knows how to script will come across this topic. Until then ill just wait.(and try some more things)  8)
« Last Edit: January 27, 2012, 07:06:18 PM by kram »

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #3 on: January 27, 2012, 07:18:28 PM »
Wow! About two minutes after i posted that, i figured it out!

In the HomingMissle code to change the rotation it just change the variable DesiredRotation. I had figured that this did something, but apparently it didn't. So, i changed DesiredRotation = GoalRotation to SetRotation (GoalRotation) and it worked! It seeked the target, although it did instantaneously, but i think i can fix that easily. So now i have self seeking rockets. The ultimate noob weapon. ;D

frazscotland

  • Administrator
  • Member
  • *****
  • Posts: 457
  • Karma: +12/-0
    • View Profile
Re: Mutators
« Reply #4 on: January 27, 2012, 09:13:34 PM »
Im not sure whether anyone actually ever come here anymore, but anyways.

I do and many many other also "newbie" . Great work Kram ! if u want to make a tut on your work and/or submit any mods contact sandcrawler and hell guide u as to what to do.
XFIRE  FRAZSCOTLAND

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #5 on: January 28, 2012, 11:35:07 AM »
I might consider showing it once i get it better. Right now it is horrible, but it does auto seek. The missiles usually miss(because of much too simple rotation changing code), and when you fire them they will randomly fall like, 200-500 game units before actually going forward.

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #6 on: January 28, 2012, 09:03:54 PM »
From what i get, not many people actually visit here. If there are any who actually know how to use unrealscript, great, i could use help. Right now, the targeting part works really good. However, the direction changing code is terrible. Pretty much all it does is change the rotation to half of what it needs to be to point directly at the target, every game tick. What i need is something that will simply turn it towards the target a certain amount every tick(or seconds would actually be better). Sounds pretty simple but in practise is proving much harder. So, if there is anyone who has any ideas, i will welcome them.

Sandcrawler

  • Administrator
  • Member
  • *****
  • Posts: 881
  • Karma: +16/-0
    • View Profile
Re: Mutators
« Reply #7 on: January 28, 2012, 09:31:19 PM »
From what i get, not many people actually visit here.

Depends on what you mean, the tutorials still get around 50 hits a month (each) with downloads getting more. Most users never bother to register they just use the tutorials, and download maps. Republic Commando is the least active game out of the three (AoS is most for tutorials, and KF is most for downloads)


Why not just look at how the rocket launcher in game rotated towards the locked on player, and adapt it to yours.
This is my super cool signature, if you think you can best it then make one and Personal Message it to me. :)

Tycon

  • Member
  • *
  • Posts: 172
  • Karma: +5/-1
    • View Profile
Re: Mutators
« Reply #8 on: January 30, 2012, 09:52:31 AM »
So, if there is anyone who has any ideas, i will welcome them.
I don't have much experience with UnrealScript(because every time I try to compile UnrealEd crashes), but I have a fair amount of experience and skill with C/C++, which is related to UnrealScript(I also like math). I would recommend maybe something that takes into account how far the rocket is from the target(in, let's say, "D" game units) and the angle it needs to turn to get there("A" degrees). "A" would be the angle the rocket would turn to immediately be facing the target. You could set up some code to make the angle turned every tick proportional  to the distance from the target. We would have to define a "maximum distance" of some sort. in this example it will be 10,000 game units. If "D" is equal to 4,000(4,000 units away from the target), that is (4,000/10,000) = 4/10 = 40% of the "max". So we would make the rocket turn 100% - 40% = 60% of "A" towards the target. With this code, the closer the rocket is to the target, the sharper the turn. With some precise aiming, you could make the rocket spiral towards the target lol. If any of this is horribly confusing, just ask.(this is, after all, the first time i have ever explained code to someone via the Internet).

Tycon out.


I just do this to show off my brother's photoshop skillz :D

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #9 on: January 30, 2012, 12:50:11 PM »
You could set up some code to make the angle turned every tick proportional  to the distance from the target.

I understand what you say but that is not the problem i am having. I havent figured out a way to make it turn a specific amount towards the target. I can only make it turn a specific fraction towards the target. Maybe what i could do is make that fraction relative to the distance.

Hmm. I read your post again and maybe that was what you are trying to say.

Tycon

  • Member
  • *
  • Posts: 172
  • Karma: +5/-1
    • View Profile
Re: Mutators
« Reply #10 on: January 31, 2012, 10:58:53 AM »
Alright, I think that in order to be of more help, I should know more about your problem. From what I know, you have your homing rocket all set up, except for the part about turning to face the target. You would like to give it a constant number, e.g. turn 12 degrees towards the target every tick, but for some reason the code won't accept that. It will only take a fraction, e.g. turn 12% of the way towards the target. Am I right so far?

Next would be comparing the three methods, 1. turning a constant value every tick, 2. turning a fraction every tick, and 3. turning a fraction proportional to the distance every tick. A certain error with option 1 would be that if you time it right, you can get the rocket to "orbit" around you, by being to the side of the rocket such that it will never make a turn sharp enough to reach you. In addition, if the constant value you chose was 12 degrees per tick, then if the rocket was 7 degrees off to the right, then it would be 5 degrees off to the left. In this case, (and many others) the rocket would never be perfectly facing the target.

2. You would be able to make this one "orbit" you as well, and the rocket would also never perfectly face the target. It would just get closer and closer, like 2 degrees off, then .7, then .03, then .0008, like that. Of course, that's not really a problem withsuch small fractions, because it's such a small margin that the rocket would hit the target anyway.

3. I'm pretty sure you could make this one "orbit" too, but tweaking the equation would make the circle so small it would hit you anyway(come to think of it, that solution works for 2 as well) It would also get a smaller and smaller margin of error, like 2.

In all, it's 2 and 3 that are the best choices(at least to me). It's just a matter of taste, I guess. Sorry for being so long-winded, I'm just trying to exhaustively cover the question to get you as much info as fast as possible.

(one last thing) I guess my hint in the previous post was way too subtle, but as I said, UnrealEd crashes whenever I try to compile code. Any tips?

Tycon out.


I just do this to show off my brother's photoshop skillz :D

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #11 on: January 31, 2012, 10:05:17 PM »
I understood what you said before and did something similar to it. It now works quite well, though it still occasionally misses but for a different reason. Which i will fix, then post something showing my creation.

Tycon

  • Member
  • *
  • Posts: 172
  • Karma: +5/-1
    • View Profile
Re: Mutators
« Reply #12 on: February 01, 2012, 09:58:22 AM »
:D Glad my long-winded, math-laden words could help! Would you mind telling me how exactly you get UnrealEd to compile my code? I am trying to make a mutator of my own(very simple one, to start with), and I can get to the phase where I'm in the script editor. I make my (perfectly legitimate) code, and then I click on "compile changed". Then the editor crashes :-\

Tycon out.


I just do this to show off my brother's photoshop skillz :D

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #13 on: February 01, 2012, 10:19:42 AM »
Umm, just to make sure, you aren't pressing "Compile All" by any chance. If not, i dont know why it doesnt work. Have you tried putting no new code, or just comments in?

I have actually started  writing a little tutorial of how to set everything up and make this rocket, although now i am having problems. Crashing isnt a problem for me. My problem is that about 50% of the time it wont compile at all. A little window will pop up saying "Compiling Changed Scripts", then it will just stay there. It seem to do this almost every time if the script is in a new package. This is annoying, but does not inhibit me from scripting.

My other, much more pressing problem is this.
For my rocket, for some reason it only works in singleplayer. And even then, when you fire it, it drops(!) a ways before the rocket "ignites". I think the problem is cause by the weapon shooting "HomingMissile" projectiles instead of RocketLauncherMissile projectiles. This would make sense, because in the properties of HomingMissile, the initial physics is set to Phys_Falling, but RocketLauncherMissile is set to something else. Then, if i set it to Phys_Projectile, it doesnt seek. Maybe i'll try another Phys setting.

Maybe i'll upload the fully compiled files so you(or someone else) can see them and also try figuring why the stupid keeps falling.

kram

  • Member
  • *
  • Posts: 27
  • Karma: +1/-1
    • View Profile
Re: Mutators
« Reply #14 on: February 01, 2012, 02:57:47 PM »
Here it is. A terrible, but working, self guided missile.

Just backup and replace "Star Wars Republic Commando\GameData\Properties\Properties.u" and "Star Wars Republic Commando\GameData\System.CTInventory.u" with these files. I am not sure whether it works in multiplayer.