Help- Adding OnDraw hooks to party object

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
LocalFire
Posts: 261
Joined: Thu Feb 21, 2013 1:16 am
Location: Auckland, New Zealand

Help- Adding OnDraw hooks to party object

Post by LocalFire »

So I just played ORRR2 and I loved it, particularly the notebook in this case since I decided that my mod needs it (It has allot of scrolls) so I tried to add it and now theres a probelm with my init.lua that stops me from openning the editor, namely "} expected to close line blah (it's the last line), Can someone look at this and tell me what I'm doing wrong cause I suck at code

Code: Select all

cloneObject {
	name == "party",
	baseObject = "party",
	

onDamage = function (self, item)
        DefendScript.ItemChecker (self, item)
        RevengeScript.ItemChecker (self, item)
        WindyScript.ItemChecker (self, item)
 end,

onAttack = function(champion, weapon)
      return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill) 
         
end,


onDrawGui = function(ctx)
		mdConversationList.onDraw(ctx)

	if ( nb_main_script ~= nil and nb_main_script.onDrawGui ~= nil ) then
		nb_main_script:onDrawGui(g);
	end,
	
	
	 onMove = function(party, direction)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	
onTurn = function(party, direction)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	

	 onRest = function(party)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	
 }
It should be noted that all the hooks not relating to the notebook work fine, its just the new ones that seem to messing things up. I'm also using the journal in this mod so its using the onDraw hook too.
My Dungeons
Paths of the Earth: viewtopic.php?f=14&t=5136
Beneath the Sands: viewtopic.php?f=14&t=5216
Videos: viewtopic.php?f=11&t=5443
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Help- Adding OnDraw hooks to party object

Post by Dr.Disaster »

Seems you missed the required "end" line to close the "if" statements inside the hook definitions. try this:

Code: Select all

cloneObject {
	name == "party",
	baseObject = "party",

onDamage = function (self, item)
        DefendScript.ItemChecker (self, item)
        RevengeScript.ItemChecker (self, item)
        WindyScript.ItemChecker (self, item)
end,

onAttack = function(champion, weapon)
        return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill) 
end,

onDrawGui = function(ctx)
	mdConversationList.onDraw(ctx)
	if ( nb_main_script ~= nil and nb_main_script.onDrawGui ~= nil ) then
		nb_main_script:onDrawGui(g);
	end
end,	
	
onMove = function(party, direction)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,
	
onTurn = function(party, direction)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,	

onRest = function(party)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,
}
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Help- Adding OnDraw hooks to party object

Post by JKos »

Could the problem be this line?

nb_main_script:onDrawGui(g);

There is no variable named g, so change it to:

nb_main_script:onDrawGui(ctx);
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
LocalFire
Posts: 261
Joined: Thu Feb 21, 2013 1:16 am
Location: Auckland, New Zealand

Re: Help- Adding OnDraw hooks to party object

Post by LocalFire »

Thanks for both, it seems to a be a combination of these and its working now
My Dungeons
Paths of the Earth: viewtopic.php?f=14&t=5136
Beneath the Sands: viewtopic.php?f=14&t=5216
Videos: viewtopic.php?f=11&t=5443
Post Reply