World of Gothic Archiv
> NWN-Hilfe Playing-Kids-Script |
|
11.08.2002, 14:29 | #1 | ||
Denyariel Beiträge: 60 |
Playing-Kids-Script
ich habe folgendes script gefunden, aber irgendwie wills net funktionieren obwohl ich (wahrscheinlich eben doch nicht) alles entsprechend eingebaut habe... Vielleicht kann mir mal jemand "für doofe" erklähren WAS ich WO einfügen muss??? Tag-playing kids Want some action on your town/city streets? Here is the code for some kids playing "tag". You need two or more kids with the tag "TAGCHILD" in your area, which have the spawn in condition NW_FLAG_HEARBEAT_EVENT set in their OnSpawn script. Exactly one of them needs to have the local variable "nChasing" set to 1 in the same script: SetLocalInt(OBJECT_SELF, "nChasing", 1); In the custom OnUserDefined script insert the following code in the HEARTBEAT section (nUser==1001). If you don't want them to play the whole time, you can encapsulate the code in some starting condition. NWScript: //tag-playing children by Ralf Schemmann //July 17th, 2002 // //if owner is chasing if (GetLocalInt(OBJECT_SELF, "nChasing") == 1) { //Find kid to chase object oChased = GetNearestObjectByTag("TAGCHILD"); //Is owner close enough to tag? if (GetDistanceToObject(oChased) < 1.0f ) { //Tag and switch roles SpeakString("Tag!"); AssignCommand(oChased, ClearAllActions()); SetLocalInt(OBJECT_SELF, "nChasing", 0); SetLocalInt(oChased, "nTagged", 1); ClearAllActions(); ActionMoveAwayFromObject(oChased, TRUE); } //if still too far away, move after target else { ActionForceMoveToObject(oChased, TRUE, 0.0f); } } //owner is being chased else { //If kid has been tagged, wait a hearbeat then start chasing if (GetLocalInt(OBJECT_SELF, "nTagged") == 1) { SetLocalInt(OBJECT_SELF, "nTagged", 0); SetLocalInt(OBJECT_SELF, "nChasing", 1); } //if not been tagged, run away from chaser or move closer to other kids else { //Find Nearest tag-playing child object oChaser = GetNearestObjectByTag("TAGCHILD"); //if this is the chaser if (GetLocalInt(oChaser, "nChasing") == 1) //run away from chaser ActionMoveAwayFromObject(oChaser, TRUE); else //run after other kid ActionForceMoveToObject(oChaser, TRUE, 8.0f); } } Danke Danke Danke schon mal :) |
||
11.08.2002, 14:41 | #2 | ||
Rhaegar Beiträge: 296 |
Wenn du es da eingebaut hast, wo der Text dir sagt dass es hin soll (also in das onUserdefined Event unter dem entsprechenden Abschnitt) musst du eines noch beachten: Damit der User defined Heartbeat-Event getriggert wird musst du im OnSpawn-Skript der jeweiligen Personen bei folgender Zeile: //SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT); die zwei "comment"-Striche (//) löschen. Ach ja: zum einfügen selbst: 1.)Einfach das OnUserDefinedSkript aufrufen. 2.)Alles löschen 3.)Rechts oben auf Templates/Schablonen klicken und "User Defined Events" anwählen. 4.)wie beschrieben das skript in den 1001 Abschnitt pasten :) ! |
||
|