Coding Winter Survival gamemode

Here’s a question: Does anyone have a working version of Winter Survival gamemode? If not, then someone can recode or both?

How to view LUA error log?

You could go onto garrysmod.org and download the one on there, but I have no clue how compatible with gmod13 it is.

As for an error log I personally just use a dedicated server so I see all the serverside errors on a separate cmd window.
And as for clientside, well you can just open the console in gmod using the ~ button(if you have the dev console enabled from your options menu in gmod)

I downloaded from there, but it does not work. I read the wiki and made changes where something (as in the article “Creating a gamemode”). Do not need to do anything? And so he will work?

I’m sorry I’m not fully understanding you, you went onto the wiki and read the article on creating a gamemode and then what?

Also there is a huge list of functions and such that changed going from gmod12 to gmod13. It explains how args and names changed. What kinda errors are you getting? What’s happening when you connect? What are you using to test the gamemode out? (dedicated server, singleplayer ect.)

I just Russian I have to use a translator.

Launch modes in single player mode. Nothing happens except the plates “Something is creating script errors”.

Console(This is an excerpt):
[ERROR] gamemodes/wintersurvival/gamemode/rounds.lua:162: attempt to call global ‘SinglePlayer’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/rounds.lua:162
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/rounds.lua:162: attempt to call global ‘SinglePlayer’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/rounds.lua:162
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

TEST [lua/includes/modules/a_star_pathfinding.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_schedule_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/ai_task_slv.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/json.lua][lua/includes/modules/hook.lua]
TEST [lua/includes/modules/nodegraph.lua][lua/includes/modules/hook.lua]

[ERROR] gamemodes/wintersurvival/gamemode/cl_help.lua:27: attempt to call method ‘IsRoundStarted’ (a nil value)

  1. v - gamemodes/wintersurvival/gamemode/cl_help.lua:27
  2. unknown - lua/includes/modules/hook.lua:84

[editline]10th November 2014[/editline]

As I understand it, after the transition to the new version Gmod have changed hooks. YEs?

Could you post the code for the ‘IsRoundStarted’ function? I assume that the SinglePlayer error your getting is because your in singleplayer, post the code from the file rounds.lua on line 162.

edit: don’t forget to wrap the code using the wrap code tags


if SinglePlayer() or MaxPlayers() <= 1 then
return
end

[editline]10th November 2014[/editline]

By the way. Create a multiplayer game session and add a bot:



] bot 
Player Bot02 has joined the game

[ERROR] gamemodes/wintersurvival/gamemode/init.lua:741: bad argument #2 to 'Find' (string expected, got no value)
  1. Find - [C]:-1
   2. iBdata - gamemodes/wintersurvival/gamemode/init.lua:741
    3. unknown - gamemodes/wintersurvival/gamemode/init.lua:111


[ERROR] gamemodes/wintersurvival/gamemode/init.lua:179: attempt to index local 'select' (a nil value)
  1. unknown - gamemodes/wintersurvival/gamemode/init.lua:179


[ERROR] gamemodes/wintersurvival/gamemode/init.lua:121: attempt to index a nil value
  1. unknown - gamemodes/wintersurvival/gamemode/init.lua:121


Yeah thats just all around broken…

Where did you get the gamemode?

Find. stuff was changed on gmod13, go look an up to date example of it and compare it to yours, you should be able to figure out what to change easily

SinglePlayer needs to be changed to something like IsSinglePlayer or something along those lines, let me find that old ‘why your scripts are now broken’ document

Found it for ya

https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/mobilebasic?pli=1

Thank you. I’ll try to fix it.

[editline]11th November 2014[/editline]

I need all the files to make these corrections?

[editline]11th November 2014[/editline]

In this document, not all errors are written … There must be a base change.

Progress went like! While outwardly of course nothing but one error corrected create font. Newman just moved to a new version of Lua and there are some features become more advanced.

Not who is not willing to help?

[editline]11th November 2014[/editline]


[ERROR] gamemodes/wintersurvival/gamemode/init.lua:179: attempt to index local 'select' (a nil value)
  1. unknown - gamemodes/wintersurvival/gamemode/init.lua:179

IN init.lua


		local good = true
		for k,v in pairs(player.GetAll()) do
			if (select:GetPos() - v:GetPos()):Length() < 64 then
				good = false
			end

What is correct? I can not understand.

[editline]11th November 2014[/editline]

I change


if (select:GetPos() - v:GetPos()):Length() < 64 then

on


[if (v:GetPos() - v:GetPos()):Length() < 64 then

[editline]11th November 2014[/editline]

It is right?

On Which Revision you started to fix it up? r305added gmod 13 support somewhat and r306added some more. r307 is kinda uninteresting, since it just updates the todo.txt.

Btw an Gamemode is kinda hard, if you doesn’t got at least some basic lua experence, then you should start with some easy addons. The GM Seems interesting and i will look if i got some spare time next week to fix the basic bugs. Maybe that would help you.

Oh my goD! It works! Almost … thing at stake is not falling out.

[editline]11th November 2014[/editline]

I almost did. Yes, I do not know how to program, but I can read the language, so that nothing sophisticated sotavit me correct code. On Gmod 10 still was an error with the mod that pridmet falling out … I have corrected and now remember. Well, if anything, my Steam: http://steamcommunity.com/id/SmeRT_Kungur

pridmet? did you mean předmět? sorry, but my english and russian isn’t the best :slight_smile:

My too) Iy is google.translate

[editline]11th November 2014[/editline]

I fool repaired version 289. But the last does not work, practically the same mistakes.


[ERROR] gamemodes/wintersurvival/gamemode/doodads.lua:80: attempt to index local 'item' (a nil value)
  1. doodadSpawnItems - gamemodes/wintersurvival/gamemode/doodads.lua:80
   2. NewRound - gamemodes/wintersurvival/gamemode/rounds.lua:63
    3. v - gamemodes/wintersurvival/gamemode/init.lua:99
     4. unknown - lua/includes/modules/hook.lua:84

What is there instead item.model need?


drop:SetModel(item.model)

You need to see the whole code.
item.model is referencing item, which is on line 78
[lua]local item = self.items[v][/lua]
v is from the loop “for k,v in pairs(self.randomFromTable(self.doodad.items,range_items*vol)) do”
so something is broken here, but i need some time to debug that. What you could try is to reserve the whole function. especially where what is called.

I have it back to work, but things do not fall out. And yet there was such an error:



[ERROR] gamemodes/wintersurvival/gamemode/init.lua:311: attempt to call method 'GetClass' (a nil value)
  1. unknown - gamemodes/wintersurvival/gamemode/init.lua:311
   2. TakeDamage - [C]:-1
    3. unknown - gamemodes/wintersurvival/gamemode/init.lua:115




function GM:EntityTakeDamage(ent,inflictor,attacker,amount,dmginfo)
	//Msg(ent,"::",inflictor,"::",attacker,"::",amount,"
")
	if inflictor:GetClass() == "ws_item" then
		local class = inflictor.class
		if class then
			local dat = self.items[class]
			if dat then
				maxdmg = dat.damage2 or dat.damage
				if maxdmg then
					dmginfo:SetDamage(math.min(dmginfo:GetDamage(),maxdmg))
				end
			end
		end
	end
 

ETD now got 2 args in Gmod13, not 5 as in Gmod12. So you need to understand the function and rewrite it.

What to do now?

[editline]11th November 2014[/editline]

I not understand(