这篇教程C++ G_Script_ScriptEvent函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_Script_ScriptEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ G_Script_ScriptEvent函数的具体用法?C++ G_Script_ScriptEvent怎么用?C++ G_Script_ScriptEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_Script_ScriptEvent函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Team_DroppedFlagThink/*==============Team_DroppedFlagThinkAutomatically set in Launch_Item if the item is one of the flagsFlags are unique in that if they are dropped, the base flag must be respawned when they time out==============*/void Team_DroppedFlagThink(gentity_t *ent) { if (ent->item->giTag == PW_REDFLAG) { G_Script_ScriptEvent(&g_entities[ent->s.otherEntityNum], "trigger", "returned"); Team_ReturnFlagSound(ent, TEAM_AXIS); Team_ResetFlag(ent); if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "axis_object_returned"); } // Nico, bugfix: removed left printf // http://games.chruker.dk/enemy_territory/modding_project_bugfix.php?bug_id=058 // trap_SendServerCommand( -1, "cp /"Axis have returned the objective!/" 2" ); } else if (ent->item->giTag == PW_BLUEFLAG) { G_Script_ScriptEvent(&g_entities[ent->s.otherEntityNum], "trigger", "returned"); Team_ReturnFlagSound(ent, TEAM_ALLIES); Team_ResetFlag(ent); if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "allied_object_returned"); } } // Reset Flag will delete this entity}
开发者ID:boutetnico,项目名称:ETrun,代码行数:35,
示例2: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn(gentity_t *ent){ spawn_t *s; gitem_t *item; if (!ent->classname) { G_Printf("G_CallSpawn: NULL classname/n"); return qfalse; } // check item spawn functions for (item = bg_itemlist + 1 ; item->classname ; item++) { if (!strcmp(item->classname, ent->classname)) { // found it if (g_gametype.integer != GT_WOLF_LMS) // lets not have items in last man standing for the moment { G_SpawnItem(ent, item); G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); } else { return qfalse; } return qtrue; } } // check normal spawn functions for (s = spawns ; s->name ; s++) { if (!strcmp(s->name, ent->classname)) { // found it s->spawn(ent); // entity scripting if (/*ent->s.number >= MAX_CLIENTS &&*/ ent->scriptName) { G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); } return qtrue; } } // hack: this avoids spammy prints on start, bsp uses obsolete classnames! // bot_sniper_spot (railgun) if (Q_stricmp(ent->classname, "bot_sniper_spot")) { G_Printf("%s doesn't have a spawn function/n", ent->classname); } return qfalse;}
开发者ID:fretn,项目名称:etlegacy,代码行数:68,
示例3: target_script_trigger_use/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen used it will fire its targets*/void target_script_trigger_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {// START Mad Doctor I changes, 8/16/2002 qboolean found = qfalse; // Nico, silent GCC (void)activator; // Are we using ainame to find another ent instead of using scriptname for this one? if (ent->aiName) { gentity_t *trent = NULL; // Find the first entity with this name trent = G_Find(trent, FOFS(scriptName), ent->aiName); // Was there one? if (trent) { // We found it found = qtrue; // Play the script G_Script_ScriptEvent(trent, "trigger", ent->target); } // if (trent)... } // if (ent->aiName)... // Use the old method if we didn't find an entity with the ainame if (!found && ent->scriptName) { G_Script_ScriptEvent(ent, "trigger", ent->target); } G_UseTargets(ent, other);}
开发者ID:boutetnico,项目名称:ETrun,代码行数:39,
示例4: Touch_flagonlyvoid Touch_flagonly( gentity_t *ent, gentity_t *other, trace_t *trace ) { if ( !other->client ) { return; } if ( ent->spawnflags & RED_FLAG && other->client->ps.powerups[ PW_REDFLAG ] ) { AddScore( other, ent->accuracy ); // JPW NERVE set from map, defaults to 20 G_Script_ScriptEvent( ent, "death", "" ); // Removes itself ent->touch = 0; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; } else if ( ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[ PW_BLUEFLAG ] ) { AddScore( other, ent->accuracy ); // JPW NERVE set from map, defaults to 20 G_Script_ScriptEvent( ent, "death", "" ); // Removes itself ent->touch = 0; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:28,
示例5: Team_TouchOurFlagint Team_TouchOurFlag(gentity_t *ent, gentity_t *other, int team) { gclient_t *cl = other->client; if (ent->flags & FL_DROPPED_ITEM) { // hey, its not home. return it by teleporting it back if (cl->sess.sessionTeam == TEAM_AXIS) { if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "axis_object_returned"); } G_Script_ScriptEvent(&g_entities[ent->s.otherEntityNum], "trigger", "returned"); } else { if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "allied_object_returned"); } G_Script_ScriptEvent(&g_entities[ent->s.otherEntityNum], "trigger", "returned"); } // dhm// jpw 800 672 2420 //ResetFlag will remove this entity! We must return zero Team_ReturnFlagSound(ent, team); Team_ResetFlag(ent); return 0; } // DHM - Nerve :: GT_WOLF doesn't support capturing the flag return 0;}
开发者ID:boutetnico,项目名称:ETrun,代码行数:27,
示例6: Touch_flagonlyvoid Touch_flagonly (gentity_t *ent, gentity_t *other, trace_t *trace) { gentity_t* tmp; if (!other->client) return; if ( ent->spawnflags & RED_FLAG && other->client->ps.powerups[ PW_REDFLAG ] ) { if( ent->spawnflags & 4 ) { other->client->ps.powerups[ PW_REDFLAG ] = 0; other->client->speedScale = 0; } AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20 //G_AddExperience( other, 2.f ); tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent( ent, "death", "" ); G_Script_ScriptEvent( &g_entities[other->client->flagParent], "trigger", "captured" ); ent->parent = tmp; // Removes itself ent->touch = NULL; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; } else if ( ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[ PW_BLUEFLAG ] ) { if( ent->spawnflags & 4 ) { other->client->ps.powerups[ PW_BLUEFLAG ] = 0; other->client->speedScale = 0; } AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20 //G_AddExperience( other, 2.f ); tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent( ent, "death", "" ); G_Script_ScriptEvent( &g_entities[other->client->flagParent], "trigger", "captured" ); ent->parent = tmp; // Removes itself ent->touch = NULL; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:56,
示例7: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn(gentity_t * ent){ spawn_t *s; gitem_t *item; if(!ent->classname) { G_Printf("G_CallSpawn: NULL classname/n"); return qfalse; } // check item spawn functions for(item = bg_itemlist + 1; item->classname; item++) { if(!strcmp(item->classname, ent->classname)) { // found it if(g_gametype.integer != GT_WOLF_LMS) { // Gordon: lets not have items in last man standing for the moment G_SpawnItem(ent, item); G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); } else { return qfalse; } return qtrue; } } // check normal spawn functions for(s = spawns; s->name; s++) { if(!strcmp(s->name, ent->classname)) { // found it s->spawn(ent); // RF, entity scripting if( /*ent->s.number >= MAX_CLIENTS && */ ent->scriptName) { G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); } return qtrue; } } G_Printf("%s doesn't have a spawn function/n", ent->classname); return qfalse;}
开发者ID:ethr,项目名称:ETXreaLPro_etmain,代码行数:61,
示例8: Team_TouchEnemyFlagint Team_TouchEnemyFlag(gentity_t *ent, gentity_t *other, int team) { gclient_t *cl = other->client; gentity_t *tmp; ent->s.density--; tmp = ent->parent; ent->parent = other; if (cl->sess.sessionTeam == TEAM_AXIS) { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_AXIS; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "allied_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); } else { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_ALLIES; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "axis_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); } ent->parent = tmp; if (team == TEAM_AXIS) { cl->ps.powerups[PW_REDFLAG] = INT_MAX; } else { cl->ps.powerups[PW_BLUEFLAG] = INT_MAX; } // flags never expire // store the entitynum of our original flag spawner if (ent->flags & FL_DROPPED_ITEM) { cl->flagParent = ent->s.otherEntityNum; } else { cl->flagParent = ent->s.number; } other->client->speedScale = ent->splashDamage; // Alter player speed if (ent->s.density > 0) { return 1; // We have more flags to give out, spawn back quickly } return -1; // Do not respawn this automatically, but do delete it if it was FL_DROPPED}
开发者ID:boutetnico,项目名称:ETrun,代码行数:53,
示例9: Touch_flagonlyvoid Touch_flagonly(gentity_t *ent, gentity_t *other, trace_t *trace) { gentity_t *tmp; // Nico, silent GCC (void)trace; if (!other->client) { return; } if (ent->spawnflags & RED_FLAG && other->client->ps.powerups[PW_REDFLAG]) { if (ent->spawnflags & 4) { other->client->ps.powerups[PW_REDFLAG] = 0; other->client->speedScale = 0; } tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured"); ent->parent = tmp; // Removes itself ent->touch = NULL; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; } else if (ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[PW_BLUEFLAG]) { if (ent->spawnflags & 4) { other->client->ps.powerups[PW_BLUEFLAG] = 0; other->client->speedScale = 0; } tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured"); ent->parent = tmp; // Removes itself ent->touch = NULL; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:Exosum,项目名称:ETrun,代码行数:53,
示例10: Touch_flagonly_multiplevoid Touch_flagonly_multiple(gentity_t * ent, gentity_t * other, trace_t * trace){ gentity_t *tmp; if(!other->client) { return; } if(ent->spawnflags & RED_FLAG && other->client->ps.powerups[PW_REDFLAG]) { other->client->ps.powerups[PW_REDFLAG] = 0; other->client->speedScale = 0; AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20 //G_AddExperience( other, 2.f ); tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured");#ifdef OMNIBOT Bot_Util_SendTrigger(ent, NULL, va("Allies captured %s", ent->scriptName), "");#endif ent->parent = tmp; } else if(ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[PW_BLUEFLAG]) { other->client->ps.powerups[PW_BLUEFLAG] = 0; other->client->speedScale = 0; AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20 //G_AddExperience( other, 2.f ); tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured");#ifdef OMNIBOT Bot_Util_SendTrigger(ent, NULL, va("Axis captured %s", ent->scriptName), "");#endif ent->parent = tmp; }}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:53,
示例11: checkpoint_touchvoid checkpoint_touch(gentity_t *self, gentity_t *other, trace_t *trace) { // Nico, silent GCC (void)trace; if (self->count == (int)other->client->sess.sessionTeam) { return; } // Set controlling team self->count = other->client->sess.sessionTeam; // Set animation if (self->count == TEAM_AXIS) { if (self->s.frame == WCP_ANIM_NOFLAG) { self->s.frame = WCP_ANIM_RAISE_AXIS; } else if (self->s.frame == WCP_ANIM_AMERICAN_RAISED) { self->s.frame = WCP_ANIM_AMERICAN_TO_AXIS; } else { self->s.frame = WCP_ANIM_AXIS_RAISED; } } else { if (self->s.frame == WCP_ANIM_NOFLAG) { self->s.frame = WCP_ANIM_RAISE_AMERICAN; } else if (self->s.frame == WCP_ANIM_AXIS_RAISED) { self->s.frame = WCP_ANIM_AXIS_TO_AMERICAN; } else { self->s.frame = WCP_ANIM_AMERICAN_RAISED; } } self->parent = other; // Gordon: reset player disguise on touching flag // Run script trigger if (self->count == TEAM_AXIS) { self->health = 0; G_Script_ScriptEvent(self, "trigger", "axis_capture"); } else { self->health = 10; G_Script_ScriptEvent(self, "trigger", "allied_capture"); } // Play a sound G_AddEvent(self, EV_GENERAL_SOUND, self->soundPos1); // Don't allow touch again until animation is finished self->touch = NULL; self->think = checkpoint_think; self->nextthink = level.time + 1000;}
开发者ID:boutetnico,项目名称:ETrun,代码行数:51,
示例12: multi_trigger// the trigger was just activated// ent->activator should be set to the activator so it can be held through a delay// so wait for the delay time before firingvoid multi_trigger(gentity_t * ent, gentity_t * activator){ ent->activator = activator; G_Script_ScriptEvent(ent, "activate", NULL); if(ent->nextthink) { return; // can't retrigger until the wait is over } G_UseTargets(ent, ent->activator); if(ent->wait > 0) { ent->think = multi_wait; ent->nextthink = level.time + (ent->wait + ent->random * crandom()) * 1000; } else { // we can't just remove (self) here, because this is a touch function // called while looping through area links... ent->touch = 0; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:30,
示例13: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn( gentity_t *ent ) { spawn_t *s; gitem_t *item; int hash; if ( !ent->classname ) { G_Printf( "G_CallSpawn: NULL classname/n" ); return qfalse; } if ( g_deathmatch.integer ) { if ( !strcmp( "func_explosive", ent->classname ) ) { return qfalse; } if ( !strcmp( "trigger_hurt", ent->classname ) ) { return qfalse; } // don't spawn the flags in cp if ( g_gametype.integer == 7 && !strcmp( "team_WOLF_checkpoint", ent->classname ) ) { return qfalse; } } // check item spawn functions for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( !strcmp( item->classname, ent->classname ) ) { // found it // DHM - Nerve :: allow flags in GTWOLF if ( item->giType == IT_TEAM && ( g_gametype.integer != GT_CTF && g_gametype.integer < GT_WOLF ) ) { return qfalse; } G_SpawnItem( ent, item ); return qtrue; } } // check normal spawn functions hash = BG_StringHashValue( ent->classname ); for ( s = spawns ; s->name ; s++ ) { if ( s->hash == hash ) { // found it s->spawn( ent ); // RF, entity scripting if ( ent->s.number >= MAX_CLIENTS && ent->scriptName ) { G_Script_ScriptParse( ent ); G_Script_ScriptEvent( ent, "spawn", "" ); } return qtrue; } } G_Printf( "%s doesn't have a spawn function/n", ent->classname ); return qfalse;}
开发者ID:chegestar,项目名称:omni-bot,代码行数:65,
示例14: checkpoint_touchvoid checkpoint_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { if ( self->count == other->client->sess.sessionTeam ) { return; } // Set controlling team self->count = other->client->sess.sessionTeam; // Set animation if ( self->count == TEAM_RED ) { if ( self->s.frame == WCP_ANIM_NOFLAG ) { self->s.frame = WCP_ANIM_RAISE_NAZI; } else if ( self->s.frame == WCP_ANIM_AMERICAN_RAISED ) { self->s.frame = WCP_ANIM_AMERICAN_TO_NAZI; } else { self->s.frame = WCP_ANIM_NAZI_RAISED; } } else { if ( self->s.frame == WCP_ANIM_NOFLAG ) { self->s.frame = WCP_ANIM_RAISE_AMERICAN; } else if ( self->s.frame == WCP_ANIM_NAZI_RAISED ) { self->s.frame = WCP_ANIM_NAZI_TO_AMERICAN; } else { self->s.frame = WCP_ANIM_AMERICAN_RAISED; } } // Run script trigger if ( self->count == TEAM_RED ) { G_Script_ScriptEvent( self, "trigger", "axis_capture" ); } else { G_Script_ScriptEvent( self, "trigger", "allied_capture" ); } // Play a sound G_AddEvent( self, EV_GENERAL_SOUND, self->soundPos1 ); // Don't allow touch again until animation is finished self->touch = NULL; self->think = checkpoint_think; self->nextthink = level.time + 1000;}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:44,
示例15: multi_trigger// the trigger was just activated// ent->activator should be set to the activator so it can be held through a delay// so wait for the delay time before firingvoid multi_trigger(gentity_t *ent, gentity_t *activator){ ent->activator = activator; if (ent->numPlayers > 1) { gentity_t *tnt; // temp ent for counting players int i; int entList[MAX_GENTITIES]; // list of entities int cnt = trap_EntitiesInBox(ent->r.mins, ent->r.maxs, entList, MAX_GENTITIES); int players = 0; // number of ents in trigger for (i = 0; i < cnt; i++) { tnt = &g_entities[entList[i]]; if (tnt->client) { players++; } } // not enough players, return if (players < ent->numPlayers) { return; } } G_Script_ScriptEvent(ent, "activate", NULL); if (ent->nextthink) { return; // can't retrigger until the wait is over } G_UseTargets(ent, ent->activator); if (ent->wait > 0) { ent->think = multi_wait; ent->nextthink = level.time + (ent->wait + ent->random * crandom()) * 1000; } else { // we can't just remove (self) here, because this is a touch function // called while looping through area links... ent->touch = 0; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:Ponce,项目名称:etlegacy,代码行数:55,
示例16: script_mover_dievoid script_mover_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) { G_Script_ScriptEvent( self, "death", "" ); if (!(self->spawnflags & 8)) { G_FreeEntity( self ); } if( self->tankLink ) { G_LeaveTank( self->tankLink, qtrue ); } self->die = NULL;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:13,
示例17: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn(gentity_t *ent) { spawn_t *s; gitem_t *item; if (!ent->classname) { G_DPrintf("G_CallSpawn: NULL classname/n"); return qfalse; } // check item spawn functions for (item = bg_itemlist + 1 ; item->classname ; ++item) { if (!strcmp(item->classname, ent->classname)) { // found it G_SpawnItem(ent, item); G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); return qtrue; } } // check normal spawn functions for (s = spawns ; s->name ; ++s) { if (!strcmp(s->name, ent->classname)) { // found it s->spawn(ent); // RF, entity scripting if (ent->scriptName) { G_Script_ScriptParse(ent); G_Script_ScriptEvent(ent, "spawn", ""); } return qtrue; } } G_DPrintf("%s doesn't have a spawn function/n", ent->classname); return qfalse;}
开发者ID:boutetnico,项目名称:ETrun,代码行数:47,
示例18: Touch_flagonly_multiplevoid Touch_flagonly_multiple(gentity_t *ent, gentity_t *other, trace_t *trace) { gentity_t *tmp; // Nico, silent GCC (void)trace; if (!other->client) { return; } if (ent->spawnflags & RED_FLAG && other->client->ps.powerups[PW_REDFLAG]) { other->client->ps.powerups[PW_REDFLAG] = 0; other->client->speedScale = 0; tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured"); ent->parent = tmp; } else if (ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[PW_BLUEFLAG]) { other->client->ps.powerups[PW_BLUEFLAG] = 0; other->client->speedScale = 0; tmp = ent->parent; ent->parent = other; G_Script_ScriptEvent(ent, "death", ""); G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured"); ent->parent = tmp; }}
开发者ID:Exosum,项目名称:ETrun,代码行数:38,
示例19: script_mover_usevoid script_mover_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { if(ent->spawnflags & 8) { if(ent->count) { ent->health = ent->count; ent->s.dl_intensity = ent->health; G_Script_ScriptEvent( ent, "rebirth", "" ); ent->die = script_mover_die; } } else { script_mover_spawn(ent); }}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:14,
示例20: target_script_trigger/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen used it will fire its targets*/void target_script_trigger_use(gentity_t *ent, gentity_t *other, gentity_t *activator){ qboolean found = qfalse; // for all entities/bots with this ainame gentity_t *trent = NULL; // Are we using ainame to find another ent instead of using scriptname for this one? if (ent->aiName) { // Find the first entity with this name trent = G_Find(trent, FOFS(scriptName), ent->aiName); // Was there one? if (trent) { // We found it found = qtrue; // Play the script G_Script_ScriptEvent(trent, "trigger", ent->target); } // if (trent)... } // if (ent->aiName)... // Use the old method if we didn't find an entity with the ainame if (!found) { if (ent->scriptName) { G_Script_ScriptEvent(ent, "trigger", ent->target); } } G_UseTargets(ent, other);}
开发者ID:GenaSG,项目名称:etlegacy,代码行数:43,
示例21: target_script_trigger_use/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen used it will fire its targets */void target_script_trigger_use (gentity_t *ent, gentity_t *other, gentity_t *activator ){ gentity_t *player; if (ent->aiName) { player = AICast_FindEntityForName("player"); if (player) AICast_ScriptEvent( AICast_GetCastState(player->s.number), "trigger", ent->target ); } // DHM - Nerve :: In multiplayer, we use the brush scripting only if ( g_gametype.integer >= GT_WOLF && ent->scriptName ) { G_Script_ScriptEvent( ent, "trigger", ent->target ); } G_UseTargets ( ent, other); }
开发者ID:natelo,项目名称:rtcwPub,代码行数:24,
示例22: G_ScriptAction_Trigger/*=================G_ScriptAction_Trigger syntax: trigger <aiName/scriptName> <trigger> Calls the specified trigger for the given ai character or script entity=================*/qboolean G_ScriptAction_Trigger( gentity_t *ent, char *params ){ gentity_t *trent; char *pString, name[MAX_QPATH], trigger[MAX_QPATH], *token; int oldId; // get the cast name pString = params; token = COM_ParseExt( &pString, qfalse ); Q_strncpyz( name, token, sizeof(name) ); if (!name[0]) { G_Error( "G_Scripting: trigger must have a name and an identifier/n" ); } token = COM_ParseExt( &pString, qfalse ); Q_strncpyz( trigger, token, sizeof(trigger) ); if (!trigger[0]) { G_Error( "G_Scripting: trigger must have a name and an identifier/n" ); }// trent = AICast_FindEntityForName( name ); trent = NULL; if (trent) { // we are triggering an AI //oldId = trent->scriptStatus.scriptId;// AICast_ScriptEvent( AICast_GetCastState( trent->s.number ), "trigger", trigger ); return qtrue; } // look for an entity trent = G_Find( &g_entities[MAX_CLIENTS], FOFS(scriptName), name ); if (trent) { oldId = trent->scriptStatus.scriptId; G_Script_ScriptEvent( trent, "trigger", trigger ); // if the script changed, return false so we don't muck with it's variables return ((trent != ent) || (oldId == trent->scriptStatus.scriptId)); } G_Error( "G_Scripting: trigger has unknown name: %s/n", name ); return qfalse; // shutup the compiler}
开发者ID:nobowned,项目名称:rtcw-2.3,代码行数:52,
示例23: script_mover_dievoid script_mover_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) { if ( self->spawnflags & 4 ) { switch ( mod ) { case MOD_GRENADE: case MOD_GRENADE_SPLASH: case MOD_ROCKET: case MOD_ROCKET_SPLASH: case MOD_AIRSTRIKE: break; default: // no death from this weapon self->health += damage; return; } } G_Script_ScriptEvent( self, "death", "" ); self->die = NULL; trap_UnlinkEntity( self ); G_FreeEntity( self );}
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:21,
示例24: target_script_trigger_use/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen used it will fire its targets */void target_script_trigger_use (gentity_t *ent, gentity_t *other, gentity_t *activator ){// gentity_t *player; if (ent->aiName) {// player = AICast_FindEntityForName("player");// if (player)// AICast_ScriptEvent( AICast_GetCastState(player->s.number), "trigger", ent->target ); } // DHM - Nerve :: In multiplayer, we use the brush scripting only if ( g_gametype.integer >= GT_WOLF && ent->scriptName ) {#ifdef OMNIBOT Bot_Util_SendTrigger(ent, NULL, ent->scriptName, ent->target );#endif G_Script_ScriptEvent( ent, "trigger", ent->target ); } G_UseTargets ( ent, other); }
开发者ID:nobowned,项目名称:rtcw,代码行数:27,
示例25: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn( gentity_t *ent ) { spawn_t *s; gitem_t *item; if ( !ent->classname ) { G_Printf( "G_CallSpawn: NULL classname/n" ); return qfalse; } // check item spawn functions for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( !strcmp( item->classname, ent->classname ) ) { // found it // DHM - Nerve :: allow flags in GTWOLF if ( item->giType == IT_TEAM && ( g_gametype.integer != GT_CTF && g_gametype.integer < GT_WOLF ) ) { return qfalse; } G_SpawnItem( ent, item ); return qtrue; } } // check normal spawn functions for ( s = spawns ; s->name ; s++ ) { if ( !strcmp( s->name, ent->classname ) ) { // found it s->spawn( ent ); // RF, entity scripting if ( ent->s.number >= MAX_CLIENTS && ent->scriptName ) { G_Script_ScriptParse( ent ); G_Script_ScriptEvent( ent, "spawn", "" ); } return qtrue; } } G_Printf( "%s doesn't have a spawn function/n", ent->classname ); return qfalse;}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:48,
示例26: multi_trigger// the trigger was just activated// ent->activator should be set to the activator so it can be held through a delay// so wait for the delay time before firing// Nico, note: ent->random is effect less on this entityvoid multi_trigger(gentity_t *ent, gentity_t *activator) { ent->activator = activator; G_Script_ScriptEvent(ent, "activate", NULL); // Nico, #todo: handle case when ent->triggerTime[activator->client->ps.clientNum] = 0 if (ent->wait > 0) { if (activator->client && ent->triggerTime[activator->client->ps.clientNum] + ent->wait * 1000 > level.time) { // Client has to wait before triggering this entity! return; } G_UseTargets(ent, ent->activator); if (activator->client) { ent->triggerTime[activator->client->ps.clientNum] = level.time; } } else { // Nico, #todo: update ent->triggerTime[activator->client->ps.clientNum]??? G_UseTargets(ent, ent->activator); // we can't just remove (self) here, because this is a touch function // called while looping through area links... ent->touch = 0; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEntity; }}
开发者ID:Exosum,项目名称:ETrun,代码行数:28,
示例27: G_Damage//.........这里部分代码省略......... client->ps.persistant[PERS_ATTACKER] = attacker->s.number; } else { client->ps.persistant[PERS_ATTACKER] = ENTITYNUM_WORLD; } client->damage_armor += asave; client->damage_blood += take; client->damage_knockback += knockback; if ( dir ) { VectorCopy( dir, client->damage_from ); client->damage_fromWorld = qfalse; } else { VectorCopy( targ->r.currentOrigin, client->damage_from ); client->damage_fromWorld = qtrue; } } // See if it's the player hurting the emeny flag carrier Team_CheckHurtCarrier( targ, attacker ); if ( targ->client ) { // set the last client who damaged the target targ->client->lasthurt_client = attacker->s.number; targ->client->lasthurt_mod = mod; } // do the damage if ( take ) { targ->health = targ->health - take; // Ridah, can't gib with bullet weapons (except VENOM) if ( mod != MOD_VENOM && attacker == inflictor && targ->health <= GIB_HEALTH ) { if ( targ->aiCharacter != AICHAR_ZOMBIE ) { // zombie needs to be able to gib so we can kill him (although he doesn't actually GIB, he just dies) targ->health = GIB_HEALTH + 1; } }// JPW NERVE overcome previous chunk of code for making grenades work again if ( ( g_gametype.integer != GT_SINGLE_PLAYER ) && ( take > 190 ) ) { // 190 is greater than 2x mauser headshot, so headshots don't gib targ->health = GIB_HEALTH - 1; }// jpw //G_Printf("health at: %d/n", targ->health); if ( targ->health <= 0 ) { if ( client ) { targ->flags |= FL_NO_KNOCKBACK;// JPW NERVE -- repeated shooting sends to limbo if ( g_gametype.integer >= GT_WOLF ) { if ( ( targ->health < FORCE_LIMBO_HEALTH ) && ( targ->health > GIB_HEALTH ) && ( !( targ->client->ps.pm_flags & PMF_LIMBO ) ) ) { limbo( targ, qtrue ); } }// jpw } if ( targ->health < -999 ) { targ->health = -999; } targ->enemy = attacker; if ( targ->die ) { // Ridah, mg42 doesn't have die func (FIXME) targ->die( targ, inflictor, attacker, take, mod ); } // if we freed ourselves in death function if ( !targ->inuse ) { return; } // RF, entity scripting if ( targ->s.number >= MAX_CLIENTS && targ->health <= 0 ) { // might have revived itself in death function G_Script_ScriptEvent( targ, "death", "" ); } } else if ( targ->pain ) { if ( dir ) { // Ridah, had to add this to fix NULL dir crash VectorCopy( dir, targ->rotate ); VectorCopy( point, targ->pos3 ); // this will pass loc of hit } else { VectorClear( targ->rotate ); VectorClear( targ->pos3 ); } targ->pain( targ, attacker, take, point ); // RF, entity scripting if ( targ->s.number >= MAX_CLIENTS ) { G_Script_ScriptEvent( targ, "pain", va( "%d %d", targ->health, targ->health + take ) ); } } //G_ArmorDamage(targ); //----(SA) moved out to separate routine // Ridah, this needs to be done last, incase the health is altered in one of the event calls if ( targ->client ) { targ->client->ps.stats[STAT_HEALTH] = targ->health; } }}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:101,
示例28: G_Damage//.........这里部分代码省略.........// if ((take > 190)) // 190 is greater than 2x mauser headshot, so headshots don't gib // Arnout: only player entities! messes up ents like func_constructibles and func_explosives otherwise if( ( (targ->s.number < MAX_CLIENTS) && (take > 190) ) && !(targ->r.svFlags & SVF_POW) ) { targ->health = GIB_HEALTH - 1; } if( targ->s.eType == ET_MOVER && !Q_stricmp( targ->classname, "script_mover" ) ) { targ->s.dl_intensity = 255.f * (targ->health / (float)targ->count); // send it to the client } //G_Printf("health at: %d/n", targ->health); if( targ->health <= 0 ) { if( client && !wasAlive ) { targ->flags |= FL_NO_KNOCKBACK; // OSP - special hack to not count attempts for body gibbage if( targ->client->ps.pm_type == PM_DEAD ) { G_addStats(targ, attacker, take, mod); } if( (targ->health < FORCE_LIMBO_HEALTH) && (targ->health > GIB_HEALTH) ) { limbo(targ, qtrue); } // xkan, 1/13/2003 - record the time we died. if (!client->deathTime) client->deathTime = level.time; } else { targ->sound1to2 = hr; targ->sound2to1 = mod; targ->sound2to3 = (dflags & DAMAGE_RADIUS) ? 1 : 0; if( client ) { if( G_GetTeamFromEntity( inflictor ) != G_GetTeamFromEntity( targ ) ) { G_AddKillSkillPoints( attacker, mod, hr, (dflags & DAMAGE_RADIUS) ); } } if( targ->health < -999 ) { targ->health = -999; } targ->enemy = attacker; targ->deathType = mod; // Ridah, mg42 doesn't have die func (FIXME) if( targ->die ) { // Kill the entity. Note that this funtion can set ->die to another // function pointer, so that next time die is applied to the dead body. targ->die( targ, inflictor, attacker, take, mod ); // OSP - kill stats in player_die function } if( targ->s.eType == ET_MOVER && !Q_stricmp( targ->classname, "script_mover" ) && (targ->spawnflags & 8) ) { return; // reseructable script mover doesn't unlink itself but we don't want a second death script to be called } // if we freed ourselves in death function if (!targ->inuse) return; // RF, entity scripting if (targ->health <= 0) { // might have revived itself in death function if ((targ->s.eType != ET_CONSTRUCTIBLE && targ->s.eType != ET_EXPLOSIVE) || (targ->s.eType == ET_CONSTRUCTIBLE && !targ->desstages)) { // call manually if using desstages G_Script_ScriptEvent( targ, "death", "" ); } } } } else if ( targ->pain ) { if (dir) { // Ridah, had to add this to fix NULL dir crash VectorCopy (dir, targ->rotate); VectorCopy (point, targ->pos3); // this will pass loc of hit } else { VectorClear( targ->rotate ); VectorClear( targ->pos3 ); } targ->pain (targ, attacker, take, point); } else { // OSP - update weapon/dmg stats G_addStats(targ, attacker, take, mod); // OSP } // RF, entity scripting G_Script_ScriptEvent( targ, "pain", va("%d %d", targ->health, targ->health+take) ); // Ridah, this needs to be done last, incase the health is altered in one of the event calls if ( targ->client ) { targ->client->ps.stats[STAT_HEALTH] = targ->health; } }}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,
注:本文中的G_Script_ScriptEvent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_SetAngles函数代码示例 C++ G_STRINGIFY函数代码示例 |