Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: maxman5050
How would i implement something that the player would need to go into a certain zone. Like on moon with the PES, if you go outside without it you die
ModmeBot:
Reply By: modric
Using a trig multiple scripted to apply damage to players in that trig would be a good start
ModmeBot:
Reply By: KillJoyYT
I can give some assistance but you have to be a lot more specific about what you're trying to accomplish
ModmeBot:
Reply By: maxman5050
KillJoyYT
I can give some assistance but you have to be a lot more specific about what you're trying to accomplish
ModmeBot:
Reply By: tom5300
maxman5050
KillJoyYT I can give some assistance but you have to be a lot more specific about what you're trying to accomplish So if i wanted to make an area that has poisonous gas, so I'd add trigger_hurts to that area, how can i make it that if you are in possession of something like a gas mask, the triggers don't affect you.
ModmeBot:
Reply By: maxman5050
tom5300
maxman5050 KillJoyYT I can give some assistance but you have to be a lot more specific about what you're trying to accomplish So if i wanted to make an area that has poisonous gas, so I'd add trigger_hurts to that area, how can i make it that if you are in possession of something like a gas mask, the triggers don't affect you. I would use a trig multiple, covering the said area. Maybe try something like the following: function gas_mask_init() { players = GetPlayers(); foreach(player in players) { player.hasGasMask = false; //default players start without mask. when picked up, field is changed to true player thread hurt_players_in_bad_area(); player thread gas_mask_pickup(); } } function hurt_players_in_bad_area() { level endon("end_game"); damage_trigger = GetEnt("hurt_player_trig_targetname_from_radiant", "targetname"); //trigger mult where you want players to be hurt while(!self.hasGasMask) //loop ends when player picks up gas mask { if(self isTouching(damage_trigger)) { self DoDamage(10, self.origin); //deals 10 damage to player every second when they are touching the trigger wait(1); } else { wait(0.1); } } } function gas_mask_pickup() { level endon("end_game"); gas_mask_trig = GetEnt("gas_mask_trig_from_radiant", "targetname"); //trigger at location to pickup a gas mask while(!self.hasGasMask) { gas_mask_trig waittill("trigger", player); if(player != self) { wait(0.1); continue; } self.hasGasMask = true; } } Not sure if the above code works... or is the most efficient lol. Be sure to insert your own kvp's :p
ModmeBot:
Reply By: tom5300
maxman5050
tom5300 maxman5050 KillJoyYT I can give some assistance but you have to be a lot more specific about what you're trying to accomplish So if i wanted to make an area that has poisonous gas, so I'd add trigger_hurts to that area, how can i make it that if you are in possession of something like a gas mask, the triggers don't affect you. I would use a trig multiple, covering the said area. Maybe try something like the following: function gas_mask_init() { players = GetPlayers(); foreach(player in players) { player.hasGasMask = false; //default players start without mask. when picked up, field is changed to true player thread hurt_players_in_bad_area(); player thread gas_mask_pickup(); } } function hurt_players_in_bad_area() { level endon("end_game"); damage_trigger = GetEnt("hurt_player_trig_targetname_from_radiant", "targetname"); //trigger mult where you want players to be hurt while(!self.hasGasMask) //loop ends when player picks up gas mask { if(self isTouching(damage_trigger)) { self DoDamage(10, self.origin); //deals 10 damage to player every second when they are touching the trigger wait(1); } else { wait(0.1); } } } function gas_mask_pickup() { level endon("end_game"); gas_mask_trig = GetEnt("gas_mask_trig_from_radiant", "targetname"); //trigger at location to pickup a gas mask while(!self.hasGasMask) { gas_mask_trig waittill("trigger", player); if(player != self) { wait(0.1); continue; } self.hasGasMask = true; } } Not sure if the above code works... or is the most efficient lol. Be sure to insert your own kvp's :p When i go over the trigger it says, "not available"
ModmeBot:
Reply By: maxman5050
does there have to be a thread in the main function?
ModmeBot:
Reply By: KillJoyYT
yeah under your usermap main put
haven't had time to test will take a look later tonight
ModmeBot:
Reply By: KillJoyYT
changed a couple things and added a few notes
ModmeBot:
Reply By: mathfag
I changed a few things up from toms post because much of it wont work (walkthrough below).
Didn't test this though so no promises.
<hr><hr><hr>
Walkthrough toms mistakes (not trying to discourage or anything, just doing it so you learn a bit)
this wont work for anyone who joins later.
using callback::on_connect(&function);
runs function every time a player connects
What if there are multiple triggers and what if you lose your mask?
Check my code for checking multiple triggers
Not wrong but kind of pointless:
why if(player != self)
if there are 4 players in the game then there will be 4 functions threaded anyway
ModmeBot:
Reply By: tom5300
Technically my mistakes, I posted that code.
But yeah, I just threw together a bit of code to get the op started. Thanks for fixing it!
ModmeBot:
Reply By: KillJoyYT
thank you :-)