Jump to content
darklesson

[Request] Countdown 20s auto revive in town

Recommended Posts

this can be done in map_copy_run_garner2 invoking -> DealAllActivePlayerInMap() ->

IsDeadTable = IsDeadTable or {}

DealAllActivePlayerInMap(map_copy, function(role)
if IsChaLiving(role) ~= 1 then -- check if player is dead
    IsDeadTable[role] = IsDeadTable[role] or 20; -- 20 seconds to respawn
    if IsDeadTable[role] >= 0 then
        IsDeadTable[role] = IsDeadTable[role] - 1
    else
        MoveCity(role, "")
        IsDeadTable[role] = nil
    end
end)

just pseudo-codes... so dont take it for it is...


kong.png

a2.png

Share this post


Link to post
Share on other sites

In response to @KONG, maybe try this.

 

I've never used this function before, so I don't know how it works. If it works just like that by placing map copy and function name, then use it and then the following function.

DealAllPlayerInMap(map_copy, "AutoMapRevive")

If it does work, you can use it and then just place this function:

function AutoMapRevive(Player)
	local MapReviveTimer = 20
	if MapRevive == nil then
		MapRevive = {}
	end
	if MapRevive[GetRoleID(Player)] == nil or IsChaLiving(Player) == 1 then
		MapRevive[GetRoleID(Player)] = MapReviveTimer
	end
	if IsChaLiving(Player) ~= 1 then
		if MapRevive[GetRoleID(Player)] == 0 then
			MoveCity(Player, "")
			MapRevive[GetRoleID(Player)] = MapReviveTimer
		else
			SystemNotice(Player, "You're being revived in "..MapRevive[GetRoleID(Player)].." second(s).")
			MapRevive[GetRoleID(Player)] = MapRevive[GetRoleID(Player)] - 1
		end
	end
end

If you don't get how to first function works, then try the following method by placing it inside the "map_copy_run_" function of your map.

	local Alive = GetMapActivePlayer(MapCopy)
	BeginGetMapCopyPlayerCha(MapCopy)
	for a = 0, (Alive - 1), 1 do
		local Player = GetMapCopyNextPlayerCha(MapCopy)
		if (Player ~= 0 or Player ~= nil) then
			AutoMapRevive(Player)
		end
	end

 

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...