Spawning an entity

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Faerghail
Posts: 72
Joined: Tue Mar 27, 2012 8:49 pm

Spawning an entity

Post by Faerghail »

Hi ,

What is the correct solution to spawn an entity ? in the exemple i would like to spawn a deamon head on a wall with name "head1"
I know i have to enter the coordonates ,the height, the facing ... what else ?

spawn("daemon_head",14,19,-1,1,"head1")

Thx
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Spawning an entity

Post by NutJob »

Level
Faerghail
Posts: 72
Joined: Tue Mar 27, 2012 8:49 pm

Re: Spawning an entity

Post by Faerghail »

and what is the order plz ?
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Spawning an entity

Post by NutJob »

-1 is wrong also.
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Spawning an entity

Post by Skuggasveinn »

Code: Select all

 spawn("torch", 8, 15, 16, 1, 0,"DazUberTorch")
 spawn("asset", X, Y, Facing, Elevation, "name")
first is the asset you wan't to spawn
8 is the level, in the order that they are listed in your dungeon editor, the top most level being 1 and then going 2,3,4 as they descend down (don't mix this up with coordinates the tell the game how your levels and the minimap interact)
15 is the X
16 is the Y
1 is the facing (from 0 to 3 )
0 is the elevation
and then comes the name (and that's optional if you never need to call this again.)
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Faerghail
Posts: 72
Joined: Tue Mar 27, 2012 8:49 pm

Re: Spawning an entity

Post by Faerghail »

Super ! Thank you very much :D
Hianloun
Posts: 6
Joined: Tue Oct 21, 2014 2:46 pm

Re: Spawning an entity

Post by Hianloun »

Hey guys.

i have a question:). Its pretty the same but i just want to know how to let things "Despawn".

But for the editor Despawn is a nil value :).

Thanks
Faerghail
Posts: 72
Joined: Tue Mar 27, 2012 8:49 pm

Re: Spawning an entity

Post by Faerghail »

Use Destroy(). In my example if i want to destroy my entity i use

head1:destroy()

for a monster , use kill()
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Spawning an entity

Post by petri »

Instead of fiddling with the coordinates, an easier way is to use an existing entity as an anchor, like this:

Code: Select all

pressure_plate_1:spawn("bread")
Works with any entity.

Another trick is to use the script as the anchor:

Code: Select all

self.go:spawn("bread")
Faerghail
Posts: 72
Joined: Tue Mar 27, 2012 8:49 pm

Re: Spawning an entity

Post by Faerghail »

oh that's great , thanks for this trick :P

what "Anchor" can i use for a spawn on a wall ?
Post Reply