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

Abnormal202's easy easter egg system

broken avatar :(
Created 7 years ago
by qwerty195
0 Members and 1 Guest are viewing this topic.
3,143 views
broken avatar :(
×
broken avatar :(
Location: usU.S.A! U.S.A!
Date Registered: 10 June 2015
Last active: 3 years ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Abnormal202
Signature
-Abnormal202
×
qwerty195's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
So, after seeing about the 4th post asking for a tutorial where you pick up 3 objects and get some reward, I decided to make a tutorial just for that. Except, this tutorial has MANY different settings and rewards, so I recommend linking this to anyone who asks for something like the above-mentioned example.
 
With this tutorial you can:
  • collect objects by pressing "F" on them or shooting them.
  • place those objects down somewhere (optional)
  • Get a reward or reward(s) which currently are: a powerup drop (free perk powerup too), move a door or doors, and drop a gun or guns you can pick up.
  • There are also many other small options you find easily editable in the script.

So For Scripting, Go into your mapname.gsc and put this in your main function:
Code Snippet
Plaintext
thread easter_egg();
Then put this down at the bottom of the gsc:
Spoiler: click to open...
Code Snippet
Plaintext
function easter_egg()
{
level.reward = "door"; //what happens when you place the objects. Right now, options are: ("door","powerup","gun")
level.reward_2 = "gun"; //add another reward if you want. just say "false" or delete the line if you don't want an extra reward.
level.reward_3 = "false"; //add yet another reward if you want. Note that you cannot do more than one of the same reward.
level.powerup_type = "random"; //if using a powerup as one of your rewards, this is what type. can be ("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun",and "random")
level.place_the_objects = "true"; //whether or not you have to place the objects ("true") or just collect them ("false") to get the reward.
level.reward_weapons = array( "ar_damage", "lmg_cqb", "shotgun_pump", "smg_versatile" ); //weapons it can give you in the "gun" reward. put as many or as little as you like.
level.gun_expire = true; //whether or not the gun will go away in time.

level.trigger_hintstring = "Press ^3[{+activate}]^7 to pickup object"; //hintstring for picking up objects. If you don't want a hintstring for picking up objects delete this entire line.
level.trigger_place_hintstring = "Press ^3[{+activate}]^7 to place objects"; //hintstring for placing objects after collecting all of them. If you don't want a hintstring for placing objects delete this entire line.
level.gun_hintstring = "Press ^3[{+activate}]^7 to take weapon"; //if gun reward is activated, hintstring for picking up gun.
level.one_gun_per_player = "true"; //for gun powerup, set "true" if you want a gun to spawn for each player, "false" for just one gun no matter what.
level.different_guns_per_player = "false"; //for gun powerup, set "true" if you want each gun to be randomly different, false if you want them to be the same random gun. if one_gun_per_player = "false" this doesn't matter.

level.placed_objects = GetEntArray("placed_object","targetname");
if(isdefined(level.placed_objects))
{
for(i=0;i<level.placed_objects.size;i++)
{
level.placed_objects[i] Hide();
}
}
level.objects_picked_up = 0;
level.objects = GetEntArray("easter_egg_object","targetname");
for(i=0;i<level.objects.size;i++)
{
level.objects[i] thread wait_for_pickup();
}
}
function wait_for_pickup()
{
trig = GetEnt(self.target,"targetname");
trig SetCursorHint( "HINT_NOICON" );
if(isdefined(level.trigger_hintstring))
trig SetHintString(level.trigger_hintstring);
trig waittill("trigger",player);
self Delete();
trig Delete();
level.objects_picked_up ++;
if(level.objects_picked_up == level.objects)
{
if(level.place_the_objects == true)
{
trig_place = GetEnt("trig_place","targetname");
trig_place SetCursorHint( "HINT_NOICON" );
if(isDefined(level.trigger_place_hintstring))
trig_place SetHintString(level.trigger_place_hintstring);
trig_place waittill("trigger",player);
if(isdefined(level.placed_objects))
{
for(i=0;i<level.placed_objects.size;i++)
{
level.placed_objects[i] Show();
}
}
}
reward();
}
}
function reward()
{
if(level.reward == "door" || level.reward_2 == "door" || level.reward_3 == "door")
{
time = 2; //2 is amount of time in seconds door takes to move.
door_parts = GetEntArray("easter_egg_door","targetname");
for(i=0;i<door_parts.size;i++)
{
struct = struct::get(door_parts[i].target,"targetname");
door_parts[i] MoveTo(struct.origin, time);
}
wait(time);
for(i=0;i<door_parts.size;i++)
{
struct = struct::get(door_parts[i].target,"targetname");
struct Delete();
door_parts[i] Delete(); //Delete this line if you don't want the door to go away after its done moving.
}
}
if(level.reward == "powerup" || level.reward_2 == "powerup" || level.reward_3 == "powerup")
{
powerup_struct = GetEnt("powerup_struct","targetname");
if(level.powerup_type != "random")
thread zm_powerups::specific_powerup_drop( level.powerup_type, powerup_struct.origin);
if(level.powerup_type == "random")
{
rand = RandomIntRange( 0, 7 ); //("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun")
if(rand == 0)
thread zm_powerups::specific_powerup_drop( "full_ammo", powerup_struct.origin);
if(rand == 1)
thread zm_powerups::specific_powerup_drop( "nuke", powerup_struct.origin);
if(rand == 2)
thread zm_powerups::specific_powerup_drop( "insta_kill", powerup_struct.origin);
if(rand == 3)
thread zm_powerups::specific_powerup_drop( "free_perk", powerup_struct.origin);
if(rand == 4)
thread zm_powerups::specific_powerup_drop( "fire_sale", powerup_struct.origin);
if(rand == 5)
thread zm_powerups::specific_powerup_drop( "double_points", powerup_struct.origin);
if(rand == 6)
thread zm_powerups::specific_powerup_drop( "carpenter", powerup_struct.origin);
if(rand == 7)
thread zm_powerups::specific_powerup_drop( "minigun", powerup_struct.origin);
}
}
if(level.reward == "gun" || level.reward_2 == "gun" || level.reward_3 == "gun")
{
if(level.one_gun_per_player == false)
gun_struct = struct::get("gun_struct","targetname");
thread RewardGun(gun_struct.origin+(0,0,40), array::randomize(level.reward_weapons)[0]);
if(level.one_gun_per_player == true && level.different_guns_per_player == true)
{
gun_structs = struct::get_array("gun_struct","targetname");
for(i=0;i<level.players.size;i++)
{
thread RewardGun(gun_structs[i].origin+(0,0,40), array::randomize(level.reward_weapons)[0]);
}
}
if(level.one_gun_per_player == true && level.different_guns_per_player == false)
{
rand = RandomIntRange( 0, level.reward_weapons.size );
gun_structs = struct::get_array("gun_struct","targetname");
for(i=0;i<level.players.size;i++)
{
thread RewardGun(gun_structs[i].origin+(0,0,40), level.reward_weapons[rand]);
}
}
}
}
function RewardGun(pos, weapon)
{
gun = spawn("script_model", pos);
playsoundatposition("zmb_spawn_powerup", pos);

gun SetModel(GetWeaponWorldModel(GetWeapon(weapon)));
PlayFX(level._effect["powerup_grabbed_solo"], gun.origin);
trig = spawn("trigger_radius", gun.origin, 0, 20, 50);
gun thread SpinMe();
gun thread GiveMe(weapon, trig);
if(level.gun_expire == true)
gun thread LifeTime(trig);
}
function LifeTime(trig)
{
self endon("death");
wait(120);//wait 2 minutes then delete
if(isdefined(self))
{
self notify("rewardgun_delete");
}
if(isdefined(trig))
{
trig delete();
}
if(isdefined(self))
{
self delete();
}
}
function GiveMe(weapon, trig)
{
self endon("rewardgun_delete");
while(1)
{
trig waittill("trigger", player);
player thread SetGunHint(level.gun_hintstring, trig);
if(player HasWeapon(getweapon("minigun")))
{
continue;
}
if(!(player UseButtonPressed()))
{
continue;
}
if(player laststand::player_is_in_laststand())
{
continue;
}
trig delete();
self delete();
player zm_weapons::weapon_give(getweapon(weapon));
player SwitchToWeapon(getweapon(weapon));
break;
wait(.1);
}
}

function SpinMe()
{
self endon("rewardgun_delete");
self endon("death");
while(isdefined(self))
{
if(isdefined(self))
{
self rotateyaw(360,2);
}
wait(1.9);
}
}
change all the level variables to what you want.
In Radiant, go ahead and make a script_model and give it a targetname of:"easter_egg_object"
draw a trigger around it (trigger_use for press "F" on it, trigger_damage for shooting at it).
Then select the model first, then the trigger and hit "W". It should make an arrow pointing from the model to the trigger.
Repeat these steps for each object you want (the models can be different). make sure each model is only targeting the trig that surrounds it.
 
(Optional) make a trigger_use and give it the targetname:"trig_place". put it where the player has to place the objects. Make the models you want to show up after they place it and give them the targetname: "placed_object".
 
Depending on the rewards you want, do these next steps.

Door

make your door a script_model or script_brushmodel and give it the targetname: "easter_egg_door". IMPORTANT! if you have any other pieces you want to move with the door (including any clips around the door) you must also give it that targetname.
then make a script_struct where you want to go (note that it will be the origin of the door that goes to it). Select the door and select the struct and hit "W". Make sure every entity that has the targetname "easter_egg_door" has a struct it is targeting. It can be the same struct it that makes sense for where the pieces should go.
 
Powerup Drop
make a script_struct and give it the Targetname: "powerup_struct". place it On the ground where you would like the powerup drop to appear above.
 
Gun
make a script_struct on the ground and give it the targetname: "gun_struct". Note that if you have level.one_gun_per_player = "true"; you must have at least 4 of these. It it is false you can only have one.
 
I haven't fully tested this out so if there are any problems please report them. If there something you would like added to this feel free to comment.
Part of the script comes from MakeCents, the part that spawns and spins the gun. If you are using the gun drop, I would highly encourage you to credit MakeCents.
Also feel free to credit me, Abnormal202.
broken avatar :(
×
broken avatar :(
Location: dk
Date Registered: 26 January 2016
Last active: 7 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
wesa0016's Groups
wesa0016's Contact & Social Linkswesam aliraqiwesam //BLACK OPS gamer
it doesn't work. :(

please help ASAP 

 
Loading ...