Entity/Item Facing Activating A Script

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Entity/Item Facing Activating A Script

Post by Xanathar »

Because spawn does not gives an id which begins with the "goromorg_whatever_" but is just a number like 32 or 768 or whatever.

Use the name for the comparison instead of checking how the id starts, which is both more correct and will work :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Entity/Item Facing Activating A Script

Post by Komag »

indeed, the ids of spawned things are just weird and unusable. But you can assign ids in your spawn code if you want, to avoid having to cycle through ALL the entities on the level to find them:

Code: Select all

function goromorgMove1()
  if steel_lever_1:getLeverState(activated) then
     if myStatue1 then myStatue1:destroy() end
     if myStatue2 then myStatue2:destroy() end
     spawn("goromorg_statue_blockage",10,25,13,0,"myStatue1")
     spawn("goromorg_statue_blockage",10,27,13,0,"myStatue2")
     playSound("wall_sliding_lock")
  end
end
Finished Dungeons - complete mods to play
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Entity/Item Facing Activating A Script

Post by Grimfan »

That's just the boost I needed Komag. You and Xanathar are fantastic for taking the time to help out new modders like me. :D

I just feel bad that I cannot return the favor somehow. i just hope I'll be able to bring out my mod before LoG2 comes out.
Post Reply