Jump to content

(Newb) LUA not Triggering


demeggy

Recommended Posts

Afternoon all,

 

Full disclosure; I feel like an absolute wally for not being able to crack this, I've got plenty of experience with LUA and the likes to have gotten the scripting working on other games and platforms - but for the life of me, my very basic opening script just won't trigger on the GameStart Event.

 

Could someone very kindly point out what a mere simpleton like myself is doing wrong?

 

Saving the .lua to Mod Dir:

 

C:\Users\Demeggy\Zomboid\mods\practise01a\media\lua\addItem.lua

local function addItems()local player = getSpecificPlayer(0);    -- Java: get player onelocal inv = player:getInventory();   -- Java: access player inv-- Java: add the actual items to the inventoryinv:AddItem("Base.Screwdriver");player:Say("Look at my shiny Screwdriver!");endEvents.OnGameStart.Add(addItems);

Many, many thanks from a frustrated individual.

 

D

 

Edit:

 

Worth me also noting that the Mod is being picked up by the ModLoader, and is enabled! :)

Link to comment
Share on other sites

Hey, do you have a mod.info and all the other stuff needed? Did you activate the mod in the mod manager?

 

Cheers for the prompt reply; sure do.

name=Test 01aposter=poster.pngid=dmgTestdescription=Dmg Testing Mod 1aurl=http://theindiestone.com/forums/index.php/topic/2011-how-to-use-the-upcoming-modloader/

I did base my mod structure off the 'example' structure provided, perhaps something in there is conflicting? I've deleted all the .LUA scripts in there and added my own as in the above post. Have a horrible feeling it's going to be something embarassingly simple!

(Also fwiw, I've spent the morning following a LOT of your tutorials, some cracking stuff there - it's much appreciated!)

Link to comment
Share on other sites

I appear to have resolved this; I ran PZ with the debugger enabled and inserted the code directly, so I know that was fine.

I was then looking at some other example scripts, and they were placed inside a 'LUA\Client\' folder. Having done this, it seems to now work correctly - my apologies for wasting everyone's time if this is the case :)

 

(I've tried marking the post as 'Answered', but I'm not quite sure how - it's not my day today is it?)

 

I'll post my first mod up when I've gotten it working :)

 

Thanks for the help Robo.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...