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


Documentation Post useful tutorials and other informative material.

Thread Tools Display Modes
Old 06-06-2011, 03:14 AM   #1

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

It works by SpawnBuilder command and setting builder costs. Like a command (Set values) is done "at once" before the engine routine starts (remove the gold, spawn the builder). So Setting the defaults values (650 gold) must be outside the command.

This sample script remove 2000 gold and spawns an extra builder. Don't know how go get the ID of the newly spawned builder. We could iterate of all of all entitys until we got him, but it would be a waste of resources. Well... we know S2 Games...

The SpawnBuilder() can be forced by of "onload" widget which is called by the UICall command.

Set _takeAwayMoney 2000
UICall ShowWidget takeAwayMoney
UICall HideWidget takeAwayMoney
Set _takeAwayMoney 0
<button name="ToggleRepairable" y="0" width="15" height="15" valign="bottom" align="center" onclick="ToggleRepairable(); echo (1000); Set (g_workerCost, 2000); Set (g_workerMaxActive, 4); SpawnWorker();echo (1111);" onmouseout="Set (g_workerCost, 650); Set (g_workerMaxActive, 3);" color="invisible" ontrigger="SetVisible(param);">
Ugly work around for tower defense: Make the stronghold invulnerable and place an enemy npc who kills the pets with 1 hit.


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

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:20 AM.