Advanced Replace Weapon Question

I want my 15 rapid-fire quantum torpedo launchers Uber-Defiant now! - Get help from modders. Share your work. Discuss modifications.
1, 2
posted on March 24th, 2011, 4:53 pm
Here's my question:

Say at the begining of a game a unit (like a scout) starts off the game by selecting that unit, then pushing a "special weapon" button to select the avatar.  Afterwards, 2 construction ships warp onto the map.  Afterwards, none of the avatar buttons should be available.  What would be done to make it so that once one of the avatar buttons are pressed, all avatar buttons are unavailable?  Assuming it's even possible.
posted on March 24th, 2011, 5:53 pm
Of course that's possible. That's how it works ingame, only with a starbase instead of a scout.

Avatar buttons are just like special weapon buttons in how they work, so once the unit carrying the replaceweapons (the starting scout) is gone, the buttons will go too. So, to do this, you need to have the avatar replaceweapons replace the scout with it's avatar-ed version (or just one without the avatars replaceweapons).
posted on March 24th, 2011, 6:04 pm
But the other ships are going to warp onto the map.  So I'll need to make sure that the warp-in happens only once.

What about a replaceweapon on a delay?  Say 60 seconds, that will replace the scout with one that doesn't have the avatar bonuses.  That way, you can choose your avatar, the avatar will be on a super-long delay, then once those 60 seconds are up, the scout is replaced.  I take it that the "replaceInstantX" commands can be used to remove player control of that "weapon."

If I put this in, then theoretically, the player would have time to choose their avatar before the avatar options are no longer available.  All I would need to do is make sure that it's impossible to select another avatar option before time runs out, right?

Code: Select all
replacementInstantPlayer = 1
replacementInstantDelay = 60
posted on March 24th, 2011, 8:02 pm
I'm a bit confused by your meaning.  The current system replaceweapons your starbase with a new starbase that doesn't have the buttons to select avatars. (I think)  From there, you can build constructors that lead to your avatar's versions of everything.

You can replace the accelerated build with a warpin to a specific location, that sounds pretty easy.  And the selector scout can replaceweapon itself with a non-selecter scout.  But you will also need to replaceweapon the starbase to make your avatar's constructors.

Do you want to make it so players can build constructors and freighters before they choose an avatar?  In that case you'd need to replaceweapon them all when the avatar is chosen.

Or are you thinking just let people scout for a bit before they decide?  If that's the case, they would lose time by not building anything until they see the enemy.  And if the scout dies, you can't build.

You could try giving people generic constructors that can only build mining colonies, and when an avatar is chosen they gain a special to convert into that avatar's constructor.  But then you'd need to remove Taqroja's cheaper miners.
posted on March 24th, 2011, 9:47 pm
Starbase?  Who said anything about a starbase?  You'll have to build the starbase.  I was wondering if it would be possible so that when the avatar is selected, the constructor warps in and at the same time, the scout is replaced.  And I'm wanting to apply this to every faction.  The reason is simple.  It's realistic.  Sure it'll disrupt the balance a little which I'm sure can be rebalanced properly, but it'll give players more time to choose what they want to be.  And allow them to explore the map a little to choose a suitable location.
posted on March 24th, 2011, 9:58 pm
why is it more realistic for you to have to build a starbase instead of it being built when u take control? just assume that before the game started, the starbase was built. saves you waiting the several minutes for a starbase to build.
posted on March 24th, 2011, 10:20 pm
Is it possible to have the avatar selection immediately replace the scout and warp-in the construction ships at the same time?
posted on March 25th, 2011, 1:33 pm
Yes.  Just have the replaceweapon replace the scout with a scoutS or whatever to have it warp out, AND replace a trigger on the map that will call in the warpin for your constructor.

I like this idea man. :thumbsup:
posted on March 25th, 2011, 6:14 pm
How would I have the other scout warp out?  Here's what I'm doing:

_scoutS - Find a suitable location, then warp 2 constructors to the area near the scout.  As soon as the warp-in command is given, replace the scout with _scout.  The scout will not be warped in or out, just replaced with one that doesn't have the avatar options.  This way, no one has a time limit to pick their avatars.  How might I accomplish this?  I thought of using the "u_ball_object" class label.
posted on March 25th, 2011, 6:52 pm
Thats even easier.  make the avatar select replaceweapon not keep its owner, replace it with a scout that will not warp out, and replace the warpin trigger that will instantly warp in your choice of constructionships.

I liked it better when the scout would warp out first though. :innocent:
posted on March 25th, 2011, 7:14 pm
Can you give me some example code that I can work with?  I'm not quite sure how I would accomplish what you are saying.  Although I do have a vague idea.

I tried something similar before, but the result wasn't good.
"You are vanquished!" (2 seconds into the game)
posted on March 26th, 2011, 12:16 am
Last edited by Anonymous on March 26th, 2011, 12:18 am, edited 1 time in total.
ok, so as I explained in another thread, warpin works like this.

StationShip --> Warpin select button
  • warpin select code looks like this:
Code: Select all
wpnname = "Warp In"
tooltip = "Warp In"
verbosetooltip = "AUTOTOOLTIP-fed_warpin.odf"
buttonslot = 1
range = 999999
needtarget = 1
targetlocation = 1
aitargetlocation = 1
targetalliedcraft = 0
targetalliedbuildings = 0
targetenemycraft = 0
targetenemybuildings = 0
specialenergycost = 100000
replacementkeepowner = 1
replacementresetspecialenergy = 1
replacementinstantai = 1
replacementinstantcycle = 500
replacementmode = 1
replacement0condition = "unitedfederation"
replacement0class0 = "fed_warpinE"
overrideceasefire = 1
selectmode = 2
fleetcapfile = "all_cap_warpin.odf"
transferstats = 0
replacementmaintainorders = 0
classlabel = "replaceweapon"
special = 1
replacementregisterasnew = 0
replacementcreationtype = 1
overridesubsystem = 1
speakonattack = 0
attackspeech = 0

    You should be able to see that this does not actually warpin ships.  In fact, what it does is 1: if you are AI, it will instantly replace fed_warpinE.odf to map at current location, then cycle with SpE recharge, or 2: if you are human, replace fed_warpinE.odf to the map at the place you selected.


    So now, fed_warpinE.odf is on the map.  Here is what it looks like:(besides it being invisible on the map.)
    Code: Select all
    basename = "trigger_general"
    unitname = "Derelict Creation"
    tooltip = "Derelict Creation"
    verbosetooltip = "Creates a derelict unit from the unit label"
    race = "npc_wreckage"
    buildtime = 0
    maxhealth = 100
    curhealth = 100
    healthrate = 0
    maxshields = 100
    curshields = 100
    shieldrate = 0
    shieldgeneratorhitpoints = 300
    engineshitpoints = 300
    weaponshitpoints = 300
    lifesupporthitpoints = 300
    sensorshitpoints = 300
    maxspecialenergy = 0
    specialenergyrate = 0
    physicsfile = "basic_dont_move.odf"
    trekphysicsfile = "basic_dont_move.odf"
    avoidme = 0
    avoidanceclass = 0
    animation = 2
    hidden = 1
    fleetcapfile = "all_cap_warpin.odf"
    weapon1 = "fed_warpinA"
    weaponhardpoints1 = "root"
    enginestargethardpoints = "root"
    lifesupporttargethardpoints = "root"
    weaponstargethardpoints = "root"
    shieldgeneratortargethardpoints = "root"
    sensorstargethardpoints = "root"
    hulltargethardpoints = "root"
    criticaltargethardpoints = "root"
    shipclass = "cruiser"
    shiptype = "C"
    .
    .
    .


    Simply enough, this is a trigger.  A trigger is basically an invisible ship with a replaceweapon that replaces the trigger with something else.  It is a pretty awesome piece of genius the devs came up with. In this case, this trigger is what warps in other ships.  here is the fed_warpinA.odf.(the replaceweapon the trigger has)

    Code: Select all
    wpnname = "Warp In"
    buttonslot = 1
    targetalliedcraft = 0
    targetalliedbuildings = 0
    targetenemycraft = 0
    targetenemybuildings = 0
    replacementwarpin = 1
    replacementresetspecialenergy = 1
    replacementresetcrew = 1
    replacementinstantai = 1
    replacementinstantderelict = 1
    replacementinstantplayer = 1
    replacement0class0 = "fed_nebulaW"
    replacement0class0randomweight = 20
    replacement0class1 = "fed_galaxyW"
    replacement0class1randomweight = 40
    replacement0class2 = "fed_nebula_torpW"
    replacement0class2randomweight = 40
    replacement1class0 = "fed_excelsiorW"
    replacement1class0randomweight = 60
    replacement1class0position = 0,0,200
    replacement1class1 = "fed_steamrunnerW"
    replacement1class1randomweight = 15
    replacement1class1position = 0,0,200
    replacement1class2 = "fed_ambassadorW"
    replacement1class2randomweight = 25
    replacement1class2position = 0,0,200
    replacement2class0 = "fed_excelsiorW"
    replacement2class0randomweight = 50
    replacement2class0position = 0,0,-200
    replacement2class1 = "fed_nebulaW"
    replacement2class1randomweight = 10
    replacement2class1position = 0,0,-200
    replacement2class2 = "fed_nebula_torpW"
    replacement2class2randomweight = 5
    replacement2class2position = 0,0,-200
    replacement2class3 = "fed_galaxyW"
    replacement2class3randomweight = 10
    replacement2class3position = 0,0,-200
    replacement2class4 = "fed_ambassadorW"
    replacement2class4randomweight = 25
    replacement2class4position = 0,0,-200
    overrideceasefire = 1
    replacementignorefleetcap = 1
    classlabel = "replaceweapon"
    special = 1
    replacementmaintainorders = 1
    overridesubsystem = 1
    speakonattack = 0
    attackspeech = 0



    This code is important, but not the only thing required to warp ships in.  Anyway, this specific replaceweapon has three slots(0,1,2) and several options for each.  all that really matters is that you are guaranteed all three ships, but the ships within those slots are used randomly so you will only get one at a time.  So, three ships, each selected randomly from a predefined group.


    And I think you know how it works from there.  The ships on the list have special properties and have a replaceweapon that replaces them with a regular ship when they have reached the spot they were supposed to warp to.


    The way your mod would differ is like this.

    Your scout has the avatar select replaceweapons.  these would act as your Warpin select button.  When you this code would look something like this.

    race_scoutS.odf --> avatar select:
    Code: Select all
    wpnname = "Admiral Whatever"
    tooltip = "Admiral Whatever"
    verbosetooltip = "AUTOTOOLTIP-avatar_race_avatarZ.odf"
    buttonslot = 1
    replacement0class0 = "race_warpinE"
    replacement0class0 = "race_scout(W)"
    replacementevent = "AvatarWhatever"
    replacementkeepname = 0
    replacementdontremovefootprint = 0
    replacementinstantai = 1
    overrideceasefire = 1
    classlabel = "replaceweapon"
    special = 1
    replacementmaintainorders = 1
    replacementregisterasnew = 1
    replacementcreationtype = 1
    replacementignorefleetcap = 1
    overridesubsystem = 1
    speakonattack = 0
    attackspeech = 0


    In this case, you replace the race trigger and either a regular scout, or a scoutW(one of the forms of a ship while it is warping in) and have it belong to a full cap.  It should just warp out.  you would need to experiment with this but I am sure you could get it to work.

    The warpinE would be the same except of course have a race_warpinA instead of fed.

    The race_warpinA would look like this.


    Code: Select all
    wpnname = "Warp In"
    buttonslot = 1
    targetalliedcraft = 0
    targetalliedbuildings = 0
    targetenemycraft = 0
    targetenemybuildings = 0
    replacementwarpin = 1
    replacementresetspecialenergy = 1
    replacementresetcrew = 1
    replacementinstantai = 1
    replacementinstantderelict = 1
    replacementinstantplayer = 1
    replacement0class0 = "race_constructW"
    replacement1class0 = "race_constructW"
    replacement1class0position = 0,0,200
    overrideceasefire = 1
    replacementignorefleetcap = 1
    classlabel = "replaceweapon"
    special = 1
    replacementmaintainorders = 1
    overridesubsystem = 1
    speakonattack = 0
    attackspeech = 0


    Race_constructW being the derelict version of your construction ship that has those special properties I mentioned.  You make this through copy and paste from the ones in FO already.  That derelict has the ability to replace itself with a normal construction ship when it has arrived at the triggers location.


    And that would be for one avatar.  To do a second, you would need a second set of everything from the avatar select replaceweapon on.



    Hope that helps.  took me a while get this all out. :lol:

    Oh, and i think that if you still get the "you are vanquished" then you should make the trigger belong to your race instead of npc_wreackage. :blush:
    posted on March 26th, 2011, 1:28 am
    Well, I got the constructors to warp in, but the scout isn't replaced.  Here's the code.

    Code: Select all
    wpnname = "Admiral Ben Mayson"
    tooltip = "Admiral Ben Mayson"
    verbosetooltip = "AUTOTOOLTIP-avatar_fed_mayson.odf"
    buttonslot = 1
    range = 800
    needtarget = 0
    targetlocation = 0
    aitargetlocation = 0
    targetalliedcraft = 0
    targetalliedbuildings = 0
    targetenemycraft = 0
    targetenemybuildings = 0
    specialenergycost = 37
    replacementkeepowner = 1
    replacementresetspecialenergy = 1
    replacementinstantai = 1
    replacementinstantcycle = 500
    replacementmode = 1
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement1condition = "unitedfederation"
    replacement1class0 = "fed_venture"
    overrideceasefire = 1
    selectmode = 2
    transferstats = 0
    replacementmaintainorders = 0
    classlabel = "replaceweapon"
    special = 1
    replacementregisterasnew = 0
    replacementcreationtype = 1
    overridesubsystem = 1
    speakonattack = 0
    attackspeech = 0


    I tried this, but it didn't work.
    Code: Select all
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement0class0 = "fed_venture"


    I tried this, but Fleet-Ops crashed.
    Code: Select all
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement1class0 = "fed_venture"


    It seems that no matter what I do, unless I put a time-delayed auto-replaceweapon, the scout will not be replaced.
    posted on March 26th, 2011, 1:48 am
    Couldn't you use a time delayed auto replace weapon with a very small time? (0 or thereabouts)
    posted on March 26th, 2011, 2:35 am
    TChapman500 wrote:Well, I got the constructors to warp in, but the scout isn't replaced.  Here's the code.

    Code: Select all
    wpnname = "Admiral Ben Mayson"
    tooltip = "Admiral Ben Mayson"
    verbosetooltip = "AUTOTOOLTIP-avatar_fed_mayson.odf"
    buttonslot = 1
    range = 800
    needtarget = 0
    targetlocation = 0
    aitargetlocation = 0
    targetalliedcraft = 0
    targetalliedbuildings = 0
    targetenemycraft = 0
    targetenemybuildings = 0
    specialenergycost = 37
    replacementkeepowner = 1
    replacementresetspecialenergy = 1
    replacementinstantai = 1
    replacementinstantcycle = 500
    replacementmode = 1
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement1condition = "unitedfederation"
    replacement1class0 = "fed_venture"
    overrideceasefire = 1
    selectmode = 2
    transferstats = 0
    replacementmaintainorders = 0
    classlabel = "replaceweapon"
    special = 1
    replacementregisterasnew = 0
    replacementcreationtype = 1
    overridesubsystem = 1
    speakonattack = 0
    attackspeech = 0


    I tried this, but it didn't work.
    Code: Select all
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement0class0 = "fed_venture"


    I tried this, but Fleet-Ops crashed.
    Code: Select all
    replacement0condition = "unitedfederation"
    replacement0class0 = "avatar_fed_maysonE"
    replacement1class0 = "fed_venture"


    It seems that no matter what I do, unless I put a time-delayed auto-replaceweapon, the scout will not be replaced.


    Thats because you have replacementkeepowner = 1 :D

    Remove that line and your first attempt should work. :blush:
    1, 2
    Reply

    Who is online

    Users browsing this forum: No registered users and 1 guest