Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Increasing a global variable?
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#1
[SOLVED] Increasing a global variable?

**Check last post for current issue**

So I have a bit of a problem. All of a sudden my static objects won't show up in their designated position, they don't even show up at all. From the look of it, only SO are affected because entities are visible. Does anyone know what the problem is? Is it occluders perhaps?

How it looks In-Game:
Spoiler below!

[Image: cAIE16p.png]


How it looks in MapView/LevelEditor:
Spoiler below!

[Image: IJkwhxV.png]

[Image: vcf8mtu.png]


"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 04-10-2016, 12:39 AM by i3670.)
03-30-2016, 06:56 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Static_Objects don't appear?!

Could be a difference in the main folder's resources.cfg compared to your mod's resources.cfg. Your mod uses yours (obviously), but the editors I believe always use the main one.

You can also check the hpl.log for errors of why it didn't load.

(This post was last modified: 03-30-2016, 10:03 PM by Mudbill.)
03-30-2016, 10:02 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#3
RE: Static_Objects don't appear?!

Hmm, solved itself somehow...thanks anyway Smile

"What you think is irrelevant" - A character of our time

A Christmas Hunt
04-03-2016, 11:06 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#4
RE: Static_Objects don't appear?!

Didn't want to make a new thread for this question.

How do globals work in SOMA? I have this script where I need to keep track of how many entities (c_part_xx) there are in the area. But I have no idea what the code is for increasing a global's value.

It's not really an looking-for-error-mistake. It's more of an I-don't-know-the-right-code. The cScript_SetGlobalVarInt works and the cScript_GetGlobalVarInt, but not the cScript_AddGlobalVarInt (presumably because it doesn't exist)

Spoiler below!

void OnStart()
{
Map_AddTimer("Timer_Power_Off", 3.0f, "Timer_Power");
Map_AddTimer("Timer_Power_On", 3.5f, "Timer_Power");

cScript_SetGlobalVarInt("LocalVarComputer", 0);
}

bool AttachComputerPart_Func(const tString &in asStickyArea, const tString &in asBodyName)
{
cScript_AddGlobalVarInt("LocalVarComputer", 1);

if(cScript_GetGlobalVarInt("LocalVarComputer") == 5){
for(int i=1;i<=9;i++){
Entity_SetInteractionDisabled("c_part_"+i+"", true);
}
}

return true;
}

bool DetachComputerPart_Func(const tString &in asStickyArea, const tString &in asBodyName)
{
cScript_AddGlobalVarInt("LocalVarComputer", -1);
return true;
}






"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 04-08-2016, 02:18 PM by i3670.)
04-08-2016, 02:17 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: [SOLVED] Increasing a global variable?

If the "Add" script is lacking, you could always do it with something like this:

PHP Code: (Select All)
cScript_SetGlobalVarInt("LocalVarComputer"cScript_GetGlobalVarInt("LocalVarComputer") + 1

Better yet, if this is something you use a lot, create your own quick function for it:

PHP Code: (Select All)
void cScript_AddGlobalVarInt(string varNameint valueToAdd) {
    
cScript_SetGlobalVarInt(varNamecScript_GetGlobalVarInt(varName) + valueToAdd);


Then you can use the code you originally had by just including this function somewhere in your file (or a global.hps if there is one). I haven't tested any of this in SOMA so it might be preferrably done differently.

(This post was last modified: 04-10-2016, 01:34 PM by Mudbill.)
04-10-2016, 01:29 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#6
RE: [SOLVED] Increasing a global variable?

Might work. I bypassed the problem by using GetCollide instead. But this will come in handy in the future I'm sure.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 04-10-2016, 03:02 PM by i3670.)
04-10-2016, 03:02 PM
Find




Users browsing this thread: 1 Guest(s)