Hello everybody
At first: Thank you to smallg and all the other scripting gods in this forum - since I discovered game guru, last year I have learned so much about scripting through your scripts
I had an idea for a simple script: I love the house building part in games like Skyrim and I want to to similiar things in Game Guru
I have two scripts, the first one is called housebuilder_house.lua (it should be attached to an always active, non-static entity like a barrel):
g_Playerhouse = 0
function housebuilder_house_init(e)
end
function housebuilder_house_main(e)
Hide(e)
CollisionOff(e)
if g_Playerhouse == 1 then
Spawn(3) --entity number of your house
Prompt("You have built a house");
end
end
the second one is called housebuilder_coin.lua (because my test item is a collectable coin)
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Collects Coin
function housebuilder_coin_init(e)
end
function housebuilder_coin_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 < 60 then
PlaySound(e,0);
Collected(e)
g_Playerhouse = g_Playerhouse + 1
Destroy(e);
Prompt("You have picked up a House Coin");
end
end
it works well, but there is only one problem - when I spawn the house, there is no collision (an that is a problem for the effect, I want in my game)...could anyone give me a hint to solve this little problem?
I´m sorry for my bad English - I´m not a native speaker
greetings from Germany
The author of this post has marked a post as an answer.
Go to answer