Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Script for actor  (Read 2851 times)

0 Members and 1 Guest are viewing this topic.

trosa

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 27
    • View Profile
Script for actor
« on: December 11, 2006, 08:31:17 PM »

Hi All,

 what is good way to solve my problem? I have one main actor and one secondary actor. Secondary actor - call him Fred, is usualy walking with main actor through game. And becouse this I need to change associated Fred (actor) script to change in each scene. Becouse in each scene is diferrent dialogues and diferrent actions to do with him.

 Can I for example use in "\actors\fred\fred.script" something like

Code: [Select]
#include "scenes\"+Scene.Name+"\fred.script"

?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Script for actor
« Reply #1 on: December 11, 2006, 08:45:02 PM »

hi. If you really want to do it in separate scripts, you can do it relatively easy.

Basically you don't need these strange includes. You can dynamically attach scripts to your actor (more intelligent approach).
Let's look at this totally untested code:

Code: [Select]
//First we'll check if there is a script attached from the previous scene

if (fred.IsScriptRunning("actors\fred\scripts\"+Game.PrevScene+".script")
{
  // it is attached so we'll put it away
  fred.DetachScript("actors\fred\scripts\"+Game.PrevScene+".script");
}

// We attach new script for our actor fred
fred.AttachScript("actors\fred\scripts\"+Scene.Name+".script");

And then in the folder actors\fred\scripts put separate files named as
your scenes. But I still would think about conceptually different approaches to the whole thing.

But if you want this, it should work. Let me know if this helped.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

trosa

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 27
    • View Profile
Re: Script for actor
« Reply #2 on: December 11, 2006, 09:38:06 PM »

Thanks. I will try it.

I quess that this script will be included from all scenes?

But I still would think about conceptually different approaches to the whole thing.

I'am asking for good approach. ;D Idea above was only my "first shot".

Logged
 

Page created in 0.029 seconds with 23 queries.