PDA

View Full Version : Worms 4 Mayhem Advanced Tweak Loader


Iggyhopper
10 Jul 2009, 05:46
This is just a glimpse of a file that is used to mod Worms 4: Mayhem.

file Tweak\WeapTwk.xml
#Bomber.NumBombs = 20
edit kWeaponBazooka-0
IsLowGravity = false
quick * Bomblet
Num*s = 5
*MaxConeAngle = 0.90
*MaxSpeed = -0.2
*MinSpeed = -0.1
*WeaponName = kWeaponGrenade
quick $ Magnitude
quick % Radius
WormDamage$ = 35
LandDamage% = 30
edit kWeaponClusterGrenade-0
NumBomblets = 20
BombletMaxSpeed = 0.75
BombletMaxConeAngle = 0.05
file Tweak\Tweak.xml
#Ninja.NumShots *= 2
#Ninja.MaxLength = 9999
#Ninja.WormMass = 0.8

Be prepared, modding will never be the same.

UPDATE 7/28/09 1:33 AM

Added support for variables, using dollar sign like PHP
Added easier editing for weapons via "#edit", makes ID finding easier
The at sign "@", will now be used for resources, and "#" for weapons
Enabled copy for weapons, functionality is not yet there
Added a "parse" command for multiple/linked mod files
Added/fixed XPath editing, now requires double quotes with expression
Added user input dialogs, allowing for flexible modding options
Reduced number of usable special symbols to 8
Reduced the "quick" command for setting aliases, to "symbol = replacement"
Tidied up code for allowance of easy one-liner changes
Tidied up code for better class-type editing
Added command to add an attribute of the same name via "+[name] = [value]"
Added selection for same-name attributes (ex: ParticleColor[1] r=128)

xpath "id('myID')"
#edit Bazooka
$BazDmg = WormDamageMagnitude
$BazDmg += MaxPower / 5
% = Power
Max% = 10

UPDATE 7/28/09 10:29 AM

Added function calls (but not user-function creation) ex: GetRandomInt(0,9)


UPDATE 7/29/09 3:01 PM
Started work on the actual application. The previous updates were all about the parser.

UPDATE 7/30/09 9:00 AM
Here's a list of the internal functions that are available to you.

Add(A, B) - Addition
Sub(A, B) - Subtraction
Mul(A, B) - Multiplication
Div(A, B) - Division
GetRandomBool(TruePercentage) - Returns a random boolean (true/false) with a percentage that it will be true
GetRandomInt(Minimum, Maximum) - Return a random integer between Min and Max
GetRandomFloat() - Returns a random floating-point number between 0.0 and 1.0
GetRandomFloat(Minimum, Maximum) - Returns a random floating-point number (ex: 25.95, 1.45) between Min and Max


More will come, but for now this looks adequate enough. I better start working on the other parts of the program.

UPDATE 7/30/09 6:38 PM
Started working on the program, I saw Harry Potter's latest movie last night, I thought it was good, but a little long. Anyway, working on the main branch of the program. Updating functions, etc.

UPDATE 8/11/09 2:17 PM
Okay, the edit command has been done to accept three ways.
edit [Name] : Basic editing by ID
#edit [Name] : You give it a weapon name (ex: "#edit Bazooka") and it will try to find the ID for you
#[Name] : Same as above, but less typing

UPDATE 8/18/09 1:20 PM
I started working on variable setting and other things. Gosh this is hard stuff. I have class in about 10 days. Maybe I'll try to get it done before 2010 >.>

UPDATE 9/14/09 5:33 PM
Woohoo! Big break, I finally got simple variables down. There was some kind of bug and I could not get over it. Well in my time off I discovered the solution (without ever coding anything!). I can now continue in the rest of my program. I also noticed that you cannot set variables to indexes as in "$mycolor = ParticleColor[2]". I'll fix that later, but for now it's nothing important.

UPDATE 9/17/09 7:41 PM
Fully finished simple variable setting ($A = 5, $B += 2, $C /= 10, etc.). More advanced variable setting ($D += 5 * GetRandomInt(4, 7), $E *= 5 + $F) is still being worked on at the moment. It should be done by Friday afternoon. Next stop is actually loading, saving, and backing up XML files. Also, maybe I can fit in the input. I seriously can't think of any way I could recursively identify function calls and report back the values so that they all work. I mean I don't think I could possibly handle the following:
$Example = Add(Sub(Add(2, 6), Add(8, 6)), Mul($E, GetRandomInt(4, 9)))

UPDATE 10/16/09 1:32 PM
Came across another bug, it's happening with some user input dialogs for custom/flex mods. Anyway, I started work on the user input dialog and it's going smoothly so far. Hoping to get the beta 2 out by December.

UPDATE 10/17/09 2:54 PM
I have fixed the bug with input dialog, now all I need to do is make it appear on top when it opens. Started working on actual XmlDocument editing, next is XPath because it is very simple and easy to test first. I should hear a drum roll soon for the release of this product.

UPDATE 11/2/09 10:14 AM
Just some minor things today, I'm busy. I started loading and saving xml documents, building the backup file list. Pretty lazy.

Well maybe, we'll see if I want to go that far.

Download is not updated, it is beta 1.
Beta 2 will be released soon.

raul1997
10 Jul 2009, 11:20
Wow,awosome men.Keep up.

Iggyhopper
10 Jul 2009, 15:58
Here is some more code from a modding file.

file Tweak/Tweak.xml
edit Jetpack.InitFuel
Value = 1300
edit Ninja.NumShots
Value = 8
#Jetpack.InitFuel = 500
del Jetpack
log Oh hai
addweap Payload kWeaponSUPER kWeaponBananaBomb
editcon kWeaponBazooka
IsPoweredWeapon = false
@kWeaponBazooka NumBomblets = 0
@kWeaponBananaBomb NumBomblets = 2 MaxPower = 0.9
@WXP_SparkStars_Small EmitterType = 5
@WXP_SparkStars_Small EmitterAcceleration x=5 y=0 z=9
parse Particles.atwk Weapons.atwk
parsetwk Power.twk Shot.twk
del Jetpack NinjaNums PizzaGuy

//addres [Name] [Type] [Value] [Flags]
addres MyResource Vector x=0 y=0 z=0 80

I should be able to upload the beta program today. This code above is not fully supported by the public beta.

Iggyhopper
11 Jul 2009, 18:51
The public beta is now released.

This is how it works, it comes with a default file "Mod.atwk", so you can edit that file with any new mods you want to test out.

You can drag files (mods) onto the parser and it will automatically parse them, or just run it without anything else and it will automatically parse "Mod.atwk".

This is a basic list of commands you can preform, and some syntax to go by.
file | f : Open a file for editing purposes, file must be .xml and starting directory is Worms 4 Mayhem\data, backslashes are accepted as directory separators (\, Tweak\WeapTwk.xml)

edit | e : Edits a certain property of the file via ID attribute. Weapon ID's start with kWeapon and end with -0, so editing the bazooka would be:
"edit kWeaponBazooka-0"

quick [Symbol] [Replacement] : Sets a symbol ($%^&*[]<>) to be a certain word, for faster writing. You can see an example of this in the default file, as well as above, in my first post.

PROPERTY =/+=/*= VALUE : Once in edit mode (via "edit"), you can edit certain properties of the weapon and or resource. Keep in mind that spaces count, and are needed between both sides of the equals sign.

# : Directly edits a resource, like #Ninja.NumShots = 5.
Notice: this does not support add-equals or multiply-equals like above.

Current Command List
Aliases
a =
b =
c = copy
d = delete
e = edit
f = file
g = get
h =
i = input
j =
k =
l =
m = move
n =
o =
p = parse
q =
r = resource
s = set
t =
u =
v =
w = weapon
x = xpath
y =
z =

NOTE: Not Beta

If there are any error, report them here.

raul1997
12 Jul 2009, 11:25
Wow,amazing,incredible,awesome,will you make more of those tweaks loaders?
And a nice work men.

Muzer
12 Jul 2009, 11:57
Why not use _Kilburn's TWK format that already exists?

Honestly, we've got 3 different formats for tweaks now (Team17's XML, _Kilburn's TWK, your ATWK), none of which are even remotely inter-compatible. We need some sort of standard, or at least tools to convert them all between each other.

Iggyhopper
12 Jul 2009, 17:00
Easy, I will come up with some to convert .twk into .atwk.

But it does work right? Lol.

I'm trying to get a hold of _Kilburn via MSN, but he doesn't seem to be on all that much.

Yes, I will make a couple converters as soon as the "addweap" functionality working. The goal of this project was to make the mods all in one file, and be able to split them if you wanted to as well. Also, this a beta. Hopefully the full version will be a mod loader (like Kilburns), or we can use one mod loader to load two kinds of files. Too bad I can't read C++ very well.

Not to sound rude, but I think this will be the new standard.

EDIT: Also, I have to entirely rewrite the production/token file for grammatica because it will ensue easiness in the future.

Muzer
17 Jul 2009, 18:18
Well, if you get the loader functional, maybe.

Iggyhopper
25 Jul 2009, 19:47
This is an update, I have added class-like editing, and also XPath editing.

So, if you wanted to edit all these using less space.
XML
<xomArchive>
<xomObjects>
<XDataBank id='id-0'>
<IntResources href='Crate.AddToWormInventory'/>
<IntResources href='Crate.CanDropFromChute'/>
<IntResources href='Crate.DelayMillisec'/>
<IntResources href='Crate.Gravity'/>
<IntResources href='Crate.GroundSnap'/>
<IntResources href='Crate.HealthInCrates'/>
<IntResources href='Crate.Hitpoints'/>
<IntResources href='Crate.Index'/>
<IntResources href='Crate.LifetimeTurns'/>
<IntResources href='Crate.NumContents'/>
<IntResources href='Crate.Parachute'/>
<IntResources href='Crate.Pushable'/>
</XDataBank>
</xomObjects>
</xomArchive>

You can do it like this.
ATWK
file Tweak\Local.xml
Crate: {
Gravity = 2
HealthInCrates *= 4
HitPoints = 125
NumContents = 3
}

I'm currently working on the functionality of multiple levels.

Now, XPath, for those of you who don't know, is the easiest method of retrieval for XML elements and nodes, and Worms 4: Mayhem data is stored on XML files. With this, you could edit all the weapons' damage in one line.

file Tweak\WeapTwk.xml
xpath "//*[contains(@id, 'kWeapon')]/WormDamageMagnitude" = 10

Iggyhopper
30 Jul 2009, 01:17
Alright, I posted updates.

I'm finally getting started. My prediction for a fully functioning Beta 2 is 1-2 weeks.

Iggyhopper
15 Sep 2009, 01:38
Woot, my prediction sucks!

Big milestone crossed today. Big bug crushed.

Iggyhopper
18 Oct 2009, 18:39
Well I also started work on the "Advanced Tweak Designer", where you can ultimately design a text-based modding file for the program to run.

The best part of this is that you don't really have to download anything to use it! It's online!

Now, I've only confirmed that this works for firefox, and works for me. So if you can tell me that it works for you, that would be awesome. It is hosted on my own server so be patient if it does not load the page quickly. If you want to, I will upload a .zip file with all the required files so you can do this without relying on my server, but I need to make sure it works so I don't have to keep uploading a new .zip or files for you.

1. Select an XML file in the Worms 4: Mayhem tweak directoy, pick something small like Empty.xml, WeapTwk.xml, or Tweak.xml

2. It will report to you whether or not it was successful, and also fill the small listbox with items.

3. Pick an item in the listbox and the the sub-listbox will be filled with all the attributes.


I think this only work in Firefox 3.5.

Worms 4: Mayhem Advanced Tweak Designer (http://new.iggyhopper.dyndns.org/W4MATL/)

_Kilburn
22 Oct 2009, 17:21
cool :cool:

levansh
22 May 2011, 11:38
cool :cool:

:( i dont know how to do it :confused: so can you please give me tweaking files just add the link please help help needed