Savage 2: A Tortured Soul Forum

Savage 2: A Tortured Soul Forum (http://forums.savage2.com/index.php)
-   Documentation (http://forums.savage2.com/forumdisplay.php?f=33)
-   -   Random Short Weird Tips (http://forums.savage2.com/showthread.php?t=22234)

Pidgeoni 05-25-2010 04:03 PM

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!"

;)

eaxs 05-28-2010 06:15 AM

Very nice. I didn't think of that way yet. Might update hvl with that code :)

AdmiralXiggy 05-28-2010 09:00 AM

Epic, I haven't played HVL in a while.

Old55 08-14-2010 02:04 AM

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

PetzI 08-23-2010 01:02 PM

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.

rohezal 08-24-2010 03:59 PM

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

Old55 08-24-2010 04:23 PM

Quote:

Originally Posted by rohezal (Post 393132)
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

rohezal 08-25-2010 11:56 PM

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

NingosSmurf 08-26-2010 12:02 AM

Quote:

Originally Posted by Pidgeoni (Post 364595)
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.

rohezal 08-26-2010 12:35 AM

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.


All times are GMT. The time now is 09:43 AM.