lol
on topic
Quote: "Spawn entity when enter trigger zone"
would this not be easier to spawn the entity based on distance from it? like so - run this script on the entity that you want to spawn
function spawn_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX; PlayerDY = g_Entity[e]['y'] - g_PlayerPosY; PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if (PlayerDist < 160) then
Spawn(e)
end
end
if however you wanted to have a seperate script on the entity then you can use it on another entity (placed nearby) and just replace the (e) with the value of the hidden entity.
Quote: "Activate an entities animation by pressing 'E' when the player is within a certain distance from the entity."
this is the door script, no?
which model are you trying to animate?
Quote: " Door initially opened when game starts and SLAMS shut when player gets within X distance. "
done
local run = 0
function animate_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX; PlayerDY = g_Entity[e]['y'] - g_PlayerPosY; PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if run == 0 then
SetAnimation(0);
SetAnimationSpeed(e,1000)
PlayAnimation(e);
run = 1
end
if PlayerDist < 240 and run == 1 then
SetAnimation(1);
SetAnimationSpeed(e,500)
PlayAnimation(e);
run = 2
end
end
Quote: "Move X entity in X direction when player within X distance. "
--how far away the player is before the entity will move
local distance = 200
--angle/direction to move in
local angley = 45
--speed to move entity
local speed = 1
--set entity number or leave 0 to apply to entity running script
local entity = 0
local directionset = 0
function move_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX; PlayerDY = g_Entity[e]['y'] - g_PlayerPosY; PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
--if player enters the vechile
if PlayerDist < distance then
if directionset == 0 then
if entity == 0 then
entity = e
end
RotateY(entity,angley)
directionset = 1
end
MoveForward(entity,speed)
--optional else to allow more turning if player is outside of range
--else
--directionset = 0
end
end
added some comments to the settings so you can see what they do
Quote: "increase overall ambient light to almost blinding level for a VERY short time, while spawning entity, then, when ambient light returns to previous settings, destroy spawned entity. All this would happen from within a trigger zone. "
this one just refused to let the timer code work right so i ended up using a varible instead but it works fine for me (the standard timer doesnt seem to start at zero sometimes - no idea why)
--set to entity number of object you want to spawn
local entity = 1
--set to time delay required (1 is very fast flash)
local timedelay = 1
--set to desired starting ambiance
local startingambi = 80
local ambi = startingambi
local timepassed = 0
timedelay = timedelay * 10
function blinding_main(e)
if g_Entity[e]['plrinzone']==1 then
timepassed = timepassed + 1
if timepassed < timedelay and ambi < 5000 then
ambi = ambi + 500
SetAmbienceIntensity(ambi)
Spawn(entity)
else --time delay reached
if ambi > startingambi then
ambi = ambi - 500
SetAmbienceIntensity(ambi)
else
Destroy(entity)
Destroy(e)
end --end ambi > 100
end --end time delay check
end --end player in zone check
Prompt(ambi .. " " .. timepassed)
end --end func
life's one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11