• Announcements

    • Ashal

      SITE MOVED - IN READ ONLY MODE   12/08/2015

      Please use http://www.loverslab.com moving forward. Site has been restored to a previous version, and this one placed into a read-only mode. This is available for a limited time so users may reference/copy content that has been lost in the transition. This will no longer be accessible by December 22nd, 2015.
Halstrom

Fallout New Vegas GECK / Scripting Help 101

2,597 posts in this topic

Ah balls, I have to retract that a bit. It IS in the engine, somewhat. GetKeyName is calling an internal function that looks in some game data structure that has two unknown fields. It's doing this (I think) because of key 'names' for different languages, on non-alphanumeric keys, like 'enter' and 'shift'.

It would be really easy to change this function to use the built in windows function. If jaam is still watching, he can handle that, or I can take a crack at it.

0

Share this post


Link to post

Yeah I told you :) If it was NVSE, I wouldn't feel so sick. It is the game, since I have the same exact wrong mapping when I manually decide the key mapping inside the options of the game (there's a specific sub-menu, something like main menu - Controls - Decide your keys: I press Y and Z appears...). English version is already downloading, I really bet it will solve this...


And I think the game stills take some setting from Windows, because in console I write correctly, if you think. But not in game. But console IS in game. But not that part of the game. Insane...


PS I also tried my old keyboard (PS2 instead of USB), just to be sure, but it's the same. Also, I just had confirmation from another IT player: he too had to take items in containers with A instead of Q.


0

Share this post


Link to post

You might find this useful: GetControl - returns the scan code for an action (eg: move forward), you can combine that with GetKeyPress to support multiple languages correctly.


 


Perhaps the Italian and French versions were made by the same team, maybe in America and they fucked up and didn't realise Italy doesn't use AZERTY. I don't have much faith in the localization team(s?).


0

Share this post


Link to post

I think it would be pretty simple to fix this with NVSE by just editing that table. Would fix that function and the controls menu both I believe.

0

Share this post


Link to post

Odessa, to make my tries, I already mapped via script the keyboard differencies (so you can set some var which chooses the keyboard). Anyway,  I still think it doesn't make completely sense, this damn bug, I guess you can see my point of view... who can really say how many countries have this "issue"? My english NV is at half download on steam, if it will solve my issues I'm going to screw and forget IT version. Let's see pros and cons. Pros: it probably will solve that, it will solve the misplaced IDs vs american people, I'll be able to install TTW... Cons, I won't be able to hear anymore those annoying wrong translations of dialogues. Oh, that should stay in the Pros ;) yeah, I guess that's a good moment to stop being patriotic!!! ^_^


0

Share this post


Link to post

I think I found it. I can't test it since my Steam is re-downloading NV and it will have to do that for maaany days. However, fortunally I can still launch the GECK...


 


Aaaand... browsing all these strings (where I've found all my AZERTY mapping), I also found one of the strings was translated in french... this would confirm me thinking that they did a mess mixing countries and languages...


post-165499-0-51013000-1410513311_thumb.

post-165499-0-74075700-1410513731_thumb.

0

Share this post


Link to post

Hah.. chalk up another "win" for the stunning team over there. If it was all language typos and not so many engine bugs, we'd all be better off. Too bad they can't get *anything* right. ;)

0

Share this post


Link to post

As expected, English version solved the issue, and now I have a QWERTY...


0

Share this post


Link to post

I've heard that reference walk doesn't work for inventory objects in Actor's inventory. Can I somehow scan the items which are located in actors inventory?


0

Share this post


Link to post

Use the inventoryRef set of function, or use a foreach loop on a container like an actor.


 


0

Share this post


Link to post

GetInvRefsForItem creates temporary references to an item in a container, so you can use it for a reference function.

 

You can use GetInventoryObject and a while loop, or as jaam suggested, foreach, which I didn't realize was possible before. This is what OBSE says about it though:

 


For containers, item is a ref variable. See the section on Inventory References for details on the usage.
(nothing) ForEach iterator:ref_var <- sourceContainer:ref

---

I think GetFirstRef (/similar) only scan the cell, not containers- so using '201' returns all the references in the cell that can be picked up. This is just a guess.

0

Share this post


Link to post

The foreach loop should be the easiest if you want to scan the whole inventory, otherwise the pair of GetFirstRefForItem/GetNextRefForItem, but you have to know what you are looking for.


 


 


0

Share this post


Link to post

Thanks Odessa, jaam it works.



Scriptname LunetteDropItemsQuestFunction


int ItemCounter
int ItemNum
ref Item

Begin Function {}
printC "begin Function"

        let ItemNum := LunetteRef.GetRefCount
          Print "Lunette has " + $ItemNum + "Items"

        foreach Item <- LunetteRef
          Print "Item is " + $Item
        loop

printC "FunctionEnded"
end

By the way both of these syntaxes work



if gettype Item == 40
PrintC "item is a weapon1"
endif

if item.gettype == 40
PrintC "item is a weapon2"
endif

0

Share this post


Link to post

yep, I think it's a high time.


 


EDIT: Already tired of solving puzzle every time I want to change something


0

Share this post


Link to post

A couple of doubts that came into my mind. PROBABLY the engine handles it, but... I don't know.


 


And this one probably is for those who know the engine's mechanics deeply. If a script does some (let's say) "active actions" on a null ref, it will probably lead to a CTD. But what happens if a script does the same to a ref which is a killable creature/actor, after their death and after some days, when the corpse is despawned? Does marking as Persistent Ref helps to avoid issues? Is a Persisten Ref really persistent even after death or it is cleared as a dynamic ref?


 


Also, how much the "No Low Level Processing" affects the game's prestations? Someone knows if there's a way to activate that flag via script in a specific moment, so to reduce the impact on the performances?


0

Share this post


Link to post
Also, how much the "No Low Level Processing" affects the game's prestations? Someone knows if there's a way to activate that flag via script in a specific moment, so to reduce the impact on the performances?

 

NVSE allows you to change actor flags. I think you need to figure out which # goes for "low level processing"

If you want to avoid gamemode scripts you can always use quests\tokens\spells. I don't think that without gamemode block script "high level processing" NPC take much CPU power

0

Share this post


Link to post

Not the scripts, but their behaviours. When you have a crowded zone, the game starts stuttering. Of course graphic (when an actor is rendered, when he moves / fights / shots etc.) influences a lot, but I'm wondering if even their behaviours slowdown.


 


I need to explain the situation, because it's blurry in this way...


I have some npcs which are alarmed via radio if their leader is attacked. Of course it's "fake", it's a script that triggers a guard package on them in case the leader is under attack, so they'll move to reach him because the package has a 512 range.


 


Problem is, they are some cells far away. If I don't flag that, they won't come. They probably will come if I go closer to them first, so that they render, and then I attack the leader. Instead, if I check that flag, they will come. This is what came out from my tests.


 


This, for me, means that flag allows their behaviours to be processed even if they're not rendered, like they sandbox etc.etc. even if I don't see them. So I must check that.


 


Now, you know, when you are with a crowd of people, your game can stutter, you easily notice it when you install those mods that increase people around the Mojave. Of course if they are rendered, if there's some graphic involved, that will slowdown, it's pretty obvious. But what I'm wondering here is if the fact their behaviours are processed but not their graphic (I still didn't get close to them) could still stutter the game. I personally have not slowdowns, but I'm playing vanilla and this quest scripts are becoming a bit long to handle, I have a lot of gamemodes, so I'm trying to find any possible ways to optimize everything I can...


 


So, to open a parenthesis about optimization, I would like to introduce this new question too. I often use quest vars on fake quests, just to store values, and I know they work even if the quest isn't running. But what about Gamemodes? God, I can't really remember this... -_- Does a gamemode stops cycling if I stopquest?


0

Share this post


Link to post
Does a gamemode stops cycling if I stopquest?

stopquest MyQuest stops MyQuest (gamemode block)

 

but completequest MyQuest  doesn't. (made that mistake sometime ago)

 

Maybe you should move your goons somewhere close to player then? Make a few markers and spawn goons depending on where player character is in case you have leader walking around. Or create new NPC and disable old ones. Or...

0

Share this post


Link to post

Thanx, I had really a blank hole in my mind about Gamemodes.


By the way, I thought to a trick for these scripts.


After the gamemode script is completed and working, it wouldn't be bad to hide EVERYTHING behind a If Getquestrunning myquest condition, since the script is useful only if I will start the quest, and it will stop when the quest is completed. However, it is a If - else block which is long 300+ lines, I'm not sure if they can be that long... EDIT: mmmh, still need to think about it, it seems dumb


 


About goons, unfortunately they can't be closer. It's a worldspace, so they are all scattered around. Some are in internal cells too. My idea was to flag them via script when GetInWorldspace, so that "theoretically" they all were spawning only the moment I was entering that new place, and not influencing game prestations in other places like Mojave. For now I will leave them in this way, let's see if in the future I'll find how to handle a flag like that


0

Share this post


Link to post
After the gamemode script is completed and working, it wouldn't be bad to hide EVERYTHING behind a If Getquestrunning myquest condition, since the script is useful only if I will start the quest, and it will stop when the quest is completed. However, it is a If - else block which is long 300+ lines, I'm not sure if they can be that long.

Don't know why would you do that instead of just stopping the quest.

 

About goons, unfortunately they can't be closer. It's a worldspace, so they are all scattered around. Some are in internal cells too. My idea was to flag them via script when GetInWorldspace, so that "theoretically" they all were spawning only the moment I was entering that new place, and not influencing game prestations in other places like Mojave. For now I will leave them in this way, let's see if in the future I'll find how to handle a flag like that

hm.. Maybe if they are disabled when quest has not started\already ended would make it easier for CPU to proceed them.

0

Share this post


Link to post

For 1) what you wrote is essentially why I erased saying it was dumb :) it was mainly because I tend to stick with Start Game Enabled quests since I had problems in the past in them not firing correctly all the times. However another secondary quest with script could run a gamemode that checks continuously the state of the quest, but... I'll see.


And for 2) you are right, it deserves an attempt. Such an easy solution that I completely didn't think about it :-O thanx


0

Share this post


Link to post

Quick question about variables, can you set them when defined? I'm assuming of course it would overwrite every execution of the script, it seems to allow it to be written but haven't tested it, just thought it might save me a dozen Set statements and keep the parameters on the first script page.

eg

float fLengthDays 280

ref rOutfitAdded HatParty

0

Share this post


Link to post