Go Back   Savage 2: A Tortured Soul Forum > Savage 2 Modding > Documentation

Notices

Documentation Post useful tutorials and other informative material.

Reply
 
Thread Tools Display Modes
Old 08-26-2010, 12:59 AM   #11
Old55

Old55's Avatar
 
Join Date: Jun 2009
Posts: 2,586
Thanks: 14
Thanked 428 Times in 209 Posts
Default

Quote:
Originally Posted by rohezal View Post
When you set your Vars in maploaded your game will crash when you start the game and leave the warmup mode. I needed to copy them to the gamestart script.
I never noticed this. I set lots of vars in maploaded, and I am pretty sure so does Eldarax, etc.
__________________
Old55 is offline   Reply With Quote
Old 08-26-2010, 01:07 AM   #12
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

It happens to me the first time, when i tried to spawn units and SendMessage the coords which rely on Vars which were created in mapload. After copy the CreateVar part the into gamestart it worked. Before everything freezes. But probably it was just a endless loop since some things weren't initialised.
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 08-26-2010, 05:05 AM   #13
winex

winex's Avatar
 
Join Date: Sep 2009
Location: Moscow, Russia
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can also check soccer_test, i've spent about a month improving it :P
i'm not sure if there are any new or better ways of doing things
also, incoming downloader mod should be awesome. that's my current effort.

Linux: use xorc's s2 toolchain for managing .s2z's. you can edit scripts by any text-editor, which are parsed to separate files under triggers/ dir.
my k2tool will be nicer when i publish it :P those who interested may ask for a link (if they don't know already where my stuff is located) :P

rohezal,
hangs aren't crashes. :P relying on uninitialised vars is programmer's major fault.
also, avoid using same vars in longer-time processing loops, like any wait-for-something loops.
i mean variable scope (locality?) here. all vars are global. so, if you use _i in two loops at the same time -- you'll get weird results or even hangs (up to crashes in some cases)!
__________________
in code we trust...
winex is offline   Reply With Quote
Old 08-26-2010, 09:06 AM   #14
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Red face Bit the bait

Quote:
Originally Posted by NingosSmurf View Post
i know im an arrogant *******, but that's just so basic programming. and i mean really really reeeeeally basic. but go on, nice thread etc.
I never wanted to demonstrate how If and SendMessage was used. Nor how to program. I'm not a professional programmer. The goal was to list some k2 engine's curiosities.

I just found it curious (and it took me some time to find out, testing various functionlist results) that you check if buildings are up with a function called IsEntityActive. My english is not that good, but i understand that Built!=Active (although a built building should be active )

And to be honest, when i started this, i just wanted to see experienced modder tips, not to demonstrate my pitifull "discoveries". Eg, i like the chest tip
Pidgeoni is offline   Reply With Quote
Old 09-07-2010, 12:11 PM   #15
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

Ok I found out what happened propably why maploaded didn't work for me. The player joined AFTER the map was loaded so some things couldn't be handled (and so moved at player_join).
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 09-09-2010, 12:27 PM   #16
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

How to deal with angles / rotation:

setangles the_behemoth #_x# #_y# #_z#

Sets the angle to the given coords
absolute, not like setplayerangles relative. A sample Script:


Script for
rotating a model named "the behemoth"

CreateVar float _x 0
CreateVar
float _y 0
CreateVar float _z 0

SendMessage -1 setangles X
//goto
SKIP_TO_Z

@LOOP
if [_x > 360] "goto ENDLOOP"
setangles the_behemoth
#_x# 0 0
set _x [_x + 1]
sleep 10
goto LOOP
@ENDLOOP
SendMessage -1
setangles Y

@LOOP2
if [_y > 360] "goto ENDLOOP2"
setangles
the_behemoth 0 #_y# 0
set _y [_y + 1]
sleep 10
goto
LOOP2
@ENDLOOP2

@SKIP_TO_Z
SendMessage -1 setangles Z

@LOOP3
if
[_z > 360] "goto ENDLOOP3"
setangles the_behemoth 0 0 #_z#
set _z [_z +
1]
sleep 10
goto LOOP3
@ENDLOOP3

SendMessage -1 setangles DONE

set _x
0
set _y 0
set _z 0
Reply


getting angle positions

getroll (entityname or id) -> y
getpitch (entityname or
id) -> x
getyaw (entityname or id) -> z
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 09-09-2010, 03:27 PM   #17
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

Creating a lift. With an NPC.

You can move the npc and the player could stand on it. Take a normal NPC, copy the folder, remove attacks, give lots of life and change model. The use set position or moveTo (maybe new script).
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 09-09-2010, 07:18 PM   #18
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Default

Lolz at the elevator!!!
Pidgeoni is offline   Reply With Quote
Old 09-13-2010, 12:14 AM   #19
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

Broken Comment:

//this is a comment; this isnt a command anymore

I had a //string; lets ... comment in my script and was wondering why warnings were written
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 09-14-2010, 12:27 AM   #20
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

No Pet_Hunter. I thought there is one, since there is a buttun in the tutorial. But if you click on it nothing happen. I thing there is no pet hunter.

Hunter Wind / Fly Animations are hardcoded. You can use sprint_fwd /glide / jump etc. or something but it wont move its wings. At spin too but it doesnt look too bad if you use it for a flying hunter. I'm asking myself how eaxs did it in eldarax.

Steambuchets (and I think Steam Battering Ram) wheel movement is hardcoded. If you change the buchet to an other model, it rotates / bows during moving.
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 07:00 PM.