Get Targetname
Posted: Sun May 09, 2004 4:48 pm
There's any way to get the targetname of an entity that's inside a trigger? I've been digging the g_allcasses, didn't find anything... 
The script is kinda messy coz I messed up yesterday, will clean it up today!main:
level waittill spawn
$allies_trigger setthread routine1
waitthread global/jv_bots/jv_mp_ai.scr::enable 0 0 0 0
end
routine1:
wait .3
if(level.botbusy == 1 && isalive self)
self waitthread bot_waiting
if(level.botbusy == 0 && level.truckbusy == 0 && isalive self)
level.botwait++
self waitthread bot_truckride
end
bot_waiting:
while (level.botbusy == 1 || level.truckbusy == 1)
{
wait 2
}
end
bot_truckride:
local.node = $("faketruck_playerspot_" + level.truckspot)
if(level.truckbusy == 0)
{
if(level.botbusy == 0 && level.truckbusy == 0 && isalive self)
{
level.botbusy = 1
self runto $crouch_position
self waittill movedone
self holster
level.botbusy = 0
level.truckspot--
self exec global/moveto.scr anim/crouch_run.scr local.node // THIS LINE..GR
//self waittill movedone
wait 3
wait .5
self glue local.node
}
}
if(level.truckbusy == 1 || level.botbusy == 1)
self waitthread bot_waiting
end
Yup, that's the concept... now just remember to keep that light onWait, a light just went on! The local.players, or bot, are not using the same thread. They are using different identical threads (ScriptThread objects) that were created by the command "thread".....
Code: Select all
local.mynewestthread = local.mynewthread waitthread launchnewthread
// (...)
end
launchnewthread:
thread testthread
end parm.previousthread
testthread:
while(1)
{
println "wheee the testthread is running! self is " self.classname
// should say ScriptThread
}
end
Code: Select all
test_thread:
iprintln "Your targetname is: " (parm.other.targetname)
local.sucker = parm.other
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
wait 5
thread test_thread2
end
test_thread2:
wait 1
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
end
Code: Select all
test_thread:
iprintln "Your targetname is: " (parm.other.targetname)
local.sucker = parm.other
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
wait 5
local.sucker thread test_thread2
end
test_thread2:
wait 1
iprintln "local.sucker's targetname is now : " (local.sucker.targetname)
end
Code: Select all
test_thread:
iprintln "Your targetname is: " (parm.other.targetname)
local.sucker = parm.other
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
wait 5
thread test_thread2 local.sucker
end
test_thread2 local.sucker:
wait 1
iprintln "local.sucker's targetname is now : " (local.sucker.targetname)
end
Code: Select all
mythread:
local.sucker = waithread test_thread
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
end
test_thread:
iprintln "Your targetname is: " (parm.other.targetname)
local.sucker = parm.other
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
end local.sucker
Code: Select all
test_thread:
iprintln "Your targetname is: " (parm.other.targetname)
local.sucker = parm.other
iprintln "local.sucker's targetname is : " (local.sucker.targetname)
wait 5
thread test_thread2 local.sucker
end
test_thread2 local.sucker:
wait 1
iprintln "local.sucker's targetname is now : " (local.sucker.targetname)
end