Aller au contenu

Photo

Appeal for help from a rubbish scripter


  • Veuillez vous connecter pour répondre
36 réponses à ce sujet

#1
Clyordes

Clyordes
  • Members
  • 300 messages
Hello all you clever people out there!  I find scripting a completely closed book at the moment.  Maybe if I really tried I might get my head round it, but at the moment it all looks like gobbledigook, so I tend to use Lilac Soul's script generator, which so far has sorted out all of the scripts I need successfully. Posted Image

Except two.Posted Image

First one is a script that sets up an ambush:
I'd like the following to happen -
As soon as characters attack a given door, 3 NPC's - A, B & C - hear the noise & move from their bedrooms to set waypoints - 1,2 & 3 - one either side of the door on the other side & one in the centre of the room (to draw the PC's attention away from the rogues just about to backstab them when they charge in to attack the lowly fighter they see).

It doesn't sound too tricky, but so far I've not managed to create a script that works.  I've tried creating them in Lilac Soul's creator & attaching the script to both the door's on attacked, On damaged & even On death script functions, but the NPC's stay holed up in their rooms come what may.



Second one is sort of similar:
I have a group of 4 guards in a room the PC's enter via a corridor.  On seeing the PC's, or when attacked by them, I want one of the group (tag "guard_a") to run to the barracks area, through a closed, but not locked door, and move to a waypoint ("guard_a_wp_1").  When he gets there, I want the 8 reinforcement guards (all 8 with the same tag) to come out of their rooms and run with "guard_a" to a waypoint in the main area where the PC's should still be fighting the remaining 3 initial guards.

Again, I'm sure it must be straightforward, and I've created a script in Lilac Soul & put it in the "On attacked" & "On perceived PC" (I think its called - whichever is the one that looks like its called when the monster sees the PC), but the guard refuses to leave his buddies & get help.


Does anyone out there who understands scripting much better than me know of a script that does that?

#2
PJ156

PJ156
  • Members
  • 2 980 messages
A quick question CL before the scripters come in to help.

Are there closed doors in the way of the movement. I found that lilac soul will move npc's but they won't open doors. might it work if you add a line in your script to open said doors first?

PJ

Modifié par PJ156, 30 décembre 2010 - 10:58 .


#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I'm not at the toolset right now and cant whip up a script from scratch, but let me encourage you to investigate becoming more acquanted with scripting. Based on the way you word your post, you already seem to understand the basic logic of scripting and now all you need is a little vocabulary (most of which is helped by the script assist in the toolset). May I recommend "Scripting for Noobs" by Knightmare : Link:



http://nwvault.ign.c...s.Detail&id=124



or NWN2Scripting Link:



http://nwvault.ign.c...ls.Detail&id=61



Both of these tutorials are excellent. I have used both and was able to script fluently in just a week or so of trying. This problem you are presenting is an excellent chance to get scripting under your belt. Once you can script, you can do almost anything.

#4
Clyordes

Clyordes
  • Members
  • 300 messages
Hi PJ - thanks - you might be on to something there - both scripts require NPCs to travel through closed doors, while other similar scripts that call for NPC's to move to waypoints but don't involve doors work fine - I'll see if I can get to take a look later & will advise.


#5
Clyordes

Clyordes
  • Members
  • 300 messages
@ M.Rieder - You're right, I really should knuckle down & learn how to do it properly. I'll definitely have a look at those tutes (I think I've downloaded at least one of them already, but haven't opened it). My biggest problem is time - and being interested in too many different things! Still, once the schools go back next week, I should have time on tuesdays to spend an hour or two learning how to do this properly. Seeing Lilac Soul's scripts working has given me a fair idea of how the syntax works in some scripts, but setting one up from scratch - even with the assistant is still a bit beyond me - although scripting in conversations, with the "Pick your script & fill in the blanks in the labelled boxes" approach is wonderful!! Real shame scripting in the rest of building doesn't follow the same approach, but I'll get there.



Thanks for the encouragement - at this rate, the new module will be uploaded in a few days.



Cly.

#6
PJ156

PJ156
  • Members
  • 2 980 messages
Look forward to that CL, the first of the new year perhaps?

PJ

#7
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Clyordes wrote...

@ M.Rieder - You're right, I really should knuckle down & learn how to do it properly. I'll definitely have a look at those tutes (I think I've downloaded at least one of them already, but haven't opened it). My biggest problem is time - and being interested in too many different things! Still, once the schools go back next week, I should have time on tuesdays to spend an hour or two learning how to do this properly. Seeing Lilac Soul's scripts working has given me a fair idea of how the syntax works in some scripts, but setting one up from scratch - even with the assistant is still a bit beyond me - although scripting in conversations, with the "Pick your script & fill in the blanks in the labelled boxes" approach is wonderful!! Real shame scripting in the rest of building doesn't follow the same approach, but I'll get there.

Thanks for the encouragement - at this rate, the new module will be uploaded in a few days.

Cly.


Best of luck.  Look forward to seeing it.  Have you considered posting a release announcement thread in the modules forum.  I dont' remember seeing one.

#8
Clyordes

Clyordes
  • Members
  • 300 messages
Good idea, and I've just noticed that I only need 2 more votes on my previous project (Search for the temple of the golden spire) before its eligible to show up in the mighty Top Modules lists!



Only taken a year :-(


#9
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
May I recommend that you put a link to your vault submissions in your signature. Also put it in your signature on the vault. That way, every time you poste here or on the vault, you advertise your mod. People are always looking for mods to play and once you are off the new mod's list it's hard to be seen. I never new that "Temple of the Golden Spire" existed.



Advertise,Advertise,Advertise! It takes too long and too much work to put out a module for it to go unnoticed! Be shameless!

#10
Clyordes

Clyordes
  • Members
  • 300 messages
Thanks for the advice M., have had a bash at my sig here & will re-do the vault sig in a mo.



Just in case you can help, I'm working on the scripts right now -

I'm thinking I need to use the script: ActionMoveToObject(object oMoveTo, int bRun=FALSE, float fRange=1.0f);



Only problem is I haven't a clue where to insert the tag of the guard who needs to go & alert his buddies "cult_guard1" or the tag of the waypoint he's to run to "guard_wp", or how to make him run (do I just change FALSE to TRUE?, or do I need to add brackets () somewhere too?) & how do I use this float business? I understand that its how close he needs to the WP, but I don't know if it needs brackets, an extra line, etc.



I've tried wandering around the NWN2 wiki, script lexicon & anywhere that was easily accessible, but nowhere gives an example of a finished script so I can compare it against the template.



Any quick help would be very gratefully received, in the mean time, I'll take a look at some other mods in the toolset & see if I can figure it out.

#11
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
If you want a specific guard to move to a specific location, use something like this:



AssignCommand(GetObjectByTag("GUARD_TAG_HERE"), ClearAllActions(TRUE));

AssignCommand(GetObjectByTag("GUARD_TAG_HERE"), ActionMoveToLocation(GetLocation(GetWaypointByTag("WAYPOINT_TAG_HERE")), TRUE));

#12
Clyordes

Clyordes
  • Members
  • 300 messages
Thanks Chaos, does a door (closed, not locked) stop them?

Also - I've just tested it & the guard speaks a line that he's going to get help, and turns to run, but then turns back to the PC & attacks them again - any ideas?



Also - where does the command to make them run go? or is that the finall ", TRUE))" bit of the script above?

#13
Clyordes

Clyordes
  • Members
  • 300 messages
I've also just noticed that only one guard comes to help, although there are 8 of them, all with the same tag, in 2 different rooms.

On the good side, the script makes the appropriate doors open OK

#14
SkywingvL

SkywingvL
  • Members
  • 351 messages
You would need to iterate over all objects with the same tag if you wanted to act on all of them (via calling GetObjectByTag/GetObjectByTagAndType with an incrementing nNth argument until INVALID_OBJECT is returned.

#15
_Knightmare_

_Knightmare_
  • Members
  • 643 messages

Clyordes wrote...

Only problem is I haven't a clue where to insert the tag of the guard who needs to go & alert his buddies "cult_guard1" or the tag of the waypoint he's to run to "guard_wp", or how to make him run (do I just change FALSE to TRUE?, or do I need to add brackets () somewhere too?) & how do I use this float business? I understand that its how close he needs to the WP, but I don't know if it needs brackets, an extra line, etc.

I've tried wandering around the NWN2 wiki, script lexicon & anywhere that was easily accessible, but nowhere gives an example of a finished script so I can compare it against the template.

Any quick help would be very gratefully received, in the mean time, I'll take a look at some other mods in the toolset & see if I can figure it out.


As M. suggested above, you should check out my tutorial (linked in sig below). It is written for those in just your situation - people who know nothing (or next to nothing) about writing their own scripts. Its written in very basic, every-day language and should allow you to start understanding the basics of scripting. Shouldn't take all that long to read through it. There plenty of complete script examples in there, including a line-by-line breakdown of an example script along with an explaination of what each line means/does.

#16
Clyordes

Clyordes
  • Members
  • 300 messages
Thanks Knightmare - have just downloaded it & if work stays quiet today, will have a good chance to look through it, shame I haven't got access to the toolset at work, but its better than nothing.



Sorry sky - that went a tad over my head - "iterate over all objects" - I'm sure means something straightforward, but right now, it could be a line of wingdings! :-)



Not to worry, I'll definitely get this sorted - I've virtually finished the mod, all that's left to do is the following:

1. These 2 scripts (& the fighter & 2 rogues one is just about working now I've built into it a line opening the doors that were in the way, I just need them all to run now - seems Lilac Soul's generator can't do that).

2. A custom made rod that when used (or equipped, I'm happy with either) opens a convo that offers to teleport the party back to either of the 2 patrons of the adventure

3. Fix a weird bug that I noticed for the first time last night. For some reason, bits of water in the dungeon - but not all of it - have vanished, but its only gone when I turn off the lights by unticking the "Directional lighting" (I think) tag (I like X-files type gloomy lighting! - does that sound like corruption's crept in? Any ideas how to fix that? I'm thinking that I'll have to re-draw all of the water - lots of small & big pools.

#17
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
For #2 - do a google search for "nwn2 tag based scripting." EDIT: Here's a link http://www.noobscorn...cs.htm#TBS_nwn2

For #3 - water needs a light source in order to render in game. The water you put down is still there, just "invisible." Turn the directional lighting back on and it should reappear. You can change the lighting to a black color if you want it dark, but that will still alllow the water to show up.

Also, what Skywing meant by "iterate over all objects" is what I call "looping through objects" in my tutorial.

Modifié par _Knightmare_, 02 janvier 2011 - 02:24 .


#18
Clyordes

Clyordes
  • Members
  • 300 messages
Thanks Knight - just what I needed :-)



I had a bash at creating a couple of tag based scripts in Goldenspire & they worked as well as they were supposed to - first time (I was a bit amazed!). Last night I was in a bit of a rush to create the magic rod to teleport the party back & didn't realise that you couldn't "activate" a rod - so an xxx.ac script (if that's what I saw in my notes) didn't work to trigget the conversation. I changed it to one that should fire on equipping, but haven't had chance to test it yet. That link will no doubt be handy though.



Re water - I have a feeling you're right - the water shows in some tiles, but not in others that make up the same room (same pool of water too - producing an odd cut off look), but it may be because of the radius of the local light sources I've placed? Either wasy I'll play with the light settings - I've never really toyed with them yet, so that's another little closed book to open up.



And thanks for the reference to Skywing's terminology - I'll definitely check that out.



Now I just need some time - anyone invented a working time machine yet?!



Cly.

#19
Orion7486

Orion7486
  • Members
  • 161 messages
If you haven't gotten the guard running for help working, perhaps make him a custom faction, so he won't go hostile with the others. Then, you won't have his combat AI getting in the way. Once he's gathered his friends, move them towards the players, and then turn them hostile.

#20
Clyordes

Clyordes
  • Members
  • 300 messages
Of course, that'll work fine!

You folk out there are awesome, what a community! And for a game that's x years old too - fab to know there's so much help out there.



Now, about that time machine...

#21
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages

Clyordes wrote...
... didn't realise that you couldn't "activate" a rod - so an xxx.ac script (if that's what I saw in my notes) didn't work to trigget the conversation. I changed it to one that should fire on equipping, but haven't had chance to test it yet.


You have that backwards. Rods can be activated, they cannot be equipped.

My King's Festival Campaign includes a debug item called debug_travelgem that launches a conversation that allows teleporting. It might help with what you are doing.

Regards

#22
Clyordes

Clyordes
  • Members
  • 300 messages
Crivens! I think I see what you mean - I think I must have set the base object as something that can be equipped, but not activated, isn't the default item a short sword?

#23
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
I always copy an existing blueprint rather than creating from scratch. So if I am creating a rod then I would copy the blueprint of one of the existing rods and then edit it. This method prevents a lot of errors. As a result though, I have no idea what the default item would be if creating an item from scratch.



Regards

#24
Clyordes

Clyordes
  • Members
  • 300 messages
Thanls Kaldor, I've tried the same using a rod of terror & copying what looked like the properties that you'd set for your travel gem, but for some reason, its not showing as useable when I have it in my inventory or equip it - must be missing something obvious (like the right script probably!) - hopefully will get some time later to work on it.



On the good side - the ambush script works fine now - both rogues & the fighter run to their wayponts as the door's being damaged as planned, although one of the rogues is a bit slow, which is odd as they both have the same instructions in the script.



All the water's now visible in the 3 levels of the dungeon - many thanks to Knighmare for help on that one - I've never played with the light settings before, but I almost understand that too now!



The other script is still proving a tad pesky - the guard who's supposed to get reinforcements announces what he's going to do, runs to the door & opens it, but then it goes a bit wrong.



He's supposed to head to a waypont & open a door to the barracks, just as the other barracks doors open via the script & the reinforcements & him all head back to a waypoint in the initial room - hopefully before the party has beaten all of the first group of guards. He should then turn hostile & join in the attack.



What's happening after he opens the door is that he turns round straight away & turns hostile - for some reason he's skipping the next part of the script.



As for the reinforcements, although I've called them all individually via the script (they've all got different tags now) to head to the inital room waypoint (tried seperate waypoints too), only one of them is leaving the barracks rooms.



I've used the script suggested above for each guard - AssignCommand(GetObjectByTag("GUARD_TAG_HERE"), ActionMoveToLocation(GetLocation(GetWaypointByTag("WAYPOINT_TAG_HERE")), TRUE));



in case that helps

#25
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Can you post the entire script(s) that are not working correctly? It will help us to help you. When asking about non-working scripts, it's a good habit to always post what you have so far, working or not. :)