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

Scripting perks into pre-existing maps

HOT
broken avatar :(
Created 9 years ago
by jiggy22
0 Members and 1 Guest are viewing this topic.
16,183 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
So I'm working on an expansion mod of Der Riese (which you can see more of in the works in progress subsection), and I was wondering how it's possible to script in other perks into the map. I know it's definitely possible, after looking at xSanchez78's Der Riese mod and lilrifa's Nacht Der Untoten revamp mod, but I have no idea where to start. Any experienced scripters out there that have any idea? Thanks :)
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
first you will need someway of showing your players origin and angle, then a script to place your perk as needed, heres my versions of those i used in my nacht and verruckt mod

origin showing script:
Code Snippet
Plaintext
development_get_coordinates()
{
wait 5;
players = get_players();
players[0] thread dev_hud_position();
players[0] thread dev_hud_angles();
players[0].score = 50000;
players[0].score_total = 50000;
}
dev_hud_position()
{
traphint = NewClientHudElem( self );
traphint.alignX = "center";
traphint.alignY = "middle";
traphint.horzAlign = "center";
traphint.vertAlign = "middle";
traphint.y += 140;
traphint.foreground = true;
traphint.fontScale = 1;
traphint.alpha = 1;
traphint.color = ( 1.0, 1.0, 1.0 );
while(1)
{
origin = self getOrigin();
if(isdefined(origin))
traphint SetText("Position: " + origin);
wait(2);
}
}
dev_hud_angles()
{
traphint = NewClientHudElem( self );
traphint.alignX = "center";
traphint.alignY = "middle";
traphint.horzAlign = "center";
traphint.vertAlign = "middle";
traphint.y += 155;
traphint.foreground = true;
traphint.fontScale = 1;
traphint.alpha = 1;
traphint.color = ( 1.0, 1.0, 1.0 );
while(1)
{
if(isdefined(self.angles))
traphint SetText("Angles: " + self.angles);
wait(2);
}
}

call development_get_coordinates(); at the bottom of your mapname (should be nazi_zombie_factory if its der riese)

note: remove or comment out this before release, it will cause a game crash eventually cause of the settext


now for spawning perks...

place this somewhere in the mapname
Code Snippet
Plaintext

place_perk( machine_origin,  machine_angles, model, targetname, specialty)
{
perk = Spawn( "script_model", machine_origin );
perk.angles = machine_angles;
perk setModel( model );
perk.targetname = targetname;

perk_trigger = Spawn( "trigger_radius", machine_origin + (0 , 0, 50), 0, 60, 50 );
perk_trigger.targetname = "zombie_vending";
perk_trigger.target = targetname;
perk_trigger.script_noteworthy = specialty;

spawnCollision("collision_geo_64x64x128", "collider", machine_origin+(0, 0, 50), machine_angles);
}


now BEFORE main (best to put this somewhere at the top of init)

place this
Code Snippet
Plaintext
		level thread place_perk( (514.322, 986.874, 142),  (0, 0, 0), "zombie_vending_cherry", "vending_cherry", "specialty_gpsjammer");

now i'll explain how it works

the first bit - ( (514.322, 986.874, 142) ) is the coordinates to place the perk at, when using the first script it will say your origin, when you find a nice place, put those coordinates here

2nd bit - (0, 0, 0) is the angle or rotation of the perk, you should only need to change the middle one unless your perk is going to be on an angle

3rd bit - ( "zombie_vending_cherry" ) is the perks model, the machine to be used, this should of been added to your mod.csv, and probably should be a precachemodel( model_name ) before this line

4th bit - ( "vending_cherry" ) is the machines targetname, its also the triggers target

5th bit - ( "specialty_gpsjammer" ) is the specialty the perk uses, should be the script_noteworthy of the perk trigger

last thing, this makes it so you dont buy the perk y just standing next to it

go to _zombiemode_perks and find
Code Snippet
Plaintext
vending_trigger_think()

and under
Code Snippet
Plaintext
		self waittill( "trigger", player );

place this

Code Snippet
Plaintext
		if (!player UseButtonPressed() )
{
continue;
}


let me know if you need help with anything
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Dude, you're AMAZING! I'll be sure to try it out and let you know how it goes. Thank you!

EDIT: Okay, so for the first part, I just paste that script at the bottom of nazi_zombie_factory.gsc? Or do I make it as it's own separate gsc? Because I simply pasted it at the end of nazi_zombie_factory, and nothing changed.
Last Edit: January 21, 2017, 05:00:04 am by jiggy22
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Dude, you're AMAZING! I'll be sure to try it out and let you know how it goes. Thank you!

EDIT: Okay, so for the first part, I just paste that script at the bottom of nazi_zombie_factory.gsc? Or do I make it as it's own separate gsc? Because I simply pasted it at the end of nazi_zombie_factory, and nothing changed.
you will need to call the script, you cant just place a script function and expect it to activate itself

add
level thread development_get_coordinates();

under
   /*--------------------
    FUNCTION CALLS - POST _Load
   ----------------------*/
in your mapname gsc
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Thanks, that finally worked. If anybody's having the same issue, and there's no "FUNCTION CALLS - Post Load" section in your gsc file, you can instead paste it at the very top under "maps\nazi_zombie_factory_fx::main();" (mine used for reference).

Double Post Merge: January 23, 2017, 11:31:27 pm
Okay, so now here comes the next issue that I'm facing. I'm using the models found in Harry's perk pack for my mod, but because his pack messes up my mod whenever I install it, I don't have any of his gscs installed in my mods folder. I successfully have the perk model in my map, but you can walk through it and it doesn't turn on. Any way I can get the perks to work without having to install his gsc files?

Of course, I could just ask if anybody knows how I could fix the problems I'm having with his perk pack instead. When I load up my game, the perks aren't purchasable, and the hand icon pops up in place of the "Place and Hold F to buy etc". Has anybody been able to fix this?
Last Edit: January 23, 2017, 11:31:27 pm by jiggy22
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Still looking for help with this if anybody knows how  :)
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
i dont think your going to be able to use harrys perks, since they replace the patch file and this is an existing map. i made my own perks, didnt use anyones tutorial or anything so im not sure if its possible
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Quote from: death_reaper0 link=topic=14625.msg147353#msg147353 date= 1485316185
i dont think your going to be able to use harrys perks, since they replace the patch file and this is an existing map. i made my own perks, didnt use anyones tutorial or anything so im not sure if its possible

Yeah, that makes sense! I'm planning on using his exported xmodels only, but I'm guessing I would have to add the functions of the perk into the _zombiemode_perks gsc file instead, right? I'm guessing for Deadshot, it wouldn't be too too difficult. All that the perk needs to do is to multiply the crosshair by .45 or so, increase damage on headshots, and award 40 extra points per headshots. How would I start to go about with scripting this? Thanks again, you've really been a big help with all of this for me!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
add this to your mod.csv, it will make your spawned perk solid

Code Snippet
Plaintext
xmodel,collision_geo_64x64x128
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Thanks again for the help, I always appreciate it!
Okay, so now the perk is solid. I have the functions of the perk at the bottom of the perks gsc, and it is called at the top. But still nothing changes. Do I have to reference the specialty in the materials folder in my gsc? Or did I just mess something up in the gsc?
On top of that, how do I make it so that:
- The perk makes the rattling noise when I walk into it.
- Find change when you go prone.

Here's the code that I'm using right now for Deadshot, but I'll probably add more to it.
Code Snippet
Plaintext
deadshot()
{
while(1)
{
if(self hasperk("specialty_bulletaccuracy") && self GetCurrentWeapon() != "stielhandgranate")
self setClientDvar( "cg_laserForceOn", 1 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}

Sorry if this is a lot to ask for!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.

On top of that, how do I make it so that:
- The perk makes the rattling noise when I walk into it.
- Find change when you go prone.

this involves a trigger multiple, i dont think you can spawn that through script


Here's the code that I'm using right now for Deadshot, but I'll probably add more to it.
Code Snippet
Plaintext
deadshot()
{
while(1)
{
if(self hasperk("specialty_bulletaccuracy") && self GetCurrentWeapon() != "stielhandgranate")
self setClientDvar( "cg_laserForceOn", 1 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}

Sorry if this is a lot to ask for!

did you set the perk to have that specialty? also make sure a PLAYER is calling this, not the level, otherwise it wont work
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Okay, so I've set it to
Code Snippet
Plaintext
player thread deadshot();

And I've defined player in the deadshot function, but trying to load up the map gives me the "unitialized variable players" error.

I'm guessing that this isn't correct?
Code Snippet
Plaintext
deadshot()
{
players = getplayers();
while(1)
{
if(self hasperk("specialty_bulletaccuracy") && self GetCurrentWeapon() != "stielhandgranate")
self setClientDvar( "cg_laserForceOn", 1 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Okay, so I've set it to
Code Snippet
Plaintext
player thread deadshot();

And I've defined player in the deadshot function, but trying to load up the map gives me the "unitialized variable players" error.

I'm guessing that this isn't correct?
Code Snippet
Plaintext
deadshot()
{
players = getplayers();
while(1)
{
if(self hasperk("specialty_bulletaccuracy") && self GetCurrentWeapon() != "stielhandgranate")
self setClientDvar( "cg_laserForceOn", 1 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}

no, you need to make the players run that thread, do it like this

Code Snippet
Plaintext

deadshot_init()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
players[i] thread deadshot();
}

deadshot()
{
while(1)
{
if(self hasperk("specialty_bulletaccuracy") && self GetCurrentWeapon() != "stielhandgranate")
self setClientDvar( "cg_laserForceOn", 1 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}

and call deadshot_init(); instead, also make that level thread, not player thread
[/code]
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Hey, so I did all of that, and still nothing changed. Even when the power is on, when I walk up to the machine, all it says is that I still need to turn the power on. Any chance you can take a look at my perk gsc and tell me what I did wrong? Thank you so much, sorry that I've made this 10 times more complicated than it should have been!

https://mega.nz/#!vxdHwbwD!wo1myti6k_BMrSOO99R2oY1XiEwDXOZszN4_V2yjsUQ
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
in

Code Snippet
Plaintext
turn_deadshot_on()
{
machine = getentarray("vending_deadshot", "targetname");
//temp until I can get the wire to jugger.
level waittill("juggernog_on");

for( i = 0; i < machine.size; i++ )
{
machine[i] setmodel("bo2_zm_al_vending_ads_on");
machine[i] vibrate((0,-100,0), 0.3, 0.4, 3);
machine[i] playsound("perks_power_on");
machine[i] thread perk_fx( "doubletap_light" );

}
level notify( "specialty_bulletaccuracy_on" );

}

Code Snippet
Plaintext
level notify( "specialty_bulletaccuracy_on" );
should be

Code Snippet
Plaintext
level notify( "specialty_bulletaccuracy_power_on" );

 
Loading ...