Page 1 of 1
spawning players
Posted: Tue Jun 09, 2009 8:15 am
by crazyfrag
is it possible to spawn players outside of theire spawntime via lua?
cause setting hp will bug the players...
and reviving is not possible by server...
et.GSpawn ?
2nd..
is it possible to detect who did dmg with what wapon on a person ( exactly iw ant to detect falling dmg)
and 3rd:
can i godmode someone for a defined numer of time without activating the cheat
et.gentity_set(clientNum, "ps.powerups", 1, time ) seems not to work
ty guys
Re: spawning players
Posted: Mon Jun 15, 2009 10:41 pm
by crazyfrag
crazyfrag wrote:
is it possible to spawn players outside of theire spawntime via lua?
cause setting hp will bug the players...
and reviving is not possible by server...
et.GSpawn ?
hmn... any clues?
someone has a code how to revive dead persons?
crazyfrag wrote:
2nd..
is it possible to detect who did dmg with what wapon on a person ( exactly i want to detect falling dmg)
no need anymore
crazyfrag wrote:
can i godmode someone for a defined numer of time without activating the cheat
et.gentity_set(clientNum, "ps.powerups", 1, time ) seems not to work
ok that works for me!
Posted: Tue Jun 16, 2009 12:04 pm
by McSteve
Sort of relevant thread.
Sorry I couldn't be more help, I only touched on it and didn't persist in a solution.
Re: spawning players
Posted: Wed Jun 17, 2009 10:15 am
by crazyfrag
crazyfrag wrote:
2nd..
is it possible to detect who did dmg with what wapon on a person ( exactly iw ant to detect falling dmg)
ok did it
Posted: Sat Jun 20, 2009 6:55 pm
by gotenks
i'm actually curious on that one too... haven't looked yet, but just so I have a place to look, how did you do it.
Posted: Sun Jun 21, 2009 2:52 am
by crazyfrag
gotenks wrote:i'm actually curious on that one too... haven't looked yet, but just so I have a place to look, how did you do it.
maybe its not that what u want...
i do this but its a bit a mess but for what i want it works
Code: Select all
function et_RunFrame( levelTime )
for j = 0, (mclients - 1) do
attacker = et.gentity_get(j, "ps.persistant", 5)
if j ~= attacker then -- the persistant return starts @ 0 if u have slot 0 theres a prob
if (attacker >= 0) and (attacker < 64) then -- falling dmg has 1022
if et.gentity_get(attacker,"inuse") then
after that u can look up what weapon attacker is atteched to
Posted: Mon Jul 13, 2009 2:59 pm
by Luk4ward
You can spawn at default spawns and move a player after respawn to whatver u want location. This is tricky but works.
Posted: Thu Jul 16, 2009 3:10 am
by crazyfrag
Luk4ward wrote:You can spawn at default spawns and move a player after respawn to whatver u want location. This is tricky but works.
u`re using et.gspawn ?
u have a code for this?
i checked etsource and tryied to rebuild reviveentity(ent, ent) but its not working imo...
Posted: Wed Jul 29, 2009 10:09 am
by Luk4ward
try this:
Code: Select all
tname = "set1_allies_8" -- targetname of spawn
et_respawn() -- pseudo code
{
setspwn (3, tname)
}
function setspwn (point, name)
for entnum = 64, 1021 do
if et.gentity_get(entnum, "targetname") == name then
oldspawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
newspawnval = point
et.G_SetSpawnVar( entnum, "spawnflags", newspawnval )
spawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
end
end
end
after all i was using this code to move the obj with specified ent num to new origin place (norigin is the array of x,y,z):
Code: Select all
function entgoto (ent_num, norigin)
local origin = et.gentity_get(ent_num,"origin") --a vec3 value
et.gentity_set( ent_num, "origin", norigin )
end
There is somewhere here mine topic about this problem
, check TJ mods for more code.
Posted: Thu Jul 30, 2009 7:05 am
by crazyfrag
Luk4ward wrote:try this:
Code: Select all
tname = "set1_allies_8" -- targetname of spawn
et_respawn() -- pseudo code
{
setspwn (3, tname)
}
function setspwn (point, name)
for entnum = 64, 1021 do
if et.gentity_get(entnum, "targetname") == name then
oldspawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
newspawnval = point
et.G_SetSpawnVar( entnum, "spawnflags", newspawnval )
spawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
end
end
end
u spawn players with this out of spawntime? am i right...
im not that lua expert i tried this and its not working.. maybe i understood something wrong? ty 4 ur great help <3
Code: Select all
function et_InitGame(levelTime,randomSeed,restart)
maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) --gets the maxclients
end
function et_RunFrame( levelTime )
for cno =0 , maxclients - 1 do
if et.gentity_get(cno, "health") <= 0 then
tname = "alliedspawn" -- targetname of spawn
setspwn(3 , tname)
end
end
end
function setspwn (point, name)
for entnum = 64, 1021 do
if et.gentity_get(entnum, "targetname") == name then
oldspawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
newspawnval = point
et.G_SetSpawnVar( entnum, "spawnflags", newspawnval )
spawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
end
end
end
Posted: Fri Aug 07, 2009 4:46 pm
by Luk4ward
You have to know some mapscripting in order to get targetnames of spawns. Did You debug this function for example:
if et.gentity_get(entnum, "targetname") == name then
print("found entnum ["..entnum.."]" for targetname)
smth like this? Try setspwn (0, tname), 1.2.3.4.5. It was working for me, but i got good mapper :p