spawning players

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

spawning players

Post 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
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

Re: spawning players

Post 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!
McSteve
Posts: 113
Joined: Tue Sep 12, 2006 7:41 am

Post 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.
GhosT:McSteve
Ghostworks Gaming Community
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

Re: spawning players

Post 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
User avatar
gotenks
Posts: 3465
Joined: Fri Nov 15, 2002 4:12 pm
Location: out of my mind
Contact:

Post 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.
My Website
Image
After a night of binge drinking:
=FF=im2good4u wrote:WTF wanst i on top ?
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

Post 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 &#40;attacker >= 0&#41; and &#40;attacker < 64&#41; then    -- falling dmg has 1022
	   if et.gentity_get&#40;attacker,"inuse"&#41; then


after that u can look up what weapon attacker is atteched to
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post by Luk4ward »

You can spawn at default spawns and move a player after respawn to whatver u want location. This is tricky but works.
wolFTeam.pl
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

Post 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...
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post by Luk4ward »

try this:

Code: Select all

tname = "set1_allies_8"	-- targetname of spawn

et_respawn&#40;&#41; -- pseudo code
&#123;
setspwn &#40;3, tname&#41;
&#125;

function setspwn &#40;point, name&#41;

for entnum = 64, 1021 do
    
        if et.gentity_get&#40;entnum, "targetname"&#41; == name then		
           oldspawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
           newspawnval = point
           et.G_SetSpawnVar&#40; entnum, "spawnflags", newspawnval &#41;      
           spawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
       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 &#40;ent_num, norigin&#41;

   local origin = et.gentity_get&#40;ent_num,"origin"&#41; --a vec3 value
   et.gentity_set&#40; ent_num, "origin", norigin &#41;
   
end
There is somewhere here mine topic about this problem ;), check TJ mods for more code.
wolFTeam.pl
crazyfrag
Posts: 105
Joined: Fri Oct 01, 2004 1:17 pm

Post by crazyfrag »

Luk4ward wrote:try this:

Code: Select all

tname = "set1_allies_8"	-- targetname of spawn

et_respawn&#40;&#41; -- pseudo code
&#123;
setspwn &#40;3, tname&#41;
&#125;

function setspwn &#40;point, name&#41;

for entnum = 64, 1021 do
    
        if et.gentity_get&#40;entnum, "targetname"&#41; == name then		
           oldspawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
           newspawnval = point
           et.G_SetSpawnVar&#40; entnum, "spawnflags", newspawnval &#41;      
           spawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
       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&#40;levelTime,randomSeed,restart&#41;
   maxclients = tonumber&#40; et.trap_Cvar_Get&#40; "sv_maxClients" &#41; &#41;   --gets the maxclients
 end  

function et_RunFrame&#40; levelTime &#41;
	for cno =0 , maxclients - 1 do
	if et.gentity_get&#40;cno, "health"&#41; <= 0 then
	 tname = "alliedspawn"   -- targetname of spawn
	setspwn&#40;3 , tname&#41;
end
end
end


function setspwn &#40;point, name&#41;

for entnum = 64, 1021 do
   
        if et.gentity_get&#40;entnum, "targetname"&#41; == name then      
           oldspawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
           newspawnval = point
           et.G_SetSpawnVar&#40; entnum, "spawnflags", newspawnval &#41;     
           spawnval = et.G_GetSpawnVar&#40; entnum, "spawnflags" &#41;
       end
    end
 
end

  
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post 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
wolFTeam.pl
Post Reply