UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Power Generator (Buyable Fuel)

broken avatar :(
Created 3 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
832 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Howdy,

Here i have created a Power Generator Script. This will control the "off/on-state" for perks & lights(inc light models), as well as enabling/disbling perks trigs along with any other "powered machine" you wish to add to it.
Its quite handy for maps that rely on lights & also for those who just want to add a little something extra to ur map to keep players busy then this'll do that too aha.

CREDITS:
TheRevenantSkull - for helping me out with understanding "turning fx's on/off" on an earlier version of this.
HitmanVere - for helping me out with understanding how to make a var a global one and for the general approach of the buy/deposit fuel func.
"some dude on ugx" - who posted a topic about using a hud to display engine(player health). Ive since deleted that bookmark so i dont know his name but i am essentially using the same example he provided in his tut.
& of course the "gang":
JohnDoe
Numan
Dr. Dronken
 - for all their help along the way. :)

Link to the whole steam(not appdata) mapname mod folder:
https://mega.nz/file/Bl4UTZoI#_9zI7pY0R0hiqzpzLxKlFmosdV8mv88TVDOEVrpVUAI

Link to the map_source file:
https://mega.nz/file/Y9x0SbqA#zrVbnjfBBXLFMoFFsWfg_nXho4JLKM2VLFBdiFbGgak
I've incuded the map_source file coz i have setup the lights kvps pretty well as seen in the video so if you wish to use them for ur map then open the map and copy the light & info-full. Or if you want to build off this template map then feel free to do so.

End result video:
https://www.youtube.com/watch?v=Nlq44ORuwhs&ab_channel=PhilGibson
NOTE: in this video ive set the "tank limit" to 15 seconds for testing purposes & to obv show you its on/off state w/out the video lasting for 30mins lol
However: In the mod folder download ive set the "full tank limit" to 30 minutes with each fill up consisting of 5 minutes(6 fill ups for a full tank) with each fill up costing 500 points(3000 points for a full tank).
Installation:
Code Snippet
Plaintext
in your mapname.gsc file

add-
maps\_powered_stuff::init();

below-
maps\_zombiemode::main();

and either comment out or delete this-
level.DLC3.useElectricSwitch = true;

close mapname.gsc

//------------------

add-
_powered_stuff.gsc file to root>mods>mapname>maps folder
&
_lights.csc file to root>mods>mapname>clientscripts folder

//------------------

add your "on-state" models to your mod.csv like so-

xmodel,lights_indlight_on
xmodel,lights_berlin_subway_hat_100
these are the 2 "on"_models i used.

also add your "on-state" models to _zombiemode.gsc

search-
precache_models()

heres how i have the 2 i used setup in that func-
//on-state models
precacheModel("lights_indlight_on"); //wall light model
precacheModel("lights_berlin_subway_hat_100"); //ceiling light model

close _zombiemode.gsc

//------------------

in dlc3_code.gsc

search-
if( isDefined( level.DLC3.useElectricSwitch ) && level.DLC3.useElectricSwitch )

and it will bring you to the if/else part. it will look like this-
if( isDefined( level.DLC3.useElectricSwitch ) && level.DLC3.useElectricSwitch )
{
    level thread power_electric_switch();
}
else
{
    level thread power_electric_switch_on();
}

either delete or comment out this if/else.

now... search-
power_electric_switch()

& either delete or comment out the entire function.

close dlc3_code.gsc

//------------------

in _zombiemode_perks.gsc search-
activate_PackAPunch()

and you will see this line-
self setmodel("zombie_vending_packapunch_on");

comment that line out.
for those who dont know you can "comment stuff out" by simply putting // before a line of code... like so-

//self setmodel("zombie_vending_packapunch_on");  <--- this line of code will now NOT get executed.

ok... moving on.

in these functions-
turn_revive_on()
turn_sleight_on()
turn_jugger_on()
turn_doubletap_on()

comment out the setModel line & thread perk_fx line

search-
perk_fx( fx )

comment out the playfx line.

close _zombiemode_perks.gsc

//------------------

open radiant and either delete the power switch script_struct & replace it with a script_origin & give it this kvp-
targetname
power_switch_fx

or...

simply open the generator_map.map file and copy the power switch ive used.

//------------------

now compile the level and build the mod and you should be done.
if you have any issues(maybe i forgot a step?) then message me on ugx discord- Phil81334
Hope you enjoy it!
Phil
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 31 October 2020
Last active: 2 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
e2705's Groups
e2705's Contact & Social Links
in  _powered_stuff.gsc

CHANGE:

    level.deposit_fuel_trig setHintString("Deposit fuel for 5 seconds of power.");

TO:

    level.deposit_fuel_trig setHintString("Deposit fuel for 5 minutes of power.");


You will get 300 sec of power, thats  5 minutes, not seconds :)

I will use this script now in my new map. :sunglass-smiley: Thanks for posting this script.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
in  _powered_stuff.gsc
 
CHANGE:
 
    level.deposit_fuel_trig setHintString("Deposit fuel for 5 seconds of power.");
 
TO:
 
    level.deposit_fuel_trig setHintString("Deposit fuel for 5 minutes of power.");
 
 
You will get 300 sec of power, thats  5 minutes, not seconds :)
 
I will use this script now in my new map. :sunglass-smiley: Thanks for posting this script.
aha ;)

 
Loading ...