Thanks! I haven't done any actual modeling, and wasn't able to figure out much from the toolkit at a quick glance. Much better to be rid of the mesh since it's not needed.djoldgames wrote:I have small tweak-tip for you about invisible door model.
AI Framework
Re: Invisible door model
Re: AI Framework
Has anyone tried to code door opening skills into monster AI? Surely there must be a command already in Grimrock since Goromorg can open doors, but I haven't seen anything like that on the forums yet. Some undead monsters or other monsters with hands or smarts should be able to open them, but I'm too new to this to know if it's worth the effort. So far I've just used the illusion of door-opening with scripted events.
Re: AI Framework
You could have invisible pressure plates that check monster facing, but that's still just a hack
Finished Dungeons - complete mods to play
Re: AI Framework
Hmm, I'm going to try that hack. Sounded simple enough. I'm going to use a code line this for each door on the level (it's a small level). How would that line look? I don't see anyone trying a monster-face check anywhere on the forums.
I tried to guess and used the line:
but of course I get an error (which I don't understand) asking for a "function argument" in the first line of the if statement "near =".
I tried to guess and used the line:
Code: Select all
function openSezMe1()
if monster.id:facing = 3 then
temple_door_metal_3:open()
end
end
Re: AI Framework
The correct syntax is "if monster.id:facing == 3" (with the double '='), or otherwise lua thinks you are assigning the value 3 to something!Eightball wrote:Hmm, I'm going to try that hack. Sounded simple enough. I'm going to use a code line this for each door on the level (it's a small level). How would that line look? I don't see anyone trying a monster-face check anywhere on the forums.
I tried to guess and used the line:
but of course I get an error (which I don't understand) asking for a "function argument" in the first line of the if statement "near =".Code: Select all
function openSezMe1() if monster.id:facing = 3 then temple_door_metal_3:open() end end
alois
Re: AI Framework
Thanks again! I've been wondering what the difference was between = and ==.
What is ~=? Would that be "is not equal to"?
I tried the script with the double = but it still says it expects "function arguments" near the "==".
What is ~=? Would that be "is not equal to"?
I tried the script with the double = but it still says it expects "function arguments" near the "==".
Re: AI Framework
Ah, sorry: once you have a monster, monster.id gives its id, monster.facing gives the direction it is facing and so on... so the line should be "if (monster.facing == 3) then ..."Eightball wrote:Thanks again! I've been wondering what the difference was between = and ==.
What is ~=? Would that be "is not equal to"?
I tried the script with the double = but it still says it expects "function arguments" near the "==".
Note that - however - 'monster' seems undefined in your script: maybe the function is "openSezMe1(monster)"?
alois
Re: AI Framework
Oh I see. I was hoping that any monster stepping on a hidden pressure plate with the proper facing would open the door. But I guess I may have to assign a script to each monster in the vicinity. I may want to rethink this. Is there a way for the pressure plate activation to check the id of the monster activating it? Then I could just keep it general so that any monster's id could be taken. Maybe this is just beyond me at this point.
Re: AI Framework
I'd say: you put a hidden pressure plate only activated by monsters; then, as the plate activates, you trigger a script which checks for entities at the location of the plate; then, if the class of one of the entities is 'Monster', you check its facing:Eightball wrote:Oh I see. I was hoping that any monster stepping on a hidden pressure plate with the proper facing would open the door. But I guess I may have to assign a script to each monster in the vicinity. I may want to rethink this. Is there a way for the pressure plate activation to check the id of the monster activating it? Then I could just keep it general so that any monster's id could be taken. Maybe this is just beyond me at this point.
Code: Select all
function steppedOn(self)
local facing = tonumber(string.sub(self.id,string.len(self.id))) -- replace with 0,1,2,3 if 'single shot'
for ent in entitiesAt(self.level,self.x,self.y) do -- "self" refers to the triggerer of the script; i.e., the pressure plate
if (ent.class == "Monster") then
if (ent.facing == facing) then
door_whatever:open()
end
end
end
alois
-
- Posts: 119
- Joined: Sun Jan 05, 2014 7:48 pm
Re: AI Framework
It might even be preferable to use the above script without checking the monster's facing (remember that the script to open the door is only triggered when the monster steps onto the plate, and not when it turns to face in the right direction after having already walked onto the plate, which it likely won't do unless it can see your party on the other side of the door). Since the monster might not be facing the door when it steps onto the plate (perhaps because of the direction it had been following to chase your party or because it can't see your party on the other side) the door would not open for it. Alois' script above is pretty nice though and might help for controlled situations; in other cases you will likely need to modify it by removing the facing check condition (which would be realistic for automated doors anyways, even if not for monsters opening doors). Just some thoughts to consider...
Working on a dungeon that displays a massive collection of assets while sorting them into convenient reusable plugin format (concept from some of leki's mods). Will contribute some of my own models as well eventually and follow that with custom dungeon.