home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-04-25 | 30.2 KB | 1,495 lines |
- //@
- # VR GAMES WDL-Script Project: DEMO ADEPTUS
- #
- # Auftraggeber : Conitec GmbH
- #
- #*********************************************************************
- # Module : entity.wdl - Kundenversion
- # Version : 2.0 (Made with WDL-STUDIO)
- # Date : 19.8.99
- # Responsible : Harald Schmidt
- # Description : Conitec Demo-RPG
- # *********************************************************************
- //@
- //
- //ENTITY SKILLS
- SYNONYM ent_test {TYPE ENTITY;}
-
- SKILL bounce_angle {}
-
- SKILL drop_temp {}
- SKILL testvar {}
- SKILL angles {}
- SKILL nav_direction {}
- SKILL to_nav_angle {}
- SKILL to_slope_angle {}
- SKILL follow_grav {X 0;Y 0;Z -10;}
- SKILL sc_time_speed {}
- SKILL temp_normal {}
- SKILL temp_angle {}
- SKILL temp_scan {}
- SKILL scan_mode {}
- SKILL MY_P {}
- SKILL MY_A {}
- SKILL jump_count {}
- SKILL sc_mov_rnd {}
-
- SKILL sc_dist {}
-
- SKILL sc_height {}
- SKILL sc_floor {}
- SKILL sc_min_z {}
- SKILL show_scan {}
-
-
- DEFINE FLOORDIST, SKILL39;
- DEFINE SCAN_RESULT, SKILL38; #internal temp
- DEFINE CHECKDIST SKILL40;
-
-
- SKILL testcycle {}
- SKILL woman_stop_count {}
-
-
- SKILL chain_temp_move {}
- SKILL chain_temp_init {}
-
- SKILL create_pos {}
-
- SKILL fountain_pos {}
- SKILL throw_count {}
- SKILL pyra1_skill {}
- SKILL pyra2_skill {}
- SKILL pyra3_skill {}
- SKILL pyra4_skill {}
- SKILL pyr_pos {}
- SKILL blitz_on {}
- SKILL scantest {}
- //
- SYNONYM TOUCH_STR {TYPE STRING; DEFAULT sword_str;}
- //
-
- //ENTITY initialisation actions
- // These actions are given in WED
- // the player
- ACTION entity_player
- {
- MY.ENT_ID = 0;
- SET MY.FAT,OFF;
- SET MY.NARROW,ON;
- MY.TRIGGER_RANGE = 5;
- MY._MOVEMODE = _MODE_WALKING;
- MY._FORCE = 0.75;
- MY._BANKING = -0.1;
- SET MY.__STRAFE,ON;
- SET MY.__BOB,ON;
- SET MY.__TRIGGER,ON;
- CALL vpst_enable_periodic_update;
- CALL player_move;
- }
-
- // this is Sinnarah
- ACTION entity_angel
- {
- MY.ENT_ID = M_ANGEL; // ID
- # DEBUG_ACT = ME; // for testing purposes
- MY.AMBIENT = 40;
- MY._DIALOG_STATE = 11; // the actual queste state is used by "vdia_make_talk" in Dialog.WDL
- SET MY.FAT, TRUE;
- SET MY.NARROW, FALSE;
- MY.SKIN = 1;
- MY._STATE = _NPC_WALK;
- MY._SPEED = 1.5;
- MY.TRIGGER_RANGE = 75;
- SET MY.ENABLE_TOUCH,ON;
- SET MY.ENABLE_CLICK, TRUE; //__NPC_COME or _NPC_TALK will be triggered by mouseclick
- SET MY.ENABLE_TRIGGER, TRUE; // will _NPC_STOP when near;
- SET MY.EVENT,woman_event; // this will happen on events
- SET MY.STRING1, angel_str; // used by touch text
- //create at game start an invisible entity that will be followed.
- //This results in smooth random like changes of the NPCs direction
- CREATE <ruby_ov.pcx>, MY.POS, vnpc_random_navigation;
- WAIT 1;
- CALL woman_movement;
- }
-
- //This is Innanah
- // Same_action as before
- ACTION entity_cynth
- {
- MY.ENT_ID = M_CYNTHIA;
- MY.SKIN = 2;
- MY.AMBIENT = 10;
- MY._DIALOG_STATE = 11;
- SET MY.FAT, TRUE;
- SET MY.NARROW, FALSE;
- MY._STATE = _NPC_WALK;
- MY._SPEED = 1.5;
- MY.TRIGGER_RANGE = 50;
- SET MY.ENABLE_TOUCH,ON;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TRIGGER, TRUE;
- SET MY.EVENT, woman_event;
- SET MY.STRING1, priest_str;
- CREATE <ruby_ov.pcx>, MY.POS, vnpc_random_navigation;
- WAIT 1;
- CALL woman_movement;
- }
-
- // A sorceress throwing fireballs
- ACTION entity_sorc
- {
- MY.ENT_ID = M_SORC;
- MY.SKIN = 3;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.STRING1, sorc_str;
- SET MY.STRING2, m_sorc_str;
- SET MY.EVENT, common_items_event;
- CALL sorc_throw_fireball;
- }
-
- // Desc: sorceress throwing fireball action
- ACTION sorc_throw_fireball
- {
- WHILE (1)
- {
- MY.CYCLE += TIME;
- IF (MY.CYCLE < 28 || MY.CYCLE > 45)
- {
- MY.CYCLE = 28;
- SET MY.__BUSY, FALSE;
- WAITT 96;
- }
- IF (MY.CYCLE > 36 && MY.__BUSY == FALSE)
- {
- SET MY.__BUSY, TRUE;
- CALL vspl_cast_fireball;
- }
- WAIT 1;
- }
- }
-
-
- ACTION entity_book
- {
- MY.ENT_ID = M_BOOK;
- MY.AMBIENT = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.STRING1, book_str;
- SET MY.EVENT, common_items_event;
- }
- ACTION entity_flame
- {
- MY.AMBIENT = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.STRING1, fire_str;
- SET MY.STRING2, m_feuer_str;
- SET MY.EVENT, common_items_event;
- WHILE (1)
- {
- MY.CYCLE += 1;
- IF (MY.CYCLE >= 5)
- {
- MY.CYCLE = 0;
- }
- WAIT 1;
- }
- }
- ACTION entity_fountain
- {
- MY.ENT_ID = M_FOUNTAIN;
- SET MY.AMBIENT, 0;
- #SET MY.TRANSPARENT, TRUE;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.STRING1, fountain_str;
- SET MY.STRING2, m_statue_str;
- SET MY.EVENT, common_items_event;
- CALL fountain_ani;
- }
- ACTION entity_chain1
- {
- MY.ENT_ID = M_CHAIN1;
- MY.AMBIENT = 40;
- MY._DIALOG_STATE = 0;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.EVENT, common_items_event;
- SET MY.PASSABLE, TRUE;
- SET MY.STRING1, chain_str;
- chain_temp_init = MY.Z;
- chain_temp_move = MY.Z - 32;
- }
- ACTION entity_chain2
- {
- MY.ENT_ID = M_CHAIN2;
- MY.AMBIENT = 40;
- MY._DIALOG_STATE = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.EVENT, common_items_event;
- SET MY.PASSABLE, TRUE;
- SET MY.STRING1, chain_str;
- }
- ACTION entity_chain3
- {
- MY.ENT_ID = M_CHAIN3;
- MY.AMBIENT = 40;
- MY._DIALOG_STATE = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.EVENT, common_items_event;
- SET MY.PASSABLE, TRUE;
- SET MY.STRING1, chain_str;
- }
- ACTION entity_chain4
- {
- MY.ENT_ID = M_CHAIN4;
- MY.AMBIENT = 40;
- MY._DIALOG_STATE = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.EVENT, common_items_event;
- SET MY.PASSABLE, TRUE;
- SET MY.STRING1, chain_str;
- }
- ACTION entity_scorpio
- {
- MY.ENT_ID = 0;
- MY.AMBIENT = 10;
- MY.ENT_SCALE = 0.3;
- MY._HEALTH = 20;
- MY._STATE = _NPC_WALK;
- MY.CHECKDIST = 50;
- MY._SPEED = 3;
- MY.TRIGGER_RANGE = 50;
- SET MY.STRING1, scorpio_str;
- CALL set_scorpio_event;
- CREATE <ruby_ov.pcx>, MY.POS, vnpc_random_navigation;
- WAIT 1;
- CALL sc_movement;
- }
- ACTION entity_bigscorpio
- {
- MY.ENT_ID = 0;
- MY.AMBIENT = 0;
- MY.ENT_SCALE = 1;
- MY._HEALTH = 30;
- MY._STATE = _NPC_ATTACK;
- MY.CHECKDIST = 50;
- MY._SPEED = 3;
- MY.TRIGGER_RANGE = 60;
- SET MY.STRING1,scorpio_str;
- CALL set_big_scorpio_event;
- WHILE (1)
- {
- CALL big_sc_movement;
- RETURN;
- }
- }
- ACTION entity_sword
- {
- MY.ENT_ID = M_SWORD;
- SET MY.NARROW, FALSE;
- SET MY.FAT, FALSE;
- SET MY.STRING1,sword_str;
- CALL vitm_init_item;
- }
- ACTION entity_fish
- {
- MY.ENT_ID = M_FISH;
- CALL vitm_init_item;
- }
- ACTION entity_key1
- {
- MY.ENT_ID = M_KEY1;
- SET MY.FACING, TRUE;
- MY.ENT_SCALE = 0.1;
- SET MY.STRING1,key_str;
- CALL vitm_init_item;
- }
- ACTION entity_key2
- {
- MY.ENT_ID = M_KEY2; //set the ENT_ID (Skill32)
- SET MY.FACING, TRUE;
- MY.ENT_SCALE = 0.1;
- SET MY.STRING1, key_str;
- CALL vitm_init_item; //will be handled as an inventory item
- }
- ACTION entity_ruby
- {
- MY.ENT_ID = M_RUBY;
- SET MY.FACING, TRUE;
- MY.AMBIENT = 0;
- MY.ENT_SCALE = 0.3;
- CALL vitm_init_item;
- SET MY.STRING1, ruby_str;
- }
- ACTION entity_blatt
- {
- MY.ENT_ID = M_BLATT;
- SET MY.FACING, TRUE;
- MY.ENT_SCALE = 0.25;
- SET MY.STRING1, exoticplant_str;
- CALL vitm_init_item;
- }
- ACTION entity_plant
- {
- MY.ENT_ID = 0;
- SET MY.STRING1, exoticplant_str;
- }
- ACTION entity_fish_sprite
- {
- MY.ENT_ID = M_FISH;
- SET MY.FACING, TRUE;
- MY.ENT_SCALE = 0.3;
- CALL vitm_init_item;
- }
- ACTION entity_diamond
- {
- MY.ENT_ID = M_GEM;
- SET MY.FACING, TRUE;
- MY.ENT_SCALE = 0.3;
- MY.AMBIENT = 20;
- SET MY.STRING1,diam_str;
- CALL vitm_init_item;
- }
- ACTION entity_sword_arm
- {
- MY.ENT_ID = 0;
- }
- ACTION entity_waterempty
- {
- MY.ENT_ID = M_WATEREMPTY;
- MY.AMBIENT = 0;
- MY.ENT_SCALE = 0.1;
- CALL vitm_init_item;
- SET MY.STRING1,waterempty_str;
- }
- ACTION entity_waterfull
- {
- MY.ENT_ID = M_WATERFULL;
- MY.AMBIENT = 0;
- MY.ENT_SCALE = 0.1;
- SET MY.STRING1, waterfull_str;
- CALL vitm_init_item;
- }
-
- ACTION entity_vase
- {
- MY.ENT_ID = 0;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.STRING1, vase_str;
- SET MY.STRING2, m_vase_str;
- SET MY.EVENT, common_items_event;
- }
- ACTION entity_tree
- {
- SET MY.FAT, FALSE;
- SET MY.NARROW, TRUE;
- MY.MIN_X = MY.MIN_X / 2;
- MY.MIN_Y = MY.MIN_Y / 2;
- MY.MAX_X = MY.MAX_X / 2;
- MY.MAX_Y = MY.MAX_Y / 2;
- }
- ACTION entity_pyra1
- {
- MY.ENT_ID = M_PYR1;
- MY.TILT = 90;
- SET MY.EVENT, pyr_event;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.STRING1, pyr_str;
- SET MY.STRING2, m_pyra_str1;
- SET MY.PASSABLE, TRUE;
- SET MY.ORIENTED, TRUE;
- }
- ACTION entity_pyra2
- {
- MY.ENT_ID = M_PYR2;
- MY.TILT = 90;
- SET MY.EVENT, pyr_event;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE;
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.PASSABLE, TRUE;
- SET MY.ORIENTED, TRUE;
- SET MY.STRING1, pyr_str;
- SET MY.STRING2, m_pyra_str2;
- }
- ACTION entity_pyra3
- {
- MY.ENT_ID = M_PYR3;
- MY.TILT = 90;
- SET MY.EVENT, pyr_event;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE; // set some flags
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.PASSABLE, TRUE;
- SET MY.ORIENTED, TRUE;
- SET MY.STRING1, pyr_str;
- SET MY.STRING2, m_pyra_str3;
- }
- ACTION entity_pyra4
- {
- MY.ENT_ID = M_PYR4;
- MY.TILT = 90;
- SET MY.EVENT, pyr_event;
- SET MY.ENABLE_CLICK, TRUE;
- SET MY.ENABLE_TOUCH, TRUE; // set some flags
- SET MY.ENABLE_RELEASE, TRUE;
- SET MY.PASSABLE, TRUE;
- SET MY.ORIENTED, TRUE;
- SET MY.STRING1, pyr_str;
- SET MY.STRING2, m_pyra_str4;
- }
-
- //////////////////////////////////////////////////
- // These are the Event Actions
- ACTION woman_event
- {
- CALL handle_touch;
- //This will happen if you click with the mouse
- IF (EVENT_TYPE == EVENT_CLICK)
- {
- IF (MY._STATE == _NPC_WALK) //walking?
- {
- MY._STATE = _NPC_COME; //then come
- }
- IF (MY._STATE == _NPC_STOP) //already here and waiting?
- {
- MY._STATE = _NPC_TALK; //then start dialog
- SET MY.ENABLE_TRIGGER, FALSE; //no double triggers
- NPC_ENTITY = ME; //used in vdia_make_talk
- CALL vdia_make_talk;
- }
- }
- IF (EVENT_TYPE == EVENT_TRIGGER)
- {
- MY._STATE = _NPC_STOP; //stop and wait if near
- }
- }
-
- ACTION woman_movement
- {
- WHILE (1)
- {
- // NPC follows an invisible navigator entity
- IF (MY._STATE == _NPC_WALK)
- {
- // set trigger again to stop before the player
- SET MY.ENABLE_TRIGGER, TRUE;
- ent_test = MY.ENTITY1; //this was declared in "vnpc_random_navigation"
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.1 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL woman_grav; //add gravity
- CALL woman_walk_anim; //animate it
- }
- // NPC walks towards the player
- IF (MY._STATE == _NPC_COME)
- {
- ent_test = player;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.3 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME * 2;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL woman_grav;
- CALL woman_walk_anim;
- }
- // NPC stops and faces the player
- IF (MY._STATE == _NPC_STOP)
- {
- woman_stop_count += TIME;
- ent_test = player;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.3 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = 0;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL woman_grav;
- CALL woman_wait_anim;
- IF (woman_stop_count > 80) //just wait some seconds and then walk further
- {
- MY._STATE = _NPC_WALK;
- woman_stop_count = 0;
- }
- }
- IF (MY._STATE == _NPC_TALK)
- {
- CALL woman_wait_anim;
- }
- WAIT 1;
- }
- }
- // a simple gravity action
- ACTION woman_grav
- {
- WAIT 1;
- SONAR ME, 4000;
- MY.FLOORDIST = RESULT;
- IF (MY.FLOORDIST > 7)
- {
- follow_grav.Z = -10;
- }
- ELSE
- {
- IF (MY.FLOORDIST < 1)
- {
- follow_grav.Z += 3;
- }
- ELSE
- {
- follow_grav.Z = 0;
- }
- }
- // If on a slope, apply gravity to draw him downwards:
- CALL scan_floor;
- IF (my_floornormal.Z < 0.85)
- {
- follow_grav.X = my_floornormal.X * gravity * 2;
- follow_grav.Y = my_floornormal.Y * gravity * 2;
- }
- ELSE
- {
- follow_grav.X = 0;
- follow_grav.Y = 0;
- }
- }
-
- ACTION woman_wait_anim
- {
- MY.CYCLE += TIME * 0.5;
- IF (MY.CYCLE < 0 || MY.CYCLE > 9)
- {
- MY.CYCLE = 0;
- }
- RETURN;
- }
-
- ACTION woman_walk_anim
- {
- sc_dist = SQRT (MY_SPEED.X * MY_SPEED.X + MY_SPEED.Y * MY_SPEED.Y);
- IF (sc_dist == 0)
- {
- # MY.CYCLE = 1; // standing
- RETURN;
- }
- MY.CYCLE += 0.32 * sc_dist;
- IF (MY.CYCLE < 10 || MY.CYCLE > 27)
- {
- PLAY_ENTSOUND ME, stein2_snd, 60;
- SET MY.__SOUND, 0;
- MY.CYCLE = 10;
- }
- IF ( (MY.CYCLE > 27 * 0.5) && (MY.__SOUND == 0))
- {
- PLAY_ENTSOUND ME, stein2_snd, 60;
- SET MY.__SOUND, 1;
- }
- RETURN;
- }
-
-
-
- // Desc: Event for common, non inventory, items
- ACTION common_items_event
- {
- IF (EVENT_TYPE == EVENT_CLICK)
- {
- IF (mouse_object == M_WATEREMPTY && MY.ENT_ID == M_FOUNTAIN)
- {
- SET MY.ENABLE_TOUCH, FALSE;
-
-
-
- mouse_object = M_WATERFULL; //cursor changes to full bottle
-
- PLAY_SOUND bottle_snd, 25;
- WAIT 2;
- SET MY.ENABLE_TOUCH, TRUE;
- RETURN;
- }
- // the book will reveal the quest
- IF (MY.ENT_ID == M_BOOK)
- {
- CALL show_quest;
- RETURN;
- }
- // draw chains
- IF (MY.ENT_ID >= M_CHAIN1 && MY.ENT_ID <= M_CHAIN4)
- {
- IF (MY.__BUSY)
- {
- RETURN;
- }
- CALL move_chain;
- }
- // the other items like flames and the like will show a short info
- ELSE
- {
- CALL vscr_show_info; //in a4panel.wdl
- }
- }
- //show a touch text
- CALL handle_touch;
- }
-
-
- /////////////// CHAIN ACTIONS //////////////////////////////////////////
-
- //Draw the chains
- ACTION chain_event
- {
- IF (MY.__BUSY) //no double trigger allowed
- {
- RETURN;
- }
- CALL move_chain;
- }
-
- ACTION move_chain
- {
- CALL count_chain; //the quest relevant action
- SET MY.__BUSY, TRUE;
- PLAY_SOUND open_snd, 66;
- WHILE (MY.Z > chain_temp_move)// move down
- {
- MY.Z -= 1;
- WAIT 1;
- }
- WHILE (MY.Z < chain_temp_init)//then move up again
- {
- MY.Z += 1;
- WAIT 1;
- }
- PLAY_SOUND close_snd, 66;
- SET MY.__BUSY, FALSE;
- }
- ACTION count_chain
- {
- IF (MY.ENT_ID == M_CHAIN1) // which chain was drawn?
- {
- chain1_skill = 1;
- }
- IF (MY.ENT_ID == M_CHAIN2)
- {
- chain2_skill = 2;
- }
- IF (MY.ENT_ID == M_CHAIN3)
- {
- chain3_skill = 3;
- }
- IF (MY.ENT_ID == M_CHAIN4)
- {
- chain4_skill = 4;
- }
- // has already every chain be drawn?
- IF ( (chain1_skill + chain2_skill + chain3_skill + chain4_skill) == 10)
- {
- create_pos.X = 4570; // then give this position
- create_pos.Y = -116;
- create_pos.Z = -470;
- // and create there a huge plate
- CREATE <plate.wmb>, create_pos, give_platename;
- create_pos.X = 4570;
- create_pos.Y = -116;
- create_pos.Z = -300;
- //and a huge scorpio *shudder*
- CREATE <scorpio1.mdl>, create_pos, entity_bigscorpio;
- }
- }
-
-
-
-
-
- ///////////// PYRAMID ACTIONS //////////////////////////////////////////
-
-
- // this is called by the 4 plates around the pyramid
- ACTION pyr_event
- {
- CALL handle_touch;
-
- IF (EVENT_TYPE == EVENT_CLICK)
- {
- IF (mouse_object <= _EMPTY) // default info on empty cursor
- {
- CALL vscr_show_info;
- RETURN;
- }
- // right item combined with the right plate?
- IF (MY.ENT_ID == M_PYR1 && mouse_object == M_SWORD)
- {
- pyra1_skill = 1;
- SET PLATE1, ME;
- mouse_object = _EMPTY; // item is consumed
- BRANCH quest_check; // activate the plate, create blitz, and
- // check for quest completion
- }
- IF (MY.ENT_ID == M_PYR2 && mouse_object == M_RUBY)
- {
- pyra2_skill = 2;
- SET PLATE2, ME;
- mouse_object = _EMPTY; // item is consumed
- BRANCH quest_check; // activate the plate, create blitz, and
- // check for quest completion
- }
- IF (MY.ENT_ID == M_PYR3 && mouse_object == M_WATERFULL)
- {
- pyra3_skill = 3;
- SET PLATE3, ME;
- mouse_object = _EMPTY; // item is consumed
- BRANCH quest_check; // activate the plate, create blitz, and
- // check for quest completion
- }
- IF (MY.ENT_ID == M_PYR4 && mouse_object == M_BLATT)
- {
- pyra4_skill = 4;
- SET PLATE4, ME;
- mouse_object = _EMPTY; // item is consumed
- BRANCH quest_check; // activate the plate, create blitz, and
- // check for quest completion
- }
- //else you should try annother item
- CALL vttx_show_wrong_item_text;
- }
- }
-
-
- // create a blitz and change the plate
- ACTION quest_check
- {
- MY.CYCLE += 1; //give the plate a new surface
- pyr_pos.X = MY.X;
- pyr_pos.Y = MY.Y;
- pyr_pos.Z = MY.Z + 100;
- blitz_on = TRUE; //this will be needed to remove the stuff
- PLAY_SOUND zisch_snd, 50;
- CREATE <blitz+3.pcx>, pyr_pos, blitz_ani;
- //Now check wether all plates are activated
- IF ( (pyra1_skill + pyra2_skill + pyra3_skill + pyra4_skill) == 10)
- {
- SET MY.EVENT, NULL; //this quest isn't repeatable
- CALL give_mana; // showdown
- }
- }
-
- ACTION give_mana
- {
- CALL show_quest_ready;
- CALL echosound;
- player_mana = 30;
- WHILE (1)
- {
- player_current_mana += 0.3; //add "mana" to the player
- IF (player._DIALOG_STATE != 51) {
- SET ME,player;
- CALL player_shake; // feels like a quake
- }
- IF (player_current_mana >= player_mana)
- {
- player._DIALOG_STATE = 51; //used for the next talk in dialog.wdl
- SET PLATE1.CYCLE, 0; //show old surface
- SET PLATE2.CYCLE, 0;
- SET PLATE3.CYCLE, 0;
- SET PLATE4.CYCLE, 0;
- SET blitz_on, FALSE; //remove all blitzes in blitz_ani
- RETURN;
- }
- WAIT 1;
- }
- }
-
- //fat echo
- ACTION echosound
- {
- WHILE (1)
- {
- PLAY_SOUND, ready_snd, 60;
- WAIT 16;
- PLAY_SOUND, ready_snd, 40;
- WAIT 16;
- PLAY_SOUND, ready_snd, 20;
- WAIT 16;
- PLAY_SOUND, ready_snd, 10;
- RETURN;
- }
- }
-
- ACTION give_platename
- {
- PLATE = ME;
- }
-
- //
- ACTION blitz_ani
- {
- MY.AMBIENT = 30;
- WHILE (blitz_on)
- {
- MY.CYCLE += 1;
- IF (MY.CYCLE > 2)
- {
- MY.CYCLE = 0;
- }
- WAIT 1;
- }
- REMOVE ME;
- RETURN;
- }
- //
- ACTION tp_ani
- {
- SET MY.EVENT tp_event;
- SET MY.ENABLE_IMPACT, TRUE;
- MY.AMBIENT = 30;
- WHILE (1)
- {
- MY.CYCLE += 1;
- IF (MY.CYCLE > 6)
- {
- MY.CYCLE = 0;
- }
- WAIT 1;
- }
- }
- ACTION tp_event
- {
- IF (YOU == PLAYER)
- {
- CALL vmsc_exit;
- }
- }
- // animation of the fountain with particle effect
- ACTION fountain_ani
- {
- fountain_pos.X = MY.X;
- fountain_pos.Y = MY.Y;
- WHILE (1)
- {
- MY.CYCLE += 1;
- fountain_pos.Z = MY.Z + RANDOM (48)-24;
- IF (MY.CYCLE > 3)
- {
- MY.CYCLE = 0;
- EMIT 50, fountain_pos, particle_fountain;
- }
- WAIT 1;
- }
- }
-
-
-
-
- ////////// VENTURE ITEM OVERRIDES ///////////////////////////////////////////
-
-
- // Desc: create an item with an attached action depending on the cursor sprite
- // NOTE: this action overrides a dummy action in venture.wdl
- ACTION vitm_create_item
- {
- IF (mouse_object == M_KEY1)
- {
- CREATE <key1_ov.pcx>, MY_POS, throw_key1;
- }
- IF (mouse_object == M_KEY2)
- {
- CREATE <key2_ov.pcx>, MY_POS, throw_key2;
- }
- IF (mouse_object == M_GEM)
- {
- CREATE <diam1_ov.pcx>, MY_POS, throw_diamond;
- }
- IF (mouse_object == M_RUBY)
- {
- CREATE <ruby_ov.pcx>, MY_POS, throw_ruby;
- }
- IF (mouse_object == M_BLATT)
- {
- CREATE <blatt_ov.pcx>, MY_POS, throw_blatt;
- }
- IF (mouse_object == M_FISH)
- {
- CREATE <fish_ov.pcx>, MY_POS, throw_fish;
- }
- IF (mouse_object == M_SWORD)
- {
- CREATE <sword.mdl>, MY_POS, throw_sword;
- }
- IF (mouse_object == M_WATEREMPTY)
- {
- CREATE <flacon.pcx>, MY_POS, throw_waterempty;
- }
- IF (mouse_object == M_WATERFULL)
- {
- CREATE <flacon1.pcx>, MY_POS, throw_waterfull;
- }
- }
-
-
- //specific throw initialisations
- ACTION throw_key1
- {
- CALL entity_key1;
- CALL vitm_drop_item;
- }
- ACTION throw_key2
- {
- CALL entity_key2;
- CALL vitm_drop_item;
- }
- ACTION throw_diamond
- {
- CALL entity_diamond;
- CALL vitm_drop_item;
- }
- ACTION throw_ruby
- {
- CALL entity_ruby;
- CALL vitm_drop_item;
- }
- ACTION throw_blatt
- {
- CALL entity_blatt;
- CALL vitm_drop_item;
- }
- ACTION throw_waterempty
- {
- CALL entity_waterempty;
- CALL vitm_drop_item;
- }
- ACTION throw_waterfull
- {
- CALL entity_waterfull;
- CALL vitm_drop_item;
- }
- ACTION throw_fish
- {
- CALL entity_fish_sprite;
- CALL vitm_throw_item;
- }
- ACTION throw_sword
- {
- __HAS_SWORD = FALSE;
- SET ON_SPACE, NULL;
- CALL entity_sword;
- CALL vitm_drop_item;
- }
-
-
-
-
- ////////////Skills Monster ////////////////
- SKILL sc_str {VAL 12;}#scorpio stats
- SKILL sc_gew {VAL 12;}
- SKILL sc_mut {VAL 12;}
- SKILL sc_int {VAL 12;}
-
-
-
- // Desc: Scorpion attacks player.
- //
- // Set the STR, MUT, and GEW skills to the scorpio stats and call
- // player_defense.
- ACTION sc_att_probe
- {
- SET vent_npc_str, sc_str;
- SET vent_npc_mut, sc_mut;
- SET vent_npc_gew, sc_gew;
- CALL vcom_player_defense;
- }
-
- // Desc: Scorpion gets attacked
- //
- // Set the INT, MUT, and GEW skills to the scorpio stats and call
- // player_attack.
- ACTION sc_def_probe
- {
- IF (YOUR._VWEAPON_TYPE == _VWEAPON_TYPE_DIRECT)
- { // direct damage
-
- // <add sound and animation here>
-
- CALL vcom_direct_attack;
- RETURN;
- }
-
- IF (YOUR._VWEAPON_TYPE == _VWEAPON_TYPE_MELEE)
- { // melee damage
- SET vent_npc_int, sc_int;
- SET vent_npc_mut, sc_mut;
- SET vent_npc_gew, sc_gew;
- CALL vcom_player_attack;
- RETURN;
- }
- }
-
-
-
-
-
- // the scorpios movement
- ACTION sc_movement
- {
- MY.SCALE_X = MY.ENT_SCALE;
- MY.SCALE_Y = MY.ENT_SCALE * 0.7;
- MY.SCALE_Z = MY.ENT_SCALE;
- SET MY.FAT, TRUE;
- scan_mode.PAN = 360;
- scan_mode.TILT = 60;
- scan_mode.Z = 120;
- CALL drop_sc_shadow; // drop a shadow
- WHILE (1)
- {
- CALL scan_around;
- // they will attack each entity (thus even each other)
- IF (MY._STATE == _NPC_ATTACK)
- {
- ent_test = MY.ENTITY2;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.5 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME * 4;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_attack_anim;
- }
- // if they touch another entity they will jump back
- IF (MY._STATE == _NPC_RETREAT)
- {
- SET MY.ENABLE_TRIGGER, FALSE;
- sc_time_speed = MY._SPEED * TIME * -4;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- MY._COUNTER += 1 * TIME;
- sc_mov_rnd = 3 + RANDOM (40);
- IF (MY._COUNTER > sc_mov_rnd)
- {
- MY._STATE = _NPC_WALK;
- MY._COUNTER = 0;
- SET MY.ENABLE_TRIGGER, TRUE;
- }
- CALL sc_grav_slope;
- CALL scorpio_attack_anim;
- }
- IF (MY._STATE == _NPC_WALK)
- {
- ent_test = MY.ENTITY1;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.1 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_walk_anim;
- }
- IF (MY._STATE == _NPC_STOP)
- {
- IF (RANDOM (512) > 510)
- {
- MY._STATE = _NPC_WALK;
- }
- sc_time_speed = 0;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_walk_anim;
- }
- IF (MY._STATE == _NPC_DEAD)
- {
- sc_time_speed = 0;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_die_anim;
- PLAY_SOUND m_sc_dead_snd, 100;
- RETURN;
- }
- WAIT 1;
- }
- }
-
- // same as sc_movement
- ACTION big_sc_movement
- {
- MY.SCALE_X = MY.ENT_SCALE;
- MY.SCALE_Y = MY.ENT_SCALE * 0.7;
- MY.SCALE_Z = MY.ENT_SCALE;
- SET MY.FAT, TRUE;
- SET MY.NARROW, FALSE;
- scan_mode.PAN = 360;
- scan_mode.TILT = 60;
- scan_mode.Z = 120;
- CALL drop_sc_shadow;
- WHILE (1)
- {
- CALL scan_around;
- IF (MY._STATE == _NPC_ATTACK)
- {
- ent_test = player;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.5 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME * 4;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_attack_anim;
- }
- IF (MY._STATE == _NPC_RETREAT)
- {
- SET MY.ENABLE_TRIGGER, FALSE;
- sc_time_speed = MY._SPEED * TIME * -4;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- MY._COUNTER += 1 * TIME;
- sc_mov_rnd = 10 + RANDOM (70);
- IF (MY._COUNTER > sc_mov_rnd)
- {
- MY._STATE = _NPC_ATTACK;
- MY._COUNTER = 0;
- SET MY.ENABLE_TRIGGER, TRUE;
- }
- CALL sc_grav_slope;
- CALL scorpio_attack_anim;
- }
- IF (MY._STATE == _NPC_WALK)
- {
- # IF (RANDOM (512) > 510)
- # {
- # MY._STATE = _NPC_STOP;
- # }
- ent_test = MY.ENTITY1;
- nav_direction.X = ent_test.X - MY.X;
- nav_direction.Y = ent_test.Y - MY.Y;
- nav_direction.Z = ent_test.Z - MY.Z;
- TO_ANGLE, to_nav_angle, nav_direction;
- MY.PAN += 0.1 * ANG (to_nav_angle.PAN - MY.PAN);
- sc_time_speed = MY._SPEED * TIME;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_walk_anim;
- }
- IF (MY._STATE == _NPC_STOP)
- {
- IF (RANDOM (512) > 510)
- {
- MY._STATE = _NPC_WALK;
- }
- sc_time_speed = 0;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL scorpio_walk_anim;
- }
- IF (MY._STATE == _NPC_DEAD)
- {
- sc_time_speed = 0;
- SET YOU,NULL;
- MOVE ME sc_time_speed, follow_grav;
- CALL sc_grav_slope;
- CALL big_scorpio_die_anim;
- PLAY_SOUND m_sc_dead_snd, 100;
- RETURN;
- }
- WAIT 1;
- }
- }
- ACTION set_scorpio_event
- {
- SET MY.ENABLE_SCAN, TRUE;
- SET MY.ENABLE_SHOOT, TRUE;
- SET MY.ENABLE_ENTITY, TRUE;
- SET MY.EVENT, scorpio_event;
- }
- ACTION set_big_scorpio_event
- {
- SET MY.ENABLE_SCAN, TRUE;
- SET MY.ENABLE_SHOOT, TRUE;
- SET MY.ENABLE_ENTITY, TRUE;
- SET MY.EVENT, big_scorpio_event;
- }
- ACTION player_event
- {
- IF (EVENT_TYPE == EVENT_SCAN)
- {
- WHILE (1)
- {
- YOUR.ENTITY2 = ME;
- WAIT 1;
- YOUR._STATE = _NPC_ATTACK;
- RETURN;
- }
- }
- }
- ACTION scorpio_event
- {
- IF (EVENT_TYPE == EVENT_ENTITY)
- {
- IF (YOU == player)
- {
- CALL sc_att_probe;
- }
-
- ELSE
- {
- IF (YOU._VWEAPON_TYPE == _VWEAPON_TYPE_DIRECT)
- {
- // direct damage weapon (fireball)
- CALL sc_def_probe;
- }
- }
- MY._STATE = _NPC_RETREAT;
- PLAY_ENTSOUND ME, m_sc_snd, 150;
- }
- IF (EVENT_TYPE == EVENT_TRIGGER)
- {
- WHILE (1)
- {
- MY.ENTITY2 = YOU;
- WAIT 1;
- MY._STATE = _NPC_ATTACK;
- RETURN;
- }
- }
- IF (EVENT_TYPE == EVENT_SHOOT)
- {
- WHILE (1)
- {
- SET __BLOODY, TRUE;
- CALL sc_def_probe;
- WAIT 1;
- SET __BLOODY, FALSE;
- RETURN;
- }
- }
- }
- ACTION big_scorpio_event
- {
- IF (EVENT_TYPE == EVENT_ENTITY)
- {
- IF (YOU == player)
- {
- CALL sc_att_probe;
- }
- MY._STATE = _NPC_RETREAT;
- PLAY_ENTSOUND ME, sc_snd, 150;
- }
- IF (EVENT_TYPE == EVENT_TRIGGER)
- {
- WHILE (1)
- {
- WAIT 1;
- MY._STATE = _NPC_ATTACK;
- RETURN;
- }
- }
- IF (EVENT_TYPE == EVENT_SHOOT)
- {
- WHILE (1)
- {
- SET __BLOODY, TRUE;
- CALL sc_def_probe;
- WAIT 1;
- SET __BLOODY, FALSE;
- RETURN;
- }
- }
- }
-
-
-
- ACTION player_scan
- {
- WHILE (1)
- {
- CALL scan_around;
- WAIT 1;
- }
- }
- ACTION scan_around
- {
- MY_A.TILT = MY.TILT;
- MY_A.ROLL = MY.ROLL;
- MY_A.PAN = MY.PAN;
- MY_P.X = MY.X;
- MY_P.Y = MY.Y;
- MY_P.Z = MY.Z;
- SCAN MY_P, MY_A, scan_mode;
- MY.SCAN_RESULT = RESULT;
- }
- ACTION sc_grav_slope
- {
- WAIT 1;
- SONAR ME, 4000;
- MY.FLOORDIST = RESULT;
- IF (MY.FLOORDIST > 7)
- {
- follow_grav.Z = -10;
- }
- ELSE
- {
- IF (MY.FLOORDIST < 1)
- {
- follow_grav.Z += 3;
- }
- ELSE
- {
- follow_grav.Z = 0;
- }
- }
- CALL scan_floor;
- // Adapt the scorpio angle to the floor slope
- MY_ANGLE.TILT = 0;
- MY_ANGLE.ROLL = 0;
- IF (my_height < 10 && (my_floornormal.X! = 0 || my_floornormal.Y! = 0))
- {
- // on a slope?
- // rotate the floor normal relative to the scorpio
- MY_ANGLE.PAN = -MY.PAN;
- VECROTATE my_floornormal, MY_ANGLE;
- // calculate the destination tilt and roll angles
- MY_ANGLE.TILT = -ASIN (my_floornormal.X);
- MY_ANGLE.ROLL = -ASIN (my_floornormal.Y);
- }
- // change the scorpio angles towards the destination angles
- MY.TILT += 0.2 * ANG (MY_ANGLE.TILT - MY.TILT);
- MY.ROLL += 0.2 * ANG (MY_ANGLE.ROLL - MY.ROLL);
- }
- ACTION scorpio_walk_anim
- {
- sc_dist = SQRT (MY_SPEED.X * MY_SPEED.X + MY_SPEED.Y * MY_SPEED.Y);
- IF (sc_dist == 0)
- {
- # MY.CYCLE = 1; // standing
- RETURN;
- }
- MY.CYCLE += 0.32 * sc_dist;
- IF (MY.CYCLE < 2 || MY.CYCLE > 1 + 15)
- {
- PLAY_ENTSOUND ME, stein2_snd, 60;
- SET MY.__SOUND, 0;
- MY.CYCLE = 2;
- }
- IF ( (MY.CYCLE > 1 + 15 * 0.5) && (MY.__SOUND == 0))
- {
- PLAY_ENTSOUND ME, stein2_snd, 60;
- SET MY.__SOUND, 1;
- }
- RETURN;
- }
- ACTION scorpio_die_anim
- {
- MY.CYCLE = 33;
- WHILE (MY.CYCLE <= 48)
- {
- MY.CYCLE += 1;
- testcycle = MY.CYCLE;
- WAIT 1;
- }
- RETURN;
- }
- ACTION big_scorpio_die_anim
- {
- MY.CYCLE = 33;
- WHILE (MY.CYCLE <= 48)
- {
- MY.CYCLE += 1;
- testcycle = MY.CYCLE;
- WAIT 1;
- }
- SET give_exp, 1000;
- CALL vpst_check_exp;
- REMOVE PLATE;
- create_pos.X = 4570;
- create_pos.Y = -116;
- create_pos.Z = -400;
- CREATE <ruby.pcx>, create_pos, entity_ruby;
- REMOVE ME;
- RETURN;
- }
- ACTION scorpio_attack_anim
- {
- IF (MY.CYCLE < 16 || MY.CYCLE > 32)
- {
- MY.CYCLE = 16;
- }
- MY.CYCLE += TIME;
- }
- ACTION drop_sc_shadow
- {
- // create a shadow below the scorpio
- CREATE <sc_shad.pcx>, MY.POS, move_sc_shadow;
- }
- ACTION move_sc_shadow
- {
- SET MY.AMBIENT, -80;
- SET MY.SCALE_X, 0.9;
- SET MY.SCALE_Y, 0.95;
- SET MY.TRANSPARENT, 1;
- SET MY.PASSABLE, 1;
- SET MY.ORIENTED, 1;
- WHILE (YOUR.INVISIBLE == 0)
- {
- MY.TILT = YOUR.TILT + 90; // set it flat onto the floor
- MY.ROLL = YOUR.ROLL;
- MY.PAN = YOUR.PAN;
- MY.X = YOUR.X;
- MY.Y = YOUR.Y;
- sc_height = YOUR.Z;
- sc_floor = YOUR.FLOORDIST;
- sc_min_z = YOUR.MAX_Z - YOUR.MIN_Z;
- IF (YOUR.FLOORDIST > 0)
- {
- MY.Z = sc_height - sc_floor - sc_min_z - 3;
- }
- IF (YOUR._STATE == _NPC_DEAD)
- {
- MY.PAN += 180;
- RETURN;
- }
- WAIT 1;
- }
- REMOVE ME;
- }
-
-
-
-