Product Chat / Entity Number

Author
Message
Big Dog Game Studios
12
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 3rd Mar 2015 03:32
How do you find the entity number of an item once it has been placed?
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 3rd Mar 2015 03:42
Just hover your mouse over the entity and when it's highlighted with the reddish aura down at the bottom of the editor it will tell you
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
GoDevils
10
Years of Service
User Offline
Joined: 24th Sep 2014
Location: Arizona USA
Posted: 3rd Mar 2015 18:45
This is something I was just thinking about.

I'll try Jerry's way to get the value of "e" for a particular entity. I'm also going to try a script for the entity and see if I can prompt the value when the gay is running.

That said, once I know that number, can I use it in a script for a different entity? In other words, could I have the script of one entity send commands to the engine for a different entity? I'm going to play with this, just wondering if anyone has tried it?

Go Devils
"There is no spoon"
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 3rd Mar 2015 20:14
Quote: "once I know that number, can I use it in a script for a different entity?"



I haven't tried it, but I don't see why not.
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 3rd Mar 2015 20:49
Yes but there are two numbers there. use the first one for scripting. the second is for the lightmap process I believe, But will check on that.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Mar 2015 21:52 Edited at: 3rd Mar 2015 22:07
Yes, you can work with the id of an entity, I've tried it with success in the first competition.
All credits go to smallg, I just limited myself to change some things for suit my needs.


-- Allows the player to pick-up the item (teapot - 194), carry it and then drop - floor grate - 259
-- Note - entity with this script must have Physics > No & Static Mode > No

local i_state = {}
local itemdist = 100
local yangle = 0
local tCheckTime = {}

function carryteapot_init(e)
i_state[e] = "start"
end

function carryteapot_main(e)

if i_state[e] == "start" then
tCheckTime[e] = GetTimer(e)
i_state[e] = "initial"
end

--Prompt (g_Entity[220]['x'],g_Entity[220]['y'],g_Entity[220]['z'],g_Entity[e]['x'],g_Entity[e]['y'],g_Entity[e]['z'] )

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^2)+math.abs(PlayerDY^2)+math.abs(PlayerDZ^2));

if PlayerDist < 100 then
if i_state[e] == "initial" and GetTimer(e) > tCheckTime[e] + 500 then
Prompt ("Press E To Pick Up teapot. You need to find a right side, to place this")
if g_KeyPressE == 1 then
GravityOff(e)
CollisionOff(e)
Show (e)
yangle=g_PlayerAngY
i_state[e] = "carried"
PlaySound(e,0)
ActivateIfUsed(e)
tCheckTime[e] = GetTimer(e)
end
end
end -- end if player dist

if i_state[e] == "carried" then
--calculate and then hold the item 'itemdist' in front of player
itemx=g_PlayerPosX
itemz=g_PlayerPosZ
itemy=g_PlayerPosY
itemx = itemx+math.sin(math.rad(g_PlayerAngY))*itemdist
itemz = itemz+math.cos(math.rad(g_PlayerAngY))*itemdist
itemy = itemy-math.sin(math.rad(g_PlayerAngX))*itemdist
-- hide if view angle drops underground or too high - adjust as needed

if g_PlayerAngX > -50 and g_PlayerAngX < 25 then
Show(e)
else
Hide(e)
end

SetPosition(e,itemx,itemy-15,itemz)

-- mirror precisely the player Y angle for the items rotation to player
yangle = g_PlayerAngY

if g_PlayerAngY >= 360 then
yangle = g_PlayerAngY - (360 * (math.floor(g_PlayerAngY / 360)))
elseif g_PlayerAngY < 0 and g_PlayerAngY > -360 then
yangle = g_PlayerAngY + 360
elseif g_PlayerAngY 360 then
FaceAngle = FaceAngle - 360
end

--adjust the '-20' to tilt the item further away/towards the player whilst being carried (set to 0 for flat)
SetRotation(e,(g_PlayerAngX-10 * -1),FaceAngle,0)
--SetRotation(e,0,FaceAngle,0)

--check if player wants to drop item and if so drop
Prompt ("Press E To Drop teapot, if does not, is because this is not the right side, to place it")

if g_KeyPressE == 1 and GetTimer(e) > tCheckTime[e] + 500 then
SetRotation(e,0,FaceAngle,0)
GravityOn(e)
CollisionOn(e)
floorgratex = g_Entity[199]['x']
floorgratey = g_Entity[199]['y']
floorgratez = g_Entity[199]['z']
if floorgratex
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 3rd Mar 2015 22:06
Nice example 3 com. Thanks, Something I need to learn more of myself. Check out the script board section. Plenty of great advice there, and example scripts.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Mar 2015 22:12
Mike it is something odd here.
1- I can no see all my post. Or
2- I can no edit my post right.

Now, I can see till it says: if floorgratex , but this not the complete post, I've tried to edit it twice with the same results, looks like lua code tags does not work properly.
Please can you see the complete post, or you see the same like me?

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 3rd Mar 2015 23:31 Edited at: 6th Mar 2015 07:24
Yes I had a little lag going on. Steam servers crashed yesterday also I see in the log, and Our servers got hit hard. But Our IT guy is great at fixing it. So might be a rebooting server you see. and you were just there at the wrong time, lets say.

But if it keeps happening, please report again.

Thanks
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 5th Mar 2015 22:11
This is what I see right now.



3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 6th Mar 2015 00:09
Quote: "Please can you see the complete post, or you see the same like me?"



I see the whole post, script and all. Perhaps they fixed it, I've been gone all day!!
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM

Login to post a reply

Server time is: 2024-11-23 03:40:31
Your offset time is: 2024-11-23 03:40:31