Water modifier

Everything about mods can be found here.

Moderator: Morax

Water modifier

Postby Ithilis_Quo » 28 Mar 2015, 15:10

Hi, im pretty big noob on moding, know how to rewrite stats, but when i must do something with lua file have problem. Dont know how to do it work as i want, or it total dont work.

have make this mod -> viewtopic.php?f=42&t=9629 "Hover_rework" that change hover units, but dont know how to add watterSpeedModifier for let units be slower on water as are on land. But not generaly all hover units, but only T2 hover/amphibious units, for different numbers (blaze/yenze speed 4->3 on water, wagner 3,7->4 ripdite 3,4->3 on water).

Can someone take my advice where i can change it, and how add this stuff ?
"Fixed in Equilibrium" Washy
User avatar
Ithilis_Quo
Supreme Commander
 
Posts: 1390
Joined: 29 Dec 2012, 15:55
Location: Slovakia
Has liked: 395 times
Been liked: 181 times
FAF User Name: Ithilis

Re: Water modifier

Postby Krapougnak » 29 Mar 2015, 08:53

I took this from the Aurora script I think it is what you want.

Code: Select all
UAL0201 = Class(AHoverLandUnit) {
    Weapons = {
        MainGun = Class(ADFDisruptorCannonWeapon) {}
    },
   
   OnLayerChange = function(self, new, old)
        AHoverLandUnit.OnLayerChange(self, new, old)
        if( old != 'None' ) then
            if( new == 'Land' ) then
              self:SetSpeedMult(1)
            elseif( new == 'Water' ) then
                self:SetSpeedMult(.7)
            end
        end
    end,
TypeClass = UAL0201
}
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak

Re: Water modifier

Postby Ithilis_Quo » 29 Mar 2015, 15:48

i take you script copypast it on blaze .lua file for this:
Code: Select all
#****************************************************************************
#**
#**  File     :  /data/units/XAL0203/XAL0203_script.lua
#**  Author(s):  Jessica St. Croix
#**
#**  Summary  :  Aeon Assault Tank Script
#**
#**  Copyright © 2007 Gas Powered Games, Inc.  All rights reserved.
#****************************************************************************
local AHoverLandUnit = import('/lua/aeonunits.lua').AHoverLandUnit
local ADFQuantumAutogunWeapon = import('/lua/aeonweapons.lua').ADFQuantumAutogunWeapon

XAL0203 = Class(AHoverLandUnit) {
    Weapons = {
        MainGun = Class(ADFQuantumAutogunWeapon) {}
    },
   OnLayerChange = function(self, new, old)
        AHoverLandUnit.OnLayerChange(self, new, old)
        if( old != 'None' ) then
            if( new == 'Land' ) then
              self:SetSpeedMult(1)
            elseif( new == 'Water' ) then
                self:SetSpeedMult(.5)
            end
        end
    end,
}
TypeClass = XAL0203


set up number 0.5 for be easy visible if it work, Also on blue print of blaze i take
Code: Select all
Physics = {
        BankingSlope = 0,
        BuildOnLayerCaps = {
            LAYER_Air = false,
            LAYER_Land = true,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = false,
        },
        DragCoefficient = 0.2,
        Elevation = 0.15,
        MaxAcceleration = 4,
        MaxBrake = 4,
        MaxSpeed = 4,
        MaxSpeedReverse = 0,
        MaxSteerForce = 20,
        MeshExtentsX = 1,
        MeshExtentsY = 0.5,
        MeshExtentsZ = 1,
        MinSpeedPercent = 0,
        MotionType = 'RULEUMT_Hover',
        RotateBodyWhileMoving = true,
        RotateOnSpot = false,
        TurnFacingRate = 120,
        TurnRadius = 0,
        TurnRate = 90,
   WaterSpeedMultiplier = 0.5


waterspeedmultilier (that i copypast from megalith).

co i copypast all file from blaze folder, change this think and it doenst work :( speed is same on land as on water.
"Fixed in Equilibrium" Washy
User avatar
Ithilis_Quo
Supreme Commander
 
Posts: 1390
Joined: 29 Dec 2012, 15:55
Location: Slovakia
Has liked: 395 times
Been liked: 181 times
FAF User Name: Ithilis

Re: Water modifier

Postby The Mak » 30 Mar 2015, 18:41

Hover Speed Change Individual.zip
(3.02 KiB) Downloaded 67 times


Here is a quick mod using the script Krapougnak posted. I do not know if you have a format issue Ithilis, so compare what I have to what you have. The mod works for both the Aurora and Blaze. You can replicate it to all the other hover units accordingly.

A note on testing this mod using the cheat unit spawn menu; make sure you spawn your hover units on land. If you spawn your hover units on water they will move the same speed as if on land. Why? Because there was not a layer change. The function is only called when there is a layer change (land moving onto water). So if you have a mod that allows the Tempest to build all hover units *cough*like I made*cough* then the hover units will move at land speed when they are built in water. Transporting hover units from land onto water works fine.

Also this is a bug with the Megalith as well. If you build a Megalith in water it will not get its water speed bonus until it moves onto land and back into water. Try racing a Megalith built (or spawn) on land and one built (or spawned) under water. Move the land built Megalith under water and race the two and you will see that it wins. To fix that we just need to add some lines from OnLayerChange to OnStopBeingBuilt in the Megaliths script.

Also, in the mod I had posted you will see a file mod_units.lua. In your second bit of code you had added the WaterSpeedMultiplier to the blueprint file. Now in Krapougnak’s posted code you will see that is not needed because it is set directly in the function. You can use a blueprint merge as I have created so that you only add what you need to the blueprint file. It plays nice with other mods and cuts down on the number of files (and possible mistakes). You will need to edit Krapougnak’s posted code to get that data from the blueprint. The Megalith’s script has a good example to follow.
User avatar
The Mak
Contributor
 
Posts: 342
Joined: 03 Mar 2012, 21:09
Location: New York, NY, USA
Has liked: 5 times
Been liked: 39 times
FAF User Name: The_Mak

Re: Water modifier

Postby Ithilis_Quo » 01 Apr 2015, 23:59

thx mark,

i make crazy number of mistake in code. that was reason why it was not working. but already it is done, i hope everything work fine, and in vault its last version of hover_rework v10 mode
"Fixed in Equilibrium" Washy
User avatar
Ithilis_Quo
Supreme Commander
 
Posts: 1390
Joined: 29 Dec 2012, 15:55
Location: Slovakia
Has liked: 395 times
Been liked: 181 times
FAF User Name: Ithilis


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest