UI_create_new_egg
![[Exult]](images/exultsm.png)
object UI_create_new_egg(int type, int pos[], int criteria, int probability, int distance, int flags, int data[])
Creates an egg object at the specified location. Eggs are invisible trigger objects that activate under certain conditions.
Parameters
| Parameter / value | Description |
|---|---|
type |
The egg type (1-11). This also determines the egg's shape and frame: 1=monster, 2=jukebox, 3=soundsfx, 4=voice, 5=usecode, 6=missile, 7=teleport, 8=weather, 9=path, 10=button, 11=intermap |
pos |
The location where the egg is to be placed (same format as UI_create_new_object2). |
criteria |
Activation criteria (0-7): 0=cached_in, 1=party_near, 2=avatar_near, 3=avatar_far, 4=avatar_footpad, 5=party_footpad, 6=something_on, 7=external_criteria |
probability |
Probability of activation (1-100). |
distance |
Activation distance (0-31). |
flags |
Egg flags as a bitmask. Bit 0: nocturnal (only activates at night), Bit 1: once (only activates once), Bit 2: hatched (egg has already been triggered), Bit 3: auto_reset (can trigger again after hatching) |
data |
An array of type-specific data (see below). A single value can also be passed for types that only need one element. |
Return
An object reference to the newly created egg. The egg is placed in the game world at the specified location.
Notes
The data array elements are user-friendly and encoded internally. Their meaning depends on the egg type:
| Parameter / value | Description |
|---|---|
| Monster (1): [shape, frame, count, schedule, alignment] | data[0] = monster shape number, data[1] = monster frame number, data[2] = spawn count, data[3] = schedule type (0=combat, 1=horiz_pace, 2=vert_pace, etc.), data[4] = alignment (0=neutral, 1=good, 2=evil, 3=chaotic) |
| Jukebox (2): [song, continuous] | data[0] = music track number, data[1] = continuous (0=play once, 1=loop) |
| Soundsfx (3): [sfx_num, continuous] | data[0] = sound effect number, data[1] = continuous (0=play once, 1=loop) |
| Voice (4): [speech_num] | data[0] = speech number |
| Usecode (5): [usecode_fun, quality] | data[0] = usecode function number (or function name), data[1] = quality |
| Missile (6): [shape, direction, delay] | data[0] = missile shape number, data[1] = direction (0-7 for compass directions, 8 for party member), data[2] = delay |
| Teleport (7): [dest_x, dest_y, dest_z] or [egg_num] | If single element or data[1]==0 and data[2]==0 and data[0]<256: data[0] = path egg number. Otherwise: data[0] = X, data[1] = Y, data[2] = Z (lift) |
| Weather (8): [weather_type, duration] | data[0] = weather type (0=halt/normal, 1=snow, 2=storm, 3=sparkle, 4=fog, 5=overcast, 6=clouds), data[1] = duration |
| Path (9): [path_num] | data[0] = path egg quality number |
| Button (10): [distance] | data[0] = distance (triggers nearby external_criteria eggs) |
| Intermap (11): [dest_x, dest_y, dest_z, mapnum] | data[0] = X, data[1] = Y, data[2] = Z (lift), data[3] = map number |