Another scripting thread

Discuss all aspects related to modding Zandronum here.
Post Reply
MotorWülf
 
Posts: 34
Joined: Sat Aug 03, 2013 5:33 pm

Another scripting thread

#1

Post by MotorWülf » Sun Aug 11, 2013 7:08 am

I may be having an issue similar to Lord of D the other day regarding ACS scripts not being loaded or generally not working.

I probably have some fundamental misunderstanding because I'm very new, but I'm just starting ACS scripts today and I've got it working in Doombuilder, but running the pk3 through Zandronum, the script is not loaded.
I've looking into it a bit, and I've taken the scripts typed in doombuilder and ran it through acc.exe, then named that .o file "Behavior.o" and stuck it in the map wad (inside the pk3), but that isn't working.
I'd appreciate any help, even if it's just linked tutorials.

User avatar
-Jes-
Frequent Poster Miles card holder
Posts: 975
Joined: Fri Aug 03, 2012 9:55 am
Location: Void Zone

RE: Another scripting thread

#2

Post by -Jes- » Sun Aug 11, 2013 9:36 am

You have to put the .o file in the Scripts folder. Then you also have to add a LOADACS lump to the main folder. Create it and just simply write BEHAVIOR in it.
Last edited by -Jes- on Sun Aug 11, 2013 9:37 am, edited 1 time in total.

MotorWülf
 
Posts: 34
Joined: Sat Aug 03, 2013 5:33 pm

RE: Another scripting thread

#3

Post by MotorWülf » Sun Aug 11, 2013 4:17 pm

Thanks for the reply.
I'm now getting a "Could not find autoloaded ACS library BEHAVIOR" error however.
I made a Scripts folder in the .zip, put BEHAVIOR.o in it, and made a .txt named LOADACS in the .zip top directory as well, wrote "BEHAVIOR", rezipped and launched.
To make BEHAVIOR.o I just copied the working script from DB2 into a .txt then clicked and dragged it into Zdoom's acc.exe.
I also tried adding #library "BEHAVIOR" at the top of the .txt before converting, but that didn't help.

EDIT:

I fixed it by creating a new .zip and starting over copying the format of another wad (all lower case folder names and "acs" instead of scripts, but I'm not sure exactly why it didn't work in the first place.
Anyhow, thanks for the tip, Jes
Last edited by MotorWülf on Mon Aug 12, 2013 5:02 pm, edited 1 time in total.

Scott_Minikhiem
New User
Posts: 14
Joined: Mon Nov 19, 2012 12:46 am

RE: Another scripting thread

#4

Post by Scott_Minikhiem » Fri Sep 20, 2013 5:19 am

I want to bump this thread as I also have a newb question to throw out there.........

Im making a script that will force the player to not pick up a weapon if he has no ammo for it. The weapon pickup has a jumpifinventory state jump that jumps to a pickup fail if the player has no ammo for the weapon. Problem is the script(s) giving the player the fake inventory item for said jump are not working:

Script 3100 ENTER
{
IASSIGNED = (PLAYER_TID_START + PlayerNumber());
int invnum_A = CheckInventory("Cell");
Delay(10);
If (invnum_A >= 100);
{
TakeActorInventory(IASSIGNED, "DoesHeNotHaveCell", 1);
}
If (invnum_A < 100); //if he has less than 100 cells returns that he doesnt have enough cells to bother picking up the weapon
{
GiveActorInventory(IASSIGNED, "DoesHeNotHaveCell", 1);
}
Restart;
}

And....

Script 3110 ENTER
{
IASSIGNED = (PLAYER_TID_START + PlayerNumber());
int invnum_A = CheckInventory("Clip");
int invnum_B = CheckInventory("RifleAmmo");
Delay(10);
If ((invnum_A >= 1) || ((invnum_B >= 1)));
{
TakeActorInventory(IASSIGNED, "DoesHeNotHaveCliporRifleAmmo", 1);
}
If ((invnum_A < 1) && ((invnum_B < 1)));
{
GiveActorInventory(IASSIGNED, "DoesHeNotHaveCliporRifleAmmo", 1);
}
print(s:"FUck");
Restart;
}

I have scripts like these for each weapon but it doesnt work can anyone tell me why? Originally I had the tid set as 0 for obvious reasons and changed this in my attempt to fix the problem, no bueno.

What happens is the player walks over the pickup, it jumps to the fail state no matter if he has ammo or not

Qent
Retired Staff / Community Team Member
Posts: 1424
Joined: Tue May 29, 2012 7:56 pm
Contact:

RE: Another scripting thread

#5

Post by Qent » Fri Sep 20, 2013 5:33 am

Without even looking at the code, 3100 and 3110 are not valid script numbers. Zandronum scripts must be numbered from 1 to 999, inclusive.

Your if statements are also broken:

Code: Select all

if(foo); // Bad semicolon! Ends the if clause right here.
{
  // Do stuff in here no matter what foo is!
}

// Versus...

if(bar) // No semicolon!
{
  // Only do this if bar was true!
}
Last edited by Qent on Fri Sep 20, 2013 5:41 am, edited 1 time in total.

Scott_Minikhiem
New User
Posts: 14
Joined: Mon Nov 19, 2012 12:46 am

RE: Another scripting thread

#6

Post by Scott_Minikhiem » Fri Sep 20, 2013 9:55 am

Im an idiot. That being said these scripts are running despite the numbers...

And it works now and im stoked, this is epic
Last edited by Scott_Minikhiem on Fri Sep 20, 2013 10:02 am, edited 1 time in total.

Scott_Minikhiem
New User
Posts: 14
Joined: Mon Nov 19, 2012 12:46 am

RE: Another scripting thread

#7

Post by Scott_Minikhiem » Fri Sep 20, 2013 11:53 am

I would like to make a script that can remove monsters based on how many monsters there are in the map... any ideas? This is to avoid a map being unplayable (for those epic coop maps). If i can get started in the right direction I'de add variables that store the monsters in a cache to be released later, and change things here or there based on how many players ect...

And I mean a script that can work on any map, not built into a map.
Last edited by Scott_Minikhiem on Fri Sep 20, 2013 11:55 am, edited 1 time in total.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Another scripting thread

#8

Post by Ijon Tichy » Fri Sep 20, 2013 12:21 pm

if there were a way to get access to all the actors on the map, then yes, this would be possibile in a general manner, but since there isn't, you're either going to have to replace every monster with a variant that runs an ACS script first thing in their spawn state and have that keep track of things (edit) or control the monster spawning and whatnot, and make sure they all run a certain script

you wouldn't even need a giant array, just do something like this

Code: Select all

int myIndex = GlobalMonsterIndex++;

while (myIndex + 1000 <= GlobalMonsterIndex)
{
    Delay(1);
}

Thing_Remove(0);
with GlobalMonsterIndex being a map variable

as more monsters run the script, the index would go higher and higher, and after 1000 iterations of this, the first monsters to run this would disappear because now their index + 1000 isn't greater than GlobalMonsterIndex (since 1000 monsters spawned)
Last edited by Ijon Tichy on Fri Sep 20, 2013 3:08 pm, edited 1 time in total.

Scott_Minikhiem
New User
Posts: 14
Joined: Mon Nov 19, 2012 12:46 am

RE: Another scripting thread

#9

Post by Scott_Minikhiem » Fri Sep 20, 2013 12:49 pm

Perfect THANK YOU

Post Reply