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 05-25-2010, 03:03 PM   #1
Pidgeoni

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

Greetings...

Let's post whatever weird we found out modding, so other modders learn about it and solve their problems faster!

My random discovery to beggin with:

-How to check if a garrison/sublair is 100% built (other buildings not tested):

//You somehow got the building's index, stored into _building_index variable

Set _indicator #IsEntityActive(|#_building_index|#)#
If [_indicator == 1] "SendMessage -1 The building is 100% up!"
If [_indicator == 0] "SendMessage -1 The building is not built yet!"

Pidgeoni is offline   Reply With Quote
Old 05-28-2010, 05:15 AM   #2
eaxs

eaxs's Avatar
 
Join Date: May 2008
Location: Germany
Posts: 2,611
Thanks: 9
Thanked 40 Times in 24 Posts
Default

Very nice. I didn't think of that way yet. Might update hvl with that code
eaxs is offline   Reply With Quote
Old 05-28-2010, 08:00 AM   #3
AdmiralXiggy

 
Join Date: Feb 2010
Posts: 281
Thanks: 0
Thanked 2 Times in 1 Post
Default

Epic, I haven't played HVL in a while.
AdmiralXiggy is offline   Reply With Quote
Old 08-14-2010, 01:04 AM   #4
Old55

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

I have a new one:

If you want to drop a chest with a particular item you have to give the chest the item in inventory slot 1 or greater:

SpawnEntityAtEntity some_entity Entity_Chest name chest1
GiveItem #GetIndexFromName(chest1)# 1 Consumable_HealthMajor

This will spawn a chest with an item that the player can now pickup
__________________
Old55 is offline   Reply With Quote
Old 08-23-2010, 12:02 PM   #5
PetzI

PetzI's Avatar
 
Join Date: Jun 2007
Posts: 1,814
Thanks: 18
Thanked 72 Times in 50 Posts
Default

Tip:

Don't ever use accents ( etc) when scripting. It will corrupt your map. To fix this, you'll have to open up the triggerlist file with Notepad or something, track down the accent and delete it.
PetzI is offline   Reply With Quote
Old 08-24-2010, 02:59 PM   #6
rohezal

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

Stanz editor is down :(.
Is it uploaded around somewhere? *wished a central place for modding stuff like savager or savage2howto or something*
__________________

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-24-2010, 03:23 PM   #7
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
Stanz editor is down :(.
Is it uploaded around somewhere? *wished a central place for modding stuff like savager or savage2howto or something*
Don't have the zip file anymore, but here is the .exe and .dll that were in it.

http://hood.icmb.utexas.edu/~paul/K2SE.exe

http://hood.icmb.utexas.edu/~paul/DelZip179.dll
__________________
Old55 is offline   Reply With Quote
Old 08-25-2010, 10:56 PM   #8
rohezal

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

Thx old

If you want to learn how to script look at the tutorial map, mods like savage Survival, HvL, Eldarax and read eaxs great documentation (www.s2howto.com) and google sometimes for names maybe you find a thread.

There are console commands, proximity Triggers, World Scripts which are automacly called when something happened (e. g. a player joins). With ScriptgetParam(nameOfParam) you can get a param which a script gets (e.g. player joins get automaticly the clientId of the joined player which is very important, in this case ScriptgetParam(clientid)). Scripts can call other scripts. There are no normall brackets and loops you have to use gotos instead.

Important to know is:

CreateVar int firstVar 1
CreateVar int secondVar #firstVar# //## means the string enclosed by the # symbols is a varname not a string or entity name or something
CreateVar int thirdVar [secondVar+1] // brackets [ or surrounding multiple operations

CreateVar int secondVar #GetPosX(|#idOfSomething|#)# // he we need escpaed brackets or the interpreter would see this.

#GetPosX(# <- VarName or Funktioname
idOfSomething <- random String
#)# <- VarName

// you escape # symbols with a | before them so # -> |#

Edit:

Some functions expect types

Like if[Var == 1]

without # symbols, because the expect vars.
Other expect value
set Var 1
set Var Value
so its not: set Var Var2 <- var2 is a variable
set Var #Var2# <- #Var2# is the value of the variable
__________________

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...


Last edited by rohezal; 08-26-2010 at 01:09 AM.
rohezal is offline   Reply With Quote
Old 08-25-2010, 11:02 PM   #9
NingosSmurf

 
Join Date: Feb 2010
Posts: 3,331
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Pidgeoni View Post
Greetings...

Let's post whatever weird we found out modding, so other modders learn about it and solve their problems faster!

My random discovery to beggin with:

-How to check if a garrison/sublair is 100% built (other buildings not tested):

//You somehow got the building's index, stored into _building_index variable

Set _indicator #IsEntityActive(|#_building_index|#)#
If [_indicator == 1] "SendMessage -1 The building is 100% up!"
If [_indicator == 0] "SendMessage -1 The building is not built yet!"

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.
NingosSmurf is offline   Reply With Quote
Old 08-25-2010, 11:35 PM   #10
rohezal

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

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.
__________________

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 04:44 PM.