Targets *GetAllActors(Scriptable *Sender, int ga_flags)
{
	Map *map = Sender->GetCurrentArea();

	int i = map->GetActorCount(true);
	Targets *tgts = new Targets();
	while (i--) {
		Actor *ac = map->GetActor(i,true);
		int dist = Distance(Sender->Pos, ac->Pos);
		tgts->AddTarget((Scriptable *) ac, dist, ga_flags);
	}
	return tgts;
}
Beispiel #2
0
Targets *GameScript::SelectedCharacter(Scriptable* Sender, Targets* parameters, int ga_flags)
{
    Map *cm = Sender->GetCurrentArea();
    parameters->Clear();
    int i = cm->GetActorCount(true);
    while (i--) {
        Actor *ac=cm->GetActor(i,true);
        if (ac->GetCurrentArea()!=cm) {
            continue;
        }
        if (ac->IsSelected()) {
            parameters->AddTarget(ac, Distance(Sender, ac), ga_flags );
        }
    }
    return parameters;
}
Beispiel #3
0
Targets *GetAllActors(Scriptable *Sender, int ga_flags)
{
	Map *map = Sender->GetCurrentArea();

	int i = map->GetActorCount(true);
	Targets *tgts = new Targets();
	//make sure that Sender is always first in the list, even if there
	//are other (e.g. dead) targets at the same location
	tgts->AddTarget(Sender, 0, ga_flags);
	while (i--) {
		Actor *ac = map->GetActor(i,true);
		if (ac != Sender) {
			int dist = Distance(Sender->Pos, ac->Pos);
			tgts->AddTarget(ac, dist, ga_flags);
		}
	}
	return tgts;
}
Beispiel #4
0
//i was told that Group means the same specifics, so this is just an
//object selector for everyone with the same specifics as the current object
Targets *GameScript::GroupOf(Scriptable *Sender, Targets *parameters, int ga_flags)
{
    Actor *actor = (Actor *) parameters->GetTarget(0, ST_ACTOR);
    if (!actor) {
        if (Sender->Type==ST_ACTOR) {
            actor = (Actor *) Sender;
        }
    }
    parameters->Clear();
    if (actor) {
        ieDword tmp = actor->GetStat(IE_SPECIFIC);
        Map *cm = Sender->GetCurrentArea();
        int i = cm->GetActorCount(true);
        while (i--) {
            Actor *target=cm->GetActor(i,true);
            if (target && (target->GetStat(IE_SPECIFIC)==tmp) ) {
                parameters->AddTarget(target, 0, ga_flags);
            }
        }
    }
    return parameters;
}
Beispiel #5
0
Targets *XthNearestEnemyOf(Targets *parameters, int count, int ga_flags)
{
	Actor *origin = (Actor *) parameters->GetTarget(0, ST_ACTOR);
	parameters->Clear();
	if (!origin) {
		return parameters;
	}
	//determining the allegiance of the origin
	int type = GetGroup(origin);

	if (type==2) {
		return parameters;
	}
	Map *map = origin->GetCurrentArea();
	int i = map->GetActorCount(true);
	ga_flags |= GA_NO_UNSCHEDULED;
	while (i--) {
		Actor *ac = map->GetActor(i,true);
		if (ac == origin) continue;
		int distance;
		//int distance = Distance(ac, origin);
		// TODO: if it turns out you need to check Sender here, beware you take the right distance!
		// (n the original games, this is only used for NearestEnemyOf(Player1) in obsgolem.bcs)
		if (!DoObjectChecks(map, origin, ac, distance)) continue;
		if (type) { //origin is PC
			if (ac->GetStat(IE_EA) >= EA_EVILCUTOFF) {
				parameters->AddTarget(ac, distance, ga_flags);
			}
		}
		else {
			if (ac->GetStat(IE_EA) <= EA_GOODCUTOFF) {
				parameters->AddTarget(ac, distance, ga_flags);
			}
		}
	}
	return XthNearestOf(parameters,count, ga_flags);
}