Guest RunAwayScientist Posted May 7, 2007 Report Share Posted May 7, 2007 Alright, I need a little scripting help. I've never had such a bad-headache as I do having to test this thing by loading up the game and going through that in trial and error. Anyway, this is what I'm trying to do. I'm looking for a OnAskPerson command. When a police officer goes up to someone and talks to them using AskPerson I want the person to switch behaviour to GANGSTER_ATTACK_ACTION_FORCE and then I'll switch his ObjectPath to some sort of flee path and have him shoot the cop and run off. That's the idea. I could get it to work, if only I knew how to detect if a person has had the AskPerson command used on them. Anyone know of the method I'm looking for?--RunAwayScientist Quote Link to comment Share on other sites More sharing options...
Hoppah Posted May 8, 2007 Report Share Posted May 8, 2007 I want the person to switch behaviour to GANGSTER_ATTACK_ACTION_FORCEA certain person or every person? Quote Link to comment Share on other sites More sharing options...
Guest RunAwayScientist Posted May 9, 2007 Report Share Posted May 9, 2007 No, a person I've already defined in the script. It's just one guy. All I need is the method header, such as OnAskPerson(Object User, Person person) or however it's supposed to go...if there even is a command. If not, I'll just have to find another way to do what I want.--RunAwayScientist Quote Link to comment Share on other sites More sharing options...
Hoppah Posted May 9, 2007 Report Share Posted May 9, 2007 OkHere is the new script (askperson.script):const char NAME_PERSON01[] = "badguy01"; //name of personconst char NAME_ESCAPE01[] = "escapepath01"; //name of escape pathobject AskPerson : CommandScript{ AskPerson() { SetValidTargets(ACTOR_PERSON); SetRestrictions(RESTRICT_NOTARRESTED | RESTRICT_NOTINJURED); SetDeselectCaller(false); SetPossibleCallers(ACTOR_PERSON); SetPossibleExists(CPE_ASKABLE_PERSON); SetPriority(600); SetSelfClickActivation(true); } bool CheckPossible(GameObject *Caller) { /*if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON) return false;*/ Person c(Caller); if (c.IsLinkedWithPerson() || c.IsCarryingPerson()) return false; //return Game::ExistsAskablePerson(); return true; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if(!Caller->IsValid() || !Target->IsValid() || Target->GetID() == Caller->GetID() ) return false; if(Caller->GetType()!=ACTOR_PERSON) return false; Person c(Caller); if (c.GetEnteredCarID() != -1 || c.IsLinkedWithPerson() || c.IsCarryingPerson()) return false; if(Target->GetType()==ACTOR_PERSON) { Person p(Target); if(p.GetRole() == ROLE_GANGSTER || !p.CanBeAsked()) return false; return true; } return false; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_FOLLOW); Caller->PushActionTurnTo(ACTION_APPEND, Target); Person p(Target); if (p.HasName(NAME_PERSON01)) { p.SetRole(ROLE_GANGSTER); p.SetBehaviour(BEHAVIOUR_GANGSTER_ATTACKSQUAD); p.SetEscapePath(PATH_ESCAPE01); p.SetStandardPath(PATH_ESCAPE01); p.SetFleeing(true); return; } Caller->PushActionAskPerson(ACTION_APPEND, Target); } };The first two lines of the script:The name of the person who attacks your squad must be: badguy01The name of the escape path: escapepath01Then I added this to the script:if (p.HasName(NAME_PERSON01)){ p.SetRole(ROLE_GANGSTER); p.SetBehaviour(BEHAVIOUR_GANGSTER_ATTACKSQUAD); p.SetEscapePath(PATH_ESCAPE01); p.SetStandardPath(PATH_ESCAPE01); p.SetFleeing(true); return;}The person role changes to ROLE_GANGSTER, behaviour to BEHAVIOUR_GANGSTER_ATTACKSQUAD.If the police officer is in range he will attack him, otherwise he will escape. So the escape path is added too.Last thing:The ROLE of the bad guy must be civilian, before you are going to "ask" him, because this command doesn't work with ROLE_GANGSTER persons. You can change names and roles in the editor.Hoppah Quote Link to comment Share on other sites More sharing options...
Guest RunAwayScientist Posted May 9, 2007 Report Share Posted May 9, 2007 Great! That was exactly what I was looking for. I can finally finish my officer down mission. Thank you very much. I hope you enjoy playing it when I get to releasing it....sometime in the next few days.--RunAwayScientist Quote Link to comment Share on other sites More sharing options...
Stan Posted May 9, 2007 Report Share Posted May 9, 2007 I'm glad to see some people here thjat play arround with that stuff :1046275747_biggthumpup: from me Quote Link to comment Share on other sites More sharing options...
Guest RunAwayScientist Posted May 9, 2007 Report Share Posted May 9, 2007 Thanks to Hoppah I've almost got it working. I have to tweak a few settings and play test it some more until I'm sure it's right. So, I think I'll be releasing this in about maybe one more hour. It's pretty much good to go.--RunAwayScientist Quote Link to comment Share on other sites More sharing options...