Author Topic: Event: ToggleFriendlyFire  (Read 1418 times)

so to be used in conjunction with Greek2me's slayer

To do this, I'd use it with Zone events

OnPlayerEnterZone>Player>ToggleFriendlyFire

something like that

i'm trying to make a PvP zone in an RPG

Id use Immortal playertype and stuff for outside of the PvP zone, but there are bots outside of the PvP zone that harm the player

I have friendly fire disabled as the players are all on the same team and they're only supposed to kill bots, except when inside of the PvP zone they're supposed to fight

If the player were invincible bots would be useless
« Last Edit: March 25, 2016, 09:48:39 PM by Idur »

Just for clarification, this should be applied to the player, not the minigame.


Since you're using Slayer this can done using Slayer's gamemode API for coding (Yes, for this to work it has to be scripted), it has a GamemodeName::MinigameCanDamage function for the specific gamemode.
In this function we can see if whatever is in PvP with another player that's in PvP, if true they both can kill each other. (The event is the easiest part to script)

would bots still be able to harm players with this in effect?

would this only effect the players in the PvP zone or the entire game?

would bots still be able to harm players with this in effect?
If they were normally able to harm players, they should still be able to.
would this only effect the players in the PvP zone or the entire game?
You'd use the event to set the pvp flag on each player. So if you build a 'PvP zone' with the event you've specified in the OP, it would work.
Just don't forget to make it so when they leave the zone, friendly fire is turned off. If you're using multiple zones for turning it on, you may want to instead have surrounding zones that turn it off, instead of onplayerleavezone.

GamemodeName::MinigameCanDamage function for the specific gamemode.
In this function we can see if whatever is in PvP with another player that's in PvP, if true they both can kill each other. (The event is the easiest part to script)

where would I input this script?

I'm not quite sure if using that callback is a good idea. The function would need to be cloned for each and every slayer gamemode. Another problem is that the check for friendly fire just goes by teams, and the check function for that does not include the players or clients at all.

Edit: I think I might have a way to do this, but would like some help testing. If you're around at all, join nuLily's almost nothing
« Last Edit: March 26, 2016, 12:05:17 PM by Shift Kitty »

Alright, got it working. I hope.

-snip-

Wait I totally forgot to check if the players can actually hurt each other normally...

Edit: And they can't. If any have friendly fire forced off, they can't even hurt people on other teams.

Edit #2: And no one is here to test.
« Last Edit: March 26, 2016, 02:28:28 PM by Shift Kitty »

Im here. Are you still hosting?


http://leopard.hosting/download.php?f=lfmwa&name=Event_SetFriendlyFire.zip
One output event for player. SetFriendlyFire > <list>
<list> contains Default, ForceOff, ForceON
ForceOn vs ForceOn: Friendly fire happens.
ForceOff vs Any: Friendly fire does not happen.
Any vs ForceOff: Friendly fire does not happen.
Else: Use slayer settings.
« Last Edit: July 11, 2016, 01:44:27 PM by Shift Kitty »