LUA alertentity?
Moderators: Forum moderators, developers
LUA alertentity?
Hello,
I'd like to know if there's a command in LUA which can be used as alertentity in mapscripting. Just with team_CTF_red/bluespawn ["kill"/"revive"]. The best would be to define by the respawn's targetname.
Greetings,
Igloo
I'd like to know if there's a command in LUA which can be used as alertentity in mapscripting. Just with team_CTF_red/bluespawn ["kill"/"revive"]. The best would be to define by the respawn's targetname.
Greetings,
Igloo
- =FF=im2good4u
- Posts: 3821
- Joined: Wed Feb 05, 2003 7:30 am
- Location: The Netherlands, HOLLAND
- Contact:
i think its posable maybe u can spawn a trigger_always ?
<a href="http://bunnyherolabs.com/adopt/showpet. ... dQ=="><img src="http://petimage.bunnyherolabs.com/adopt ... Q0dQ==.png" width="80" height="100" border="0"></a>
Re: LUA alertentity?
No. However, you could find the entity and make the equivalent changes in it it's fields.Igloo wrote:Hello,
I'd like to know if there's a command in LUA which can be used as alertentity in mapscripting. Just with team_CTF_red/bluespawn ["kill"/"revive"]. The best would be to define by the respawn's targetname.
Greetings,
Igloo
send lawyers, guns and money
mm, im the one whos interested in it, but i dnt know much about mapscripting, just lua...Reyalp maybe u were talking about such code?:
What about:
can i use it to spawn players random? Hmm, i have to learn more about those spawns and how to use it via lua, but dunno how
Code: Select all
for i = 64, 1021 do
if et.gentity_get(i, "targetname") == "spawn_Axis2" then
do smth like wht? example: et.gentity_set( i, "targetname", arrayindex [dunno example], "newspawn_Axis3")
end
end
Code: Select all
et.G_SetSpawnVar( entnum, key, value )
Sets the spawnvar key to value for entity entnum
wolFTeam.pl
ok, i wrote a lua script to disable/remove spawn:
and no results
Code: Select all
function et_InitGame( levelTime, randomSeed, restart)
for entnum = 64, 1021 do
if et.gentity_get(entnum, "targetname") == "set1_allies_8" then
et.trap_UnlinkEntity( entnum ) -- nothing happens, why? Trying another function:
et.G_FreeEntity( entnum ) -- nothing happens, why?
end
end
end
wolFTeam.pl
You need to find out why it doesn't work. Is the entity being found at all ?
My usual approach to things like this is to spam prints until it's obvious where the problem is. The other thing to do is to look at the corresponding code in the C gamecode. You CANNOT use the lua API effectively unless you do this.
You could also set the entity to disabled rather than removing it. If there are scripts or other entities that refer to that target name, you may run into trouble if you only remove some of them.
My usual approach to things like this is to spam prints until it's obvious where the problem is. The other thing to do is to look at the corresponding code in the C gamecode. You CANNOT use the lua API effectively unless you do this.
You could also set the entity to disabled rather than removing it. If there are scripts or other entities that refer to that target name, you may run into trouble if you only remove some of them.
send lawyers, guns and money
yes, im doing it also to see whats going on, its a pity there is no compilator for this ;p. It found 165 value for entnum without any errors, full code:ReyalP wrote:You need to find out why it doesn't work. Is the entity being found at all ?
My usual approach to things like this is to spam prints until it's obvious where the problem is. The other thing to do is to look at the corresponding code in the C gamecode. You CANNOT use the lua API effectively unless you do this.
You could also set the entity to disabled rather than removing it. If there are scripts or other entities that refer to that target name, you may run into trouble if you only remove some of them.
Code: Select all
--------------------------------------------------------------------------------
-- called at map start
function et_InitGame( levelTime, randomSeed, restart)
--------------------------------------------------------------------------------
for entnum = 64, 1021 do
if et.gentity_get(entnum, "targetname") == "set1_allies_8" then
et.G_LogPrint("for targetname " .. et.gentity_get(entnum, "targetname") .. " entnum: " .. entnum .. " \n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay for targetname ^3" .. et.gentity_get(entnum, "targetname") .. "^7 entnum: ^3" .. entnum .. "\n" )
et.trap_UnlinkEntity( entnum ) -- unlink ent,
et.G_LogPrint("targetname " .. et.gentity_get(entnum, "targetname") .. " entnum: " .. entnum .. " unlinked \n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay targetname ^3" .. et.gentity_get(entnum, "targetname") .. "^7 entnum: ^3" .. entnum .. " ^1unlinked\n" )
et.G_FreeEntity( entnum ) -- no suc with unlink, so try with another funct to disable ent
et.G_LogPrint("targetname " .. et.gentity_get(entnum, "targetname") .. " entnum: " .. entnum .. " is FREE \n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay targetname ^3" .. et.gentity_get(entnum, "targetname") .. "^7 entnum: ^3" .. entnum .. " ^1is FREE\n" )
spawnval = et.G_GetSpawnVar( entnum, "spawnflags" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay spawnval from spawnflags for ^3" .. et.gentity_get(entnum, "targetname") .. "^7 to: ^3" .. spawnval .. "\n" )
et.G_LogPrint("spawnval from spawnflags for ^3" .. et.gentity_get(entnum, "targetname") .. "^7 to: ^3" .. spawnval .. " \n")
end
end
end
btw can i use it:
Code: Select all
et.G_SetSpawnVar( entnum, key, value )
Sets the spawnvar key to value for entity entnum
wolFTeam.pl
- =FF=im2good4u
- Posts: 3821
- Joined: Wed Feb 05, 2003 7:30 am
- Location: The Netherlands, HOLLAND
- Contact:
if u got the code u can look for
trap_UnlinkEntity
G_FreeEntity
those are actualy functions (i dunno if its case sensitive..)
trap_UnlinkEntity
G_FreeEntity
those are actualy functions (i dunno if its case sensitive..)
<a href="http://bunnyherolabs.com/adopt/showpet. ... dQ=="><img src="http://petimage.bunnyherolabs.com/adopt ... Q0dQ==.png" width="80" height="100" border="0"></a>
yes, i tried, look @ code. Im trying everything even with setting new origin or respawning new entnum, but still no result to disable/move/change spawn:=FF=im2good4u wrote:if u got the code u can look for
trap_UnlinkEntity
G_FreeEntity
those are actualy functions (i dunno if its case sensitive..)
Code: Select all
origin = { new_x, new_y, new_z }
oldorigin = et.gentity_get(entnum,"origin")
et.gentity_set(entnum,"origin",origin)
neworigin = et.gentity_get(entnum,"origin")
entnum = et.G_Spawn()
edited:
scriptname and targetname cant be changed:
Code: Select all
error: tried to set read-only gentity field
wolFTeam.pl