Completed Player Unit

thetroll527 · 1059

thetroll527

  • Jr. Member
  • **
    • Posts: 13
Completed Player Unit
on: June 30, 2021, 12:11:11 pm
How can you create a completed player unit for map?

I want a disserted base with some old stuff left around, but I want them completed. 

Thanks.



Karsten75

  • Hero Member
  • *****
    • Posts: 7321
Re: Completed Player Unit
Reply #1 on: June 30, 2021, 12:37:10 pm
You can either scavenge another map with units similar to the ones you want, or you can start here:
https://knucklecracker.com/wiki/doku.php?id=cw4:custom_units

'If you want to live a happy life, tie it to a goal, not to people or things.'

Albert Einstein
(1879-1955)


thetroll527

  • Jr. Member
  • **
    • Posts: 13
Re: Completed Player Unit
Reply #2 on: June 30, 2021, 12:54:47 pm
What I am trying to do is just have some completed miners, guns and factory. 



Karsten75

  • Hero Member
  • *****
    • Posts: 7321
Re: Completed Player Unit
Reply #3 on: June 30, 2021, 02:06:41 pm
oh!. Click Ctrl-end while pointing (not selecting) a unit. it's in the Circled "I" popup on the editor pane.



'If you want to live a happy life, tie it to a goal, not to people or things.'

Albert Einstein
(1879-1955)


thetroll527

  • Jr. Member
  • **
    • Posts: 13
Re: Completed Player Unit
Reply #4 on: June 30, 2021, 02:52:07 pm
Thanks a bunch, no idea why I didn't see that.




The Apocalyptic

  • Full Member
  • ***
    • Posts: 33
Re: Completed Player Unit
Reply #5 on: April 13, 2022, 04:53:51 pm
What about filling a completed unit with ammo, if it uses any.



Karsten75

  • Hero Member
  • *****
    • Posts: 7321
Re: Completed Player Unit
Reply #6 on: April 13, 2022, 07:12:10 pm
What about filling a completed unit with ammo, if it uses any.

Wow, way to necro a post! :D

Anyway, when you create the unit, in its "Settings" tab, choose "weapon" sub-tab and then set all options rea ammo:


'If you want to live a happy life, tie it to a goal, not to people or things.'

Albert Einstein
(1879-1955)


Builder17

  • Community Guild
  • *****
    • Posts: 1210
  • My account picture is from Nitrome Mutiny.
Re: Completed Player Unit
Reply #7 on: April 14, 2022, 10:01:27 am
What about filling a completed unit with ammo, if it uses any.

When you create the unit, in its "Settings" tab, choose "weapon" sub-tab and then set all options rea ammo

I think they mean creating a vanilla unit, like Cannon or Mortar with ammo in map editor, pretty sure this requires 4rpl commands GetUnitMaxAmmo and SetUnitAmmo



The Apocalyptic

  • Full Member
  • ***
    • Posts: 33
Re: Completed Player Unit
Reply #8 on: April 14, 2022, 01:00:35 pm
Right, Builder17!

Also, thank you. That helps a lot. I also meant doing the same with modded units, though. Would that work the same way?



Builder17

  • Community Guild
  • *****
    • Posts: 1210
  • My account picture is from Nitrome Mutiny.
Re: Completed Player Unit
Reply #9 on: April 14, 2022, 02:13:01 pm
I also meant doing the same with modded units, though. Would that work the same way?

Yes, but for modded units also check K75's message above mine's. :)



Vertu

  • Full Member
  • ***
    • Posts: 233
Re: Completed Player Unit
Reply #10 on: April 14, 2022, 02:58:23 pm
Create a new console script, copy and paste the code into said script, close what ever you are using to edit/create the console script and save the changes.
Have the console opened before selecting units.
Select all the units you wish to be built and have full ammo.
Click "Run Once", or if you want to build every unit you select at any moment, just have it keep running. It will work perfectly fine when left running.
Every unit you select when the script runs will be constructed and given it's maximum ammo.

Code: [Select]
GetSelectedUnits ->units
if(GetListCount(<-units) gt0)
do(GetListCount(<-units) 0)
ConstructUnit(<-units[I] 10000)
SetUnitAmmo(<-units[I] GetUnitMaxAmmo(<-units[I]))
SetUnitHealth(<-units[I] GetUnitMaxHealth(<-units[I]))
loop
ClearTraceLog
Trace3("Fully built " GetListCount(<-units) " selected units.")
else
if(GetUnitUpdateCount lt(2))
Trace("No units where selected for building.")
else
if(GetUnitUpdateCount 10 % eq0)
ClearTraceLog
if(<-count eq0)
Trace("Operating. |")
1 ->count
else
if(<-count eq(1))
Trace("Operating. /")
2 ->count
else
if(<-count eq(2))
Trace("Operating. -")
3 ->count
else
Trace("Operating. \")
0 ->count
endif
endif
endif
endif
endif
endif
Since .4rpl files are not in the exportable file type white-list, I could not just give you the script directly.

Life isn't fair because we say it isn't. Not because it is unfair. In fact, it is so fair we want to say it isn't and do.


The Apocalyptic

  • Full Member
  • ***
    • Posts: 33
Re: Completed Player Unit
Reply #11 on: April 15, 2022, 03:17:09 pm
Thanks, Vertu!

I did wind up making a manual version, though, because I also needed to adjust the position of a specific ONE of the units in the affected area.



The Apocalyptic

  • Full Member
  • ***
    • Posts: 33
Re: Completed Player Unit
Reply #12 on: April 15, 2022, 03:33:20 pm
What if the units are prebuilt?

Edit: Never mind. It just fills the ammo. Thanks again, Vertu!
« Last Edit: April 15, 2022, 03:56:15 pm by The Apocalyptic »