devolution

Author Topic: scripting problem  (Read 4210 times)

0 Members and 1 Guest are viewing this topic.

Offline MeinName

  • Newbie
  • *
  • Posts: 4
scripting problem
« on: April 27, 2012, 05:27:33 AM »
so... I tried my best to script this game a little bit and was successful at least with one script (a girl you meet in town asks you if her five sisters can also come to your place... just for testing how the whole stuff works...) but now I have a problem with another custom script...

the documentation file says that scripts can trigger when a girl goes shopping...
so I tried to make a script that should have the effect that a girl is mugged on her way shopping and will survive and bring back the possession of the robbers if she has a better combat skill than 30. otherwise she will die...

the only problem: the script isn't even starting...

I tried to put test dialogs in between the code lines to see at which point the script crashes but apparently it doesn't even pass the first...

code (I removed the test dialogs already):

Code: [Select]
INIT
     SetVar(*0*)(*1*)
ENDINIT
IfVar(*0*)(*EqualTo*)(*1*)
     Dialog(*blah blah she got mugged blah blah*)
     Dialog(*blah blah blah*)
     SetVar(*0*)(*2*)
     Restart
EndIf
IfVar(*0*)(*EqualTo*)(*2*)
     IfSkill(*COMBAT*)(*GreaterOrEqualTo*)(*30*)
          Dialog(*blah blah she killed the robbers blah blah*)
          Dialog(*blah blah blah*)
          AddRandomValueToGold(*100*)(*1000*)
          ENDSCRIPT
     Else
          AdjustTargetGirlStat(*HEALTH*)(*-100*)
          Dialog(*blah blah she got killed blah blah*)
          Dialog(*blah blah blah*)
          ENDSCRIPT
     EndIf
Endif

from my point of view this script looks pretty correct...
so i figured that it has something to do with the triggers...
needless to say that I added the script to the global trigger file... but it didn't work

after that I added a small trigger file and the script to the folder of some girls, because I thought that "Shopping" could possibly not be triggered global...
but I was wrong... the script still didn't work :(

so now I'm fairly discouraged, cause I've tried everything I could imagine yet :/

I hope someone can help me...
maybe "Shopping" can't be used as trigger type at all or something I don't know...

(I attached the trigger file from one of the girls' folder. I know that the chance it at 10% but for testing I changed it to 100% and let them go shopping... nothing :()

Offline Aika

  • Full Member
  • ***
  • Posts: 138
Re: scripting problem
« Reply #1 on: April 27, 2012, 06:18:54 PM »
This... looks like a very dangerous script to include in the game. Girls will go shopping if they have a little money, and you're giving them a high chance to get KILLED for it. Beaten and raped I can understand, but adding something like this that can kill a girl for something that is entirely outside of the player's control is BAD.



Offline MeinName

  • Newbie
  • *
  • Posts: 4
Re: scripting problem
« Reply #2 on: April 29, 2012, 10:21:25 AM »
I know that...
But I also thought it would be kind of lore-friendly:
The introduction says Crossgate is a very dangerous city full of evil people, so it seems pretty logic to me that a girl who is roaming the streets on her own has a high chance of getting robbed, wouldn't you agree?


But as a matter of fact I asked for help because the script doesn't work and I really want to get it done, because I think it would add well to the overall-story.


Also one can lower the chance that the script is triggered quite easily so that one would hardly ever notice it...
I just thought it could expand the game by something the player can't control and make it a little more dangerous to give girls free time when they don't have fighting skills above 30.


So... Back to the topic: Can anyone help me out here? I'm stuck!

Offline Aika

  • Full Member
  • ***
  • Posts: 138
Re: scripting problem
« Reply #3 on: April 29, 2012, 12:14:18 PM »
Yes, crossgate is a dangerous place. The player is a prime example of this, having the ability to coerce a girl on the street to work for him, and once she's in his brothel he can easily enslave her. I still don't think it's a good idea to script a girl death event for shopping. She can be robbed, yes. Mugged and raped, yes. But going so far as to have them killed is going too far. You will end up having every girl with less than 30% combat or magic eventually get killed. You can't avoid giving a girl free time, it's important for the girl's continued health. You can't avoid the girl going out shopping once in a while. You're basically killing off a number of the player's girls for something completely beyond the player's control. Yes, while that adds a modicum of realism to the game, it doesn't belong in a GAME.

This is a terrible idea. I'm not going to help.

Offline MeinName

  • Newbie
  • *
  • Posts: 4
Re: scripting problem
« Reply #4 on: April 29, 2012, 04:36:25 PM »
Alright... So you KNOW the solution and are although not going to help me?
That's kind of ridiculous...
I mean:
You doesn't have to care about how I play my games, do you?
So if I want my game a little bit more realistic, you just shouldn't care... I never asked you to take the script and implement it into yours or have I?
Basically I just have a problem with a script. You couldn't care less about its content or at least you shouldn't... I just wrote it down to illustrate what the script should do...


It's a real pity that you don't want to help me but I'm pretty sure that I can also play on without your help...


Maybe I will even find the mistake myself ;)
In that case I will absolutely make up a new thread where one can download tha script (and future scripts) and enjoy your angry face.^^


Love and kisses,
MeinName


:P

Offline Aika

  • Full Member
  • ***
  • Posts: 138
Re: scripting problem
« Reply #5 on: April 29, 2012, 06:56:57 PM »
There's also the somewhat not really minor point that you haven't really given us enough information to be able to help you. It would help if you were to list the entry in GlobalTriggers.xml you're using to try to call the script. The script isn't even firing, so the logical place to look for the error is this entry.

Offline Kenki

  • Newbie
  • *
  • Posts: 35
Re: scripting problem
« Reply #6 on: April 29, 2012, 07:10:53 PM »
@MeinName,

You clearly don't understand the value of a trade. No one is going to help you unless they have something to gain from it. And you have offered nothing of value to compensate time and effort. You are relying entirely on the off chance that someone might actually like a game with the same level of realism that you want.

Unfortunately, I imagine most of us here, have no desire to play a game where our characters will be randomly killed off and there is nothing we can do about it. For the majority of us, this does not add entertainment value to the game. So even if I knew how, I wouldn't waste my time on it.

Now, if you would like to change the goal of the script of something of value, that some of us might actually enjoy to see in the game, you would most likely find help, or at least people willing to help. It just irks me that you go off on Aika like this. Aika doesn't OWE you anything. And he should not waste his time trying to help you, when clearly this is nothing of value in it for him.

Having said all that, I do hope you figure out how to get your script working. At the very least will you feel a level of accomplishment and derive some entertainment value from. Perhaps the lessons learned could be applied elsewhere to add additional entertainment value.

Offline MeinName

  • Newbie
  • *
  • Posts: 4
Re: scripting problem
« Reply #7 on: April 29, 2012, 07:56:50 PM »
I just didn't know it's that way in this forum...
I thought it could be like I experienced it in many other fora: people just help each other...


Alright... So if there's something I can do for you Aika... or for you Kenki, just let me know.


New forum, new rules, new first impressions...

Offline GonDra

  • Full Member
  • ***
  • Posts: 154
Re: scripting problem
« Reply #8 on: April 29, 2012, 08:03:03 PM »
Seriously guys, and I mean everyone here try to be a bit more civil ok?

Yes I too don't like the idea of a script killing a girl, but on the other hand that probably isn't the problem.
As far as I can remember no one has ever written a script with the shopping trigger, and from what i can tell from the game code (I just flew over a few relevant passages) it should trigger but as I am not good with the source of the game, I sadly can't tell if I am correct with that assumption.

I would like to see this script actually working, mostly because it would open the possibilities for other shopping scripts. (For example meeting another girl down on her luck and telling her that you hire every girl willing to work...)

In general I would like to know why you all hung yourself up on something that can be changed easily.
I am disappointed that seemingly no one took the time and reread the post they were about to reply to.

Offline Popuri

  • Full Member
  • ***
  • Posts: 183
Re: scripting problem
« Reply #9 on: April 29, 2012, 08:31:27 PM »
Anyway, script content aside, I can confirm a similar scripting problem as the OP here.  I was scripting for EX at the time, so I'm not sure if this persists in Aika's patch, but I'll dig up my old trigger/script files and try it later.

I was attempting to write a script that triggered if a girl's PCLove stat hit 100, where the girl would approach the player in his office (lair?) and confess their love.  I had planned to have it give an obedience, spirit, and confidence boost.  Similarly, if the player got a girl's PCHate to its furthest extreme, I'd intended to do one where the girl attacked the player (though the worst case scenario would either have her running away with some gold).

Using a trigger xml in the individual girl folder, I was never able to get this script to fire.  And doing it globally, I wasn't 100% sure how to get it to a) trigger on a specific girl and b) to make sure that it could happen with more than one girl, but not have it happen every turn for a girl once she hits 100 PCLove.

I know you have your own plans for scripting in your patch, Aika, but if you build on the existing trigger system, it might be something worth checking out.

Offline Aika

  • Full Member
  • ***
  • Posts: 138
Re: scripting problem
« Reply #10 on: April 29, 2012, 10:49:35 PM »
Anyway, script content aside, I can confirm a similar scripting problem as the OP here.  I was scripting for EX at the time, so I'm not sure if this persists in Aika's patch, but I'll dig up my old trigger/script files and try it later.

I'd imagine FUTURE took this line out of the WorkFreetime.cpp file:

Code: [Select]
int v[2] = {-1,-1};
    girl->m_Triggers.CheckForScript(TRIGGER_SHOPPING, true, v);

That's all I can think of that would prevent shopping scripts from firing in EX.

The syntax for the globaltriggers entry should be something like this:

Code: [Select]
<Trigger Type="Shopping" Chance="X" File="Something.script" />Note: Chance can have a % or not, it doesn't matter; the function that reads the chance trims the % if present. The script file should be in the Resources/Scripts folder.

In the vanilla game, the girl has a 50% chance of going shopping when you give her free time. If she has no money or her inventory is full, it will stop the shopping trip, but it checks this AFTER it runs any shopping scripts. I'll be working that out a little bit better when I tear through the job functions again in my version.

Edit: I just reread Popuri's message.

Use the Set GirlFlag (index) (value) script and the If Girlflag (index) (logical) (value) script. These scripts set variables the game keeps track of on individual girls, so you could have something like this:
Code: [Select]
INIT
Dialog options and stuff
ENDINIT
Ifgirlflag (0) (equalto) (1)
         ENDSCRIPT
ELSE
         Do some stuff
         Setgirlflag (0) (1)
ENDIF
ENDSCRIPT

Or something like that. I'm sure you get the idea. Set it up like this, and set the script up to run globally. The Girlflag is saved to the individual girl. There wouldn't be any way to keep the script from firing every week, but if you use the girlflags like this, the script will terminate without doing anything if it's already been done on the individual girl
« Last Edit: April 29, 2012, 11:26:36 PM by Aika »